How do you get back to the players side of a game?

I process the regular button down, button up, move etc.
by the player. I then go to the computers turn and process.
When I try to get to the player logic again everything stops.
I have tried BeginPaint/EndPaint, branching to DefWindowProc.
Tried preserving iMsg. I'm sure the answer lies somewhere in
Petzolds book but Where.

Any ideas would be appreciated.
Posted on 2002-06-07 19:25:26 by shankle
I suspect it's a code logic problem. Probably there is something in your code that has some problems.

Assuming we handle the on the WM_KEYDOWN message. And again, assuming means, the player's end of turn.


...
cmp al, VK_RETURN
jne @@CALLDEFWINDOWPROC
[color=#3366FF];This part right here should be where the Computer AI starts
;to executes its move. Call functions...[/color]
jmp @@CALLDEFWINDOWPROC
...
@@CALLDEFWINDOWPROC:

invoke DefWindowProc....
Uhh! What do you mean by "everything stops" - does it hang, crashes, non-terminating loop, are you messing with the stack, parameters passed like wParam......???
Posted on 2002-06-07 19:47:57 by stryker
Thank you Stryker.
I'll try your suggestion before I bother anyone again.
I think it is the way I am handling the end of the player cycle.
Posted on 2002-06-07 20:00:45 by shankle
I have added code as suggested using VK_RETURN to start
the computer cycle. The computer cycle uses wParam/lParam
but does not modify it.

The program goes thru the Player cycle and then the Computer cycle and halts after DefWindowProc. The debugger gives an
error in some Windows code as follows: "Lock Dec ESI">

Here is my ending code:

GetOut:
invoke ReleaseDC, hWnd, hdc
.elsif iMsg==WM_Destroy
invoke CloseHandle, hFile
invoke PostQuitMessage, NULL
.endif
invoke DefWindowProc, hWnd, iMsg, wParam, lParam
RET
WndProc endp

If you need more explanation I will be happy to oblige.
Posted on 2002-06-09 17:57:03 by shankle
I think you should call ReleaseDC during the WM_DESTROY...Try this:


.ELSEIF (iMsg == WM_DESTROY)
invoke ReleaseDC, hWnd, hDC
invoke CloseHandle, hFile
invoke PostQuitMessage, NULL
.ELSE
invoke DefWindowProc, hWnd, iMsg, wParam, lParam
.ENDIF

xor eax, eax
ret
WndProc ENDP
BTW, VK_RETURN was just a suggestion. Sorry for my error code above - it shouldn't branch to DefWindowProc after you process the WM_KEYDOWN(VK_RETURN). :)
Posted on 2002-06-10 00:45:15 by stryker