Hey guys,
Was just wondering if it is possible to use a Sleep function inside a timer without freezing the program? Here is a sample:

.if wParam == 1001
invoke SetTimer,hWin,1,NULL
.elseif uMsg == WM_TIMER
invoke MessageBox,hWin,addr ok,addr ok,MB_OK ;Just something to do in the timer
invoke Sleep, 100

When button 1001 is clicked, then the program freezes and no other buttons can be pushed.. any help is appreciated.

Posted on 2003-01-26 14:17:18 by resistance_is_futile
First question is, why would you need sleep there?

Your program hangs because when the timer message is sent, the window proc waits 100 msec (preventing normal messages from being processed), then when it returns a new timer message is received immediately.

.if wParam == 1001

.elseif uMsg == WM_TIMER

This can never be a valid message switch/case, the first if would catch *all* messages where wParam = 1001, while wParam has a different meaning for each message.

Posted on 2003-01-26 14:34:28 by Thomas
okay thanks for the explaination...
Posted on 2003-01-26 15:07:38 by resistance_is_futile
I don't use this high-level stuff. My DlgProcs start like this:

cmp uMsg, WM_COMMAND
je WMc
je WMi
cmp uMsg, WM_HOTKEY
je WMh
cmp uMsg, WM_CLOSE
je WMcl
xor eax, eax

And in WMc:

mov eax, wParam
cmp ax, IDCANCEL
je WMcExit
cmp ax, IDC_BUTTON1
je WMcBut1
cmp ax, IDC_BUTTON2
je WMcBut2
xor eax, eax

Posted on 2003-01-26 21:06:39 by aweX
the high level stuff keeps me in order. Without it I would be lost lol. I dunno. Low level is just too compilcated for me.
Posted on 2003-01-26 22:20:26 by resistance_is_futile