Hello,
i develop an application using a "smart dll project", and i try to load it
from my main process, using "LoadLibrary" function.
The load fails returning a 126 code for GetLastError()
(ERROR_MOD_NOT_FOUND).
Do i forget something ? is there any informations to write in the registry
before making nk image ?
note, i just copy my dll and my exe after the nk.bin make: i transfer the
two files via activesync...
Here is my sample code :
------------------------
For the dll :
------------------------
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" _declspec(dllexport) void dummy(void){}
------------------------
For the main exe :
------------------------
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hInstance = ::LoadLibrary((LPCWSTR)("\\My
Documents\\test_dll.dll"));
printf("=> %i : %x(%i)", hInstance, GetLastError(),GetLastError());
return 0;
}
Thank you for your help.
Fred
simple dll loading
A little answer from myself... ;) LoadLibrary doesn't work, because of unicode : I had to translate the char * string to unicode like that : char dllName[128]="test_dll.dll" wchar_t* UnicodeString = new wchar_t[1024]; int cchSizeW = MultiByteToWideChar(CP_ACP, 0, dllName, -1, NULL, 0); MultiByteToWideChar(CP_ACP, 0, dllName, -1, UnicodeString, cchSizeW); LoadLibrary(UnicodeString); Now it works very well....

