panda quit when calling destroywindow method from directx

Hi, I have a little problem.

I created an external library in c++ and made a dll. With boost, I can acces this library with python and all works well, except one method.
This method convert procedural texture in jpg, using directx. When I call this method, my procedural texture is created and I can see the jpg on my hdd. But unfortunately, panda windows quit without saying anything except this :

shell returned -1073741819

After looking deeper in my c++ code, I found that it quits just after I call

hWnd = CreateWindow( "Test01", "Test01", 
WS_OVERLAPPEDWINDOW, 10, 10, 200, 150,
NULL, NULL, wc.hInstance, NULL );

If anybody knows what I am doing wrong, It’ll help me a lot.

Thanks.

Hmm, maybe you have loaded an incompatible directx dll? Or otherwise somehow corrupted the directx runtime for when Panda tries to invoke it?

Just shots in the dark here.

David

Yeah, that’s what i was thinking but if I launch panda in opengl, it shouldn’t interfere ?

If it interfere, yes, when I use the library, it changes the directx context to this :

Render states:
D3DRS_SRGBWRITEENABLE 0
D3DRS_SEPARATEALPHABLENDENABLE FALSE
D3DRS_STENCILENABLE FALSE
D3DRS_SCISSORTESTENABLE FALSE
D3DRS_ZFUNC D3DCMP_LESS
D3DRS_ZWRITEENABLE TRUE
D3DRS_SHADEMODE D3DSHADE_GOURAUD
D3DRS_FOGENABLE FALSE
D3DRS_SPECULARENABLE FALSE
D3DRS_FOGTABLEMODE D3DFOG_NONE

Sampler states for the first four samplers:
D3DSAMP_SRGBTEXTURE 0
D3DSAMP_ELEMENTINDEX 0

The DepthStencilSurface must be set to NULL.

Is it the problem with panda ?

In order to try to better understand and debug the problem, I used the c++ panda hello world, and call my method inside.
I finally manage to find the cause of the problem, but not really the “Why”.
In my library, I have an object BasicD3D. This object creates an hWnd with CreateWindow.
In his destructor, he calls DestroyWindow(hwnd) and here is the problem. It also kills panda window.
I didn’t find yet the reason, so if anybody has a clue.