application
Code: Select all
If OpenLibrary(0, "WinDLL.dll")=0
MessageRequester("", "Not DLL")
End
EndIf
OpenWindow(0, 0, 0, 300, 300, "Main Window", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 80, 24, "Open window")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget And EventGadget()=0
CallFunction(0, "OpenWin")
EndIf
Until Event = #PB_Event_CloseWindow
CloseLibrary(0)
Code: Select all
Procedure CloseEvent()
id = EventWindow()
UnbindEvent(#PB_Event_CloseWindow, @CloseEvent(), id)
CloseWindow(id)
EndProcedure
ProcedureDLL OpenWin()
id=OpenWindow(#PB_Any, 0, 0, 200, 200, "DLL Window", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
BindEvent(#PB_Event_CloseWindow, @CloseEvent(), id)
EndProcedure
ProcedureDLL DetachProcess(Instance)
CloseWindow(#PB_All)
EndProcedure