convert C# code to call DLL into C++ code
Not sure if this is in the correct place, since it's to do with C# and C++
I've got the following code:
Code:
[DllImport("camdll.dll")]
static extern void TiltCam (Int32 id, Int32 x, Int32 y);
I've also got a dll file.
I want to call this function in the dll file, but in a C++ application.
What i've got so far is this:
Code:
HMODULE hDll = LoadLibrary("camdll.dll");
FARPROC fpMoveCam = GetProcAddress(hDll, "TiltCam");
typedef void(__stdcall *fpMoveCamT)(INT32 id,INT32 x, INT32 y);
fpMoveCamT MoveCam = (fpMoveCamT)fpMoveCam;
//////////////////////////////////////////
MoveCam(1,500,500);
Is this a correct translation?
The reason that i ask is that it appears that i can call the function ok, but i sometimes get wierd errors, depending on the arguments, plus it doesn't do what its supposed to do.
Thanks a lot for any help, even if it's to say that there must be something else wrong, i'm really stuck with this one.
Re: convert C# code to call DLL into C++ code
Re: convert C# code to call DLL into C++ code
Thanks for the link. I've since managed to get it working, turns out something else was wrong, causing the function to appear not to work.