I do realize that a number of questions regarding calling a DLL from vb.net have been raised. I have implemented the DLL from vb.net. I would like to know if the calling procedure is correct or should I be calling the DLL in a different way?
C++ DLL prototype
extern "C" int FitCurve(int solid_or_fluid, int prop_id, int fit_id, int N_points, int N_terms, char *file, double *x_data, double *y_data)
I have a C++ application exe that uses a C++ dll. I don't have the source of this C++ application and cannot rebuild it. But I know that it uses the traditional LoadLibrary and GetProcAddress to access individual functions in the dll.For some reasons, I want to replace the C++ dll with a VB.NET dll. The dll is not and ActiveX and is therefore not registered.I think I cannot use a class but a module since the C++ exe application does not expect any class in the dll. In all my attempts, I could not have the inner functions of the VB.NET to be called by the C++ exe.How should I write the VB.NET dll?
I'm not sure whether this is a VB forum question or a C++ question, but I'll try here first. I have an API library written in C++ (including source) which compiles to several DLLs. I want to call the functions in the library from VB but I can't get the parameter passing right.
[Code]...
The above example runs but returns nothing. If I change DeviceName to ByRef, I get protected memory errors.
The full library and documentation is available on the internet if anyone would like to download it and I've successfully compiled it with VS2010.
I have followed instructions on Best way to use a VB.NET class library from a C++ DLL? but being new to VB I don't know if I've got the VB part right let alone the C++. here I'll correct the code below for posterity's sake!
Here they are: VB first; the project is a Class Library, all settings default except that "Register for COM interop" is switched on in the project properties.
Public Class Class1 Public Sub New() 'do stuff
[Code]....
is the VB correct? Do I need to add anything like an interface to it? Assuming I want to call it over COM not C++/CLI, how do I do that. (This seems like the logical choice as the client already calls other stuff over COM; however, I'm not sure where to get the IDispatch pointer from, in my other code it's passed to me by the client). If I went the C++/CLI route, when moving up from toy project to actual implementation, that would mean changing my existing C++ code from "no clr support" to "/clr" - is that likely to break it?
I have a C++ application exe that uses a C++ dll. For some rasons, I want to replace the C++ dll with a VB.NET dll. The dll is not and ActiveX and is therefore not registered.I cannot use a class but a module since the C++ application does not expect any class in the dll. In all my attempts, I could not have the inner functions of the VB.NET to be called by the C++ exe.How should I write the VB.NET dll?
This might seem like an insanely easy question, but I cant seem to find an answer anywhere to it. I'd like to think that I am decent at VB but while I was learning javascript the other day I found something that seemed awesome and now I cant figure out how to do it in VB.in javascript it looks like this
var someValue = getThatValue()Its both calling and setting the value from the getThatValue() sub. what is the VB equivalent?
In C# I can do this:new SomeObjectType("abc", 10);
In other words, I can call new without assigning the created instance to any variable. However, in VB.Net it seems I cannot do the same thing.New SomeObjectType("abc", 10) ' syntax error
I have a need to create a Tcl extension that calls a managed .NET DLL/Class Library. Currently, the structure of my application is Tcl > DLL Wrapper (C++ CLR) > .NET Class Library (VB.NET), where ">" represents a function call.
My VB.NET DLL just takes a value and returns it back, keeping it simple for now. In the end, this will do some more advanced stuff that makes use of some .NET functionality.
Public Class TestClass Public Function TestFunction(ByVal param As Integer) As Integer Return param End Function End Class
My Tcl Extension (C++ CLR) creates an object of the type above
int TestCmd(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { // Check the number of arguments
[code].....
If my VB.NET DLL is in the same directory as my extension DLL, the extension crashes when it instantiates a TestClass object. I've noticed if the VB.NET DLL is relocated to C:Tclin, the extension will find it, and TestCmd can be called just fine. The problem is that this will eventually need to be deployed across a number of PCs, and it's preferred not to mingle my application's files with another application's.
The cmd file calls a web service that is used to select specific data. When I run the .cmd file manually (as in clicking on it) it runs correctly an saves the file with the information in the appropriate location. However when i try to do this with the .Net app the file is saved however there is no data in it. Why is it when I physically click this same .cmd file with my mouse it works but not when I call it from my application.
I have used the PInvoke Signature Toolkit to create VB.NET function definitions for three fairly simple C functions contained in an external DLL. The problem is that two of the parameters are structures so pointers need to be sent and one structure (fileview) is undefined.
The structure of fileinfo is defined so I can create a structure definition in VB.NET and create an IntPtr to that structure with Marshall.AllocHGlobal. And then I can use Marshall.StructureToPtr to copy the data and do the inverse when the data is returned.
I'm having some problems calling a C function from a DLL. The function is returning -101 which translates as a "bad parameter". The values I am passing have been returned from another, successful function call, so my current assumption is that I've built the structure incorrectly.The function definition is:
int sm_switch_channel_input(struct sm_switch_channel_parms *switchp) Parameters *switchp (a structure of the following type): typedef struct sm_switch_channel_parms {
i just wanted to calafiy i know how to call a different sub and everything but i wanted to know if you could call a different program all together.
say you have on the first WITCH POWER DO YOU CHOSE. then they hit NEXT and it takes them to a whole new layout and program like saved in a different folder.
i think you do this like you would with webpages
Call ../folder/folder/frmbladeda
if thats wrong or there is an eazyer way also would i do the same thing with varibles like how you do Call addtogether(strone, strtwo) addtogether would be the private sub and strone and strtwo would the the varibles in that said sub.
make sure i want to call a different program like 3 folders away
in a DLL that takes a pointer to a structure as a parameter.The C and VB code is as follows.Am I passing the structure in calling the DLL correctly? I am asking because the API call returns a valid error code indicating error opening the com port specified. I tried all valid ports (com1 on a Vista 32 machine with a USB-Serial device and com1 defined in device mgr, com1 and com2 on a desktop with winxp and 2 real serial ports).I dont have the code for the DLL and cannot debug into the DLL code.
I'm sure this is a pretty simple question but I can't seem to find the answer on Google. Say I've got a function that does some stuff and returns a string. I can assign its return value to a variable:
Dim result As String = MyFunction()
But sometimes I want to perform the actions within the function but I don't care about the return value. I know I can simply call the function from code.
Sub Main() ' Code MyFunction() ' More Code End Sub
This works and does exactly what I need it to. My question is - are there any issues or pitfalls in doing this? Particularly I want to make sure I'm not introducing any performance or memory leak issues.
The function is something like this: "function recieveFindPlayerResponse(displayString)"Now, how can I call it. I was trying this:Call AxShockwaveFlash1.CallFunction("_root.recieveFindPlayerResponse(displayString)")And before I had this, I had a Call function which defines displayString. (Works, as I've tested it before, and no error is given to this.)Now, how can I call a function like the above?
And example of what the code looks like from ******* swf decompiler is: function recieveFindPlayerResponse(displayString) {
Im having trouble with this code, when i had it working with static variables set, it was fine, now i am using a passed variable, its not working... Might not be anything to do with it, anyhow...
I have two forms and one needs to call a method from another form. I am from a java background so i do not understand why the object instaniated (if that is a correct assessment) on one form cannot Call a sub from the second form.
i used the code below to find if any forms called logform are open, there will only ever be one of these open at a time...
Code:
Dim frm As Form For Each frm In My.Application.OpenForms If frm.Name = "logform" Then MsgBox("found form")
[code].....
but thing is when i find the form i want to call a sub in that form's code called action if i use frm.actions() it says that actions() is not a member of [URL]so how do i do this?
in VVB.net I have a string that contains the name of a function, say dim funcstr as string = "MyFunc1". How do I call the function or sub whose name is contained in the string funcstr (in this case, MyFunc1)?
I have a function in vb that is converted to a dll that I want to use in python. However trying to use it, I get an error message this is the VB function
Function DISPLAYNAME(Name) MsgBox ("Hello " & Name & "!") End Function
and this is how I call it in python
from ctypes import * test = windll.TestDLL print test print test.DISPLAYNAME("one")
But I get errors so what is the right way of calling the dll
Traceback (most recent call last): File "C:Test estdll.py", line 4, in <module> print test.DISPLAYNAME("one")
[code].....
I have been looking around online but no solution so far. Can't use cdll since this is for c progs.
I am making a program that will be run on a usb drive. The program needs to run exe that are on the drive but do to it being a usb drive from computer to computer the drive letter can change. How would I be able to run the exe,
Example F:Portable-VirtualBoxPortable-VirtualBox.exe
So I would use Private Sub Button4_Click(ByVal sender As System.Object, ByVal [Code] .....
No problem but when I put the usb into my other computer drive F is no longer drive f: but drive o:
I am just wondering the difference between using "As New" and not using it. It looks like the outcome is same to me. Is there any difference between #1 and #2 when I call "frmCR" from other winform?
A form "frmCR" is alreadu created thru design mode. #1 Dim frmCR As New frmCR frmCR.Show()