| | |
passing in ascii/unicode strings to LoadLibrary
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Dec 2006
Posts: 36
Reputation:
Solved Threads: 0
hi,
i have this code:
i get this compile error:
Error 1 error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'const char [15]' to 'LPCWSTR' c:\Documents and Settings\Administrator\Desktop\Component1\Client1\Client1.cpp 9
so i changed the code:
however GetLastError returns ERROR_MODULE_NOT_FOUND. the dll IS in the exe directory though, so its not the location that is the problem. in addition, if i call LoadLibraryA, the function loads the library successfully.
so why is LoadLibrary((LPCWSTR)"Component1.dll"); failing?
thanks!
i have this code:
HINSTANCE hComponent = ::LoadLibrary("Component1.dll");
i get this compile error:
Error 1 error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'const char [15]' to 'LPCWSTR' c:\Documents and Settings\Administrator\Desktop\Component1\Client1\Client1.cpp 9
so i changed the code:
HINSTANCE hComponent = ::LoadLibrary((LPCWSTR)"Component1.dll");
however GetLastError returns ERROR_MODULE_NOT_FOUND. the dll IS in the exe directory though, so its not the location that is the problem. in addition, if i call LoadLibraryA, the function loads the library successfully.
so why is LoadLibrary((LPCWSTR)"Component1.dll"); failing?
thanks!
![]() |
Similar Threads
- help,it's about my keyboard (USB Devices and other Peripherals)
- Unicode & Java (Java)
- VS compiler error??? (C++)
- Coverting a string to a byte array (Visual Basic 4 / 5 / 6)
- Unicode and Strings (Visual Basic 4 / 5 / 6)
- C++ handling of strings in a boolean expression (C++)
Other Threads in the C++ Forum
- Previous Thread: Error messages aplenty!!!!!
- Next Thread: date
Views: 2718 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project python random read recursion recursive reference return sort stream string strings struct studio system template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






