Using CreateThread in a DLL
Posted: Thu Mar 08, 2007 4:00 pm
I'd like to show a non modal dialog from within a DLL. Is using CreateThread safe this way? Should I use a Mutex? Should I use the /THREAD commandline when compiling the DLL? As you can see I'm a little fuzzy on what my best options are.
Code: Select all
Global nThread
Procedure NonModalDlg(Value)
If OpenWindow(0, 216, 0, 350, 167, "Example Window", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(0))
StringGadget(0, 100, 60, 230, 30, "")
ButtonGadget(0, 270, 110, 60, 30, "Click Me")
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
EndProcedure
ProcedureCDLL ShowDlg()
nThread = CreateThread(@NonModalDlg, 0)
EndProcedure