CreateWindowEx - System Error 1411

Hello,

i've been trying to use the call CreateWindowEx call through JNI-interface.
For some reason the function call however returns null which indicates failure for some reason.
GetLastError gives the following information:

ERROR_CLASS_DOES_NOT_EXIST
1411 (0x583)

Apparently something is missing that is needed, but i'm pretty lost what it could be.
Dependency walker shows that all required DLLs exist in the system. Operating system
used is Windows XP SP3.

The problem is below. Strange things is tho, that the code does work in a Windows Server 2003
OS. The CreateWindowEx call does also work fine if it's called from non-JNI declared function -
for example standard main function. Where is the problem?

Note: Window that is created is supposed to use the system class "Static", which is defined as second parameter in the call.

CODE
-------


JNIEXPORT jint JNICALL Java_1WinAPIConnect_CreateWindowEx
(JNIEnv *env, jclass cls, jint iExtStyle, jstring sClsName, jstring sWinName, jint iWinStyle, jint iX, jint iY,
jint iWidth, jint iHeight, jint hWndParent, jint hMenu, jint hInst, jint lpParam)
{

//handle to return value
HWND hwndMain;

//jni string handling
const char *sClsNameTmp = env->GetStringUTFChars(sClsName,0);
const char *sWinNameTmp = env->GetStringUTFChars(sWinName,0);

try
{
// Create the main window. Example parameters: CreateWindowEx(0, "Static", NULL, SS_CENTER, 10, 10, 300, 300, 0, 0, 0, 0)
hwndMain = CreateWindowEx((DWORD)iExtStyle, sClsNameTmp, sWinNameTmp, iWinStyle, iX, iY, iWidth, iHeight,
(HWND)hWndParent, (HMENU)hMenu, (HINSTANCE)hInst, (void *)lpParam);
}
catch(...)
{
debug("CreateWindowEx: failed");

}

//jni string handling
env->ReleaseStringUTFChars(sClsName, sClsNameTmp);
env->ReleaseStringUTFChars(sWinName, sWinNameTmp);
return (jint)hwndMain;
}
Topic archived. No new replies allowed.