Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling VB DLL

Status
Not open for further replies.

battaman

Programmer
Jul 30, 2001
6
US
Does anyone know how to call a function in a VB coded dll from a VC++ executable that is being used as an NT service?

Thanks in advance,

Battaman
 
you should declare function as
__declspec(dllimport) declaration of function
HINSTANCE hi = LoadLibrary("your dll");
call here your function
FreeLibrary(x); John Fill
1c.bmp


ivfmd@mail.md
 
Thanks for the response. I did that and got the following error...

error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl MyFunction(void)"

Any thoughts?

Battaman
 
ok, try somt other method:
HINSTANCE hi = LoadLibrary("your dll");
void (*pfunc)(void);
pfunc = GetProcAddress(hi,"MyFunction");
//see MyFunction can be a little mangled inthe dll.
//You should take it in consideration
pfunc();//executing MyFunction
FreeLibrary(x); John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top