How to import a DLL
I have no experience with dynamic link libraries. The examples my book provide use the “#using” keyword.
i.e #using <mscorlib.dll>
I have a .dll used for encrypting the username and password when loging into Yahoo Messenger. I copied the .dll to my project folder and used this code to link it.
fatal error C1113: #using failed on 'c:\yahoologinc\ymsg12encrypt.dll
This also don't work
HMODULE hMod = LoadLibrary("YMSG12ENCRYPT.DLL");
I think the .dll was written in vb.
error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'const char ' to 'LPCWSTR'
What am I missing on this?
This is a Unicode problem. Call LoadLibraryA() rather than LoadLibrary().
> This is a Unicode problem. Call LoadLibraryA() rather than LoadLibrary().
Or better yet, use a TEXT or _T macro to transform it to a unicode string literal:
I don't know what your first problem is, though. I think that the #using macro is something from MS Managed C++ or C++/CLI, but I'm not sure.
HMODULE hMod = LoadLibrary(TEXT("YMSG12ENCRYPT.DLL"));
Yea it is, “VC++.NET How to Program” is an intermediate book on managed C++. Very good book though. I never knew VC++ had a built in garbage collector (__gc) till I bought this book.
The main problem was importing this DLL into my chat client. I found a yahoo login example online and I don’t have the code for the DLL just the login example (Written in VB.NET).
I’m practicing network programming as my summer break project and a simple yahoo chat client would be a fun way to do this.