-
Okay, I've learned all of this in the wrong order. I learned C++ (or GNU C++ for those of you who care), then I dove into VB (like that was hard) and now someone has asked me to port a VB DLL to VC++.
Now that's fun.
Anyway... I've been poring through MSDN's web site all morning looking for one thing or another. My question now is... what is the syntax for calling a DLL from VC++.
In VB I could do the following:
Code:
' InternetSetStatusCallback
Public Declare Function InternetSetStatusCallback Lib "wininet.dll" _
(ByVal hInternet As Long, ByVal lpfnInternetCallback As Long) As Long
Function DoWork
InternetSetStatusCallback(lngVar, lngVar2)
end function
How do I do that in VC++.
-
Use LoadLibrary() and get a pointer to the function you want to call. I think that's how it's done. If it's a Windows API function then it should be useable already just by including windows.h.
-
Often, when DLLs are supplied, you also get a header and an import library. To use them simply include the header and link with the library. You can then use all the functions as defined (this is how you use the API from VC++).
If you only have the DLL and the function definitions then you have to go with Harry's method :)
-
Thanks, guys. The header file works beautifully, Parksie.