below you can find a simple code snipped which will load a Window from a DLL
If you complie the code for application.exe and test.dll you will see the following
behavior:
click the "Test.." button:
- MessageRequester "Before OpenMyWindow" will be displayed
- new window "My Window" will be displayed
- close "My Window"
- no MessageRequester "After OpenMyWindow" will be displayed or executed
I have noticed that every code after the call to the DLL which opens the new window does not get executed anymore
or can be debugged.
It would be very helpful if somebody with more knowledge in this area could give me a hint what's wrong with the code.
Best regards,
Kurti
Code: Select all
;_____________________________________________________________________________________
; Application.exe
If OpenLibrary(0, "Test.dll") = 0
MessageRequester("Application", "Test.dll failed", #PB_MessageRequester_Info)
End
EndIf
Procedure ButtonHandlerTest()
MessageRequester("Application", "Before OpenMyWindow", #PB_MessageRequester_Info)
CallFunction(0, "OpenMyWindow")
MessageRequester("Application", "After OpenMyWindow", #PB_MessageRequester_Info)
EndProcedure
Procedure CloseEvent()
id = EventWindow()
UnbindEvent(#PB_Event_CloseWindow, @CloseEvent(), id)
CloseWindow(id)
CloseLibrary(0)
EndProcedure
If OpenWindow(0, 0, 0, 400, 400, "Application", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
BindEvent(#PB_Event_CloseWindow, @CloseEvent(), 0)
ButtonGadget(1,10,30,150,20,"Test...")
BindGadgetEvent(1, @ButtonHandlerTest())
Repeat
EventID=WaitWindowEvent()
Until EventID=#PB_Event_CloseWindow
EndIf
; Executable = Application.exe
; __________________________________________________________________________________________
; Test.dll
Procedure MyCloseEvent()
id = EventWindow()
UnbindEvent(#PB_Event_CloseWindow, @MyCloseEvent(), id)
CloseWindow(id)
EndProcedure
ProcedureDLL OpenMyWindow()
OpenWindow(2, 0, 0, 300, 200, "My Window", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
BindEvent(#PB_Event_CloseWindow, @MyCloseEvent(), 2)
Repeat
EventID=WaitWindowEvent()
Until EventID=#PB_Event_CloseWindow
EndProcedure
; Executable = Test.dll