Announcement

Collapse
No announcement yet.

Thread start

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Thread start

    I have a program that starts a thread from the main Dialog's callback function (on %WM_INITDIALOG)
    When the thread stops, the main dialog callback also seems to die (cpu at 100%, screen frozen)
    Is it allowed to start threads from a callback? I've found lots of info on how and why to start threads,
    but not on where not to start them


    ------------------
    Peter.
    mailto[email protected][email protected]</A>
    Regards,
    Peter

  • #2
    I do not have that problem:
    Code:
    #compile exe
    #dim all
    #register none
    #include "win32api.inc"
     
    declare callback function DlgProc
     
    function pbmain
     
        local hDlg as long
     
        dialog new 0, "",,,400, 300, %WS_SYSMENU or %WS_MINIMIZEBOX or %DS_CENTER to hDlg
        dialog show modal hDlg call DlgProc
     
    end function
     
    function ThreadFunc(byval hDlg as long) as long
     
        sleep 1000
        msgbox "See you...",,"ThreadFunc"
        SetWindowText hDlg, "Dialog still OK..."
     
    end function	
     
    callback function DlgProc
     
        local r as long, h as long
     
        select case cbMsg
        case %WM_INITDIALOG
    	thread create ThreadFunc(cbhndl) to h : thread close h to r
     
        end select
     
    end function
    ------------------
    [email protected]
    www.dreammodel.dk

    Comment

    Working...
    X