Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels,0,"Test",300,300,400,200,%WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local hThread,iResult As Dword
Select Case Cb.Msg
Case %WM_Command
If Cb.Ctl = 100 Then Thread Create AllThreads(0) To hThread : Thread Close hThread To iResult
End Select
End Function
Thread Function AllThreads(ByVal x As Long) As Long
Local hThread As Dword
Dialog Set Text hDlg, "ThreadOne"
Thread Create ThreadOne(0) To hThread
WaitForSingleObject hThread, %Infinite
Dialog Set Text hDlg, "ThreadTwo"
Thread Create ThreadOne(0) To hThread
WaitForSingleObject hThread, %Infinite
Dialog Set Text hDlg, "ThreadThree"
Thread Create ThreadOne(0) To hThread
WaitForSingleObject hThread, %Infinite
? "all done"
End Function
Thread Function ThreadOne(ByVal x As Long) As Long
Sleep 2000
End Function
Thread Function ThreadTwo(ByVal x As Long) As Long
Sleep 2000
End Function
Thread Function ThreadThree(ByVal x As Long) As Long
Sleep 2000
End Function
http://www.garybeene.com/sw/gbsnippets.htm