|
-
Apr 23rd, 2001, 01:16 PM
#1
Thread Starter
Frenzied Member
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++.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Apr 23rd, 2001, 01:37 PM
#2
Frenzied Member
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.
Harry.
"From one thing, know ten thousand things."
-
Apr 23rd, 2001, 02:09 PM
#3
Monday Morning Lunatic
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
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 23rd, 2001, 02:22 PM
#4
Thread Starter
Frenzied Member
Thanks, guys. The header file works beautifully, Parksie.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|