Page 1 of 1

Not catching window close in DLL

Posted: Mon Sep 06, 2004 11:08 pm
by halo
I am calling a DLL with Blitz3D. The widnow close event does not get caught. I even tried a Window callback, and the callback function never got used. (I had an End command at the beginning of the callback, to test with.)

Global WIN
Global GADGET_KEYS
Global WINDOWCLOSED
Global SVAR.s

ProcedureDLL.l CS_InitProperties(hwnd)
win=OpenWindow(0,0,0,400,300,#PB_Window_TitleBar+#PB_Window_ScreenCentered+#PB_WINDOW_INVISIBLE+#PB_Window_SystemMenu,"Properties")
CreateGadgetList(win)
GADGET_KEYS=StringGadget(#PB_ANY,0,0,400,300,"",#PB_String_Multiline)
CloseGadgetList()
ProcedureReturn win
EndProcedure

ProcedureDLL.l CS_Properties(keys$)
WINDOWCLOSED=0
SetGadgetText(GADGET_KEYS,keys$)
HideWindow(0,0)
Repeat
eventid=WaitWindowEvent()
Select eventid
Case #PB_Event_CloseWindow
WINDOWCLOSED=1
EndSelect
Delay(1)
Until WINDOWCLOSED=1
SVAR.s=GetGadgetText(GADGET_KEYS)
HideWindow(0,1)
ProcedureReturn @SVAR
EndProcedure

Posted: Mon Sep 06, 2004 11:53 pm
by halo
Now here is where it gets interesting.

I am using two near-identical DLL's for different dialogue windows. Both are about the same as the above code, and I even added a CloseGadgetList() to try to fix things.

The FIRST DLL that gets initialized, the InitProperties() or whatever command, works perfectly. The SECOND dll that gets the window initialized does not return events!

Posted: Tue Sep 07, 2004 12:02 am
by halo
Then I tried using '0' for one window and '1' for the other, and it worked. 2 different DLL's.