News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

WaitForSingleObject

Started by ragdog, September 19, 2009, 09:58:36 AM

Previous topic - Next topic

ragdog

Hi

I have a little problem if i paused my Thread
and exit my app crash this!
The Tread works fine with pause and resume only not by call the Cleanup proc

Information to the Cleanup proc:
1.if Thread paused resume the Thread
2.wait if the Thread finish with WaitForSingleObject
3.end the dialog



@@:
.elseif uMsg == WM_CLOSE
             invoke MessageBox,hWnd,CTEXT ("Are you sure?"), CTEXT ("Question..."), MB_ICONQUESTION + MB_YESNO
             .if eax== IDNO
                jmp @B
             .endif
    .endif
    call CleanUp
         invoke  EndDialog,hWnd,0
  .else
         mov  eax,FALSE
         ret
.endif
mov eax,TRUE
ret

DlgProc endp

CleanUp proc
cmp fPaused, 1
jnz @F
INVOKE ResumeThread, hThread
@@: invoke  WaitForSingleObject,hThread,INFINITE
    invoke  CloseHandle,hThread
ret
CleanUp endp



Can you help me please

Thanks in forward

thomas_remkus

To start off with you might want to check your return values for those API. There might be a clue in there.

ragdog

No I need this check not

Thanks