Results 1 to 4 of 4

Thread: Loops in WM_COMMAND

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Unhappy Loops in WM_COMMAND

    Im making version 2 of my checkers (no parksie, not draughts, but checkers) game. I want to make the user able to click the pieces to move them (click once, and then another where to move it) So instead of putting my moving and jumping code in 64 times I decidied to put a nested loop in my WM_COMMAND statement to keep checking if 1 of the 64 square (statics) were cliicked. But I'm getting no reaction. Any Help?

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Just curious, but was it me who gave you that idea? Cause I know i said it would be better...

    Anyway, post the loop, it would help me to see where it goes wrong.
    Alcohol & calculus don't mix.
    Never drink & derive.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    WM_COMMAND message is sent to the window proc if you click a menu item, maybe you should check for WM_LBUTTONDOWN instead?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    WM_LBUTTONDOWN does work

    might have been you wynd

    Code:
    	case WM_LBUTTONDOWN:
    			for(i=1; i<=8; i++)  {
    				for(a=1; a<=8; a++)  {
    					if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == Board[a][i]) {
    							int x;
    							int y;
    							int Finalx;
    							int Finaly;
    							char buff[5];
    							char buff2[5];
    							//this section gets the x and y values
    							sprintf(buff, itoa(a,buff2,10));
    							sprintf(buff, " , ");
    							sprintf(buff, itoa(i, buff2,10));
    							MessageBox(hWnd, buff, "X , Y", MB_OK);
    
    							
    				}
    			}
    			}
    all it does is have a messagebox say the a and i values.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width