|
-
Jan 21st, 2003, 06:36 PM
#1
Thread Starter
Frenzied Member
why won't it pick up my click
Code:
case WM_LBUTTONDOWN:
//MEMORY
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == board[x2][y2])
i also tried
if ((HWND)lParam == board[x2][y2])
but niether works when I click on board[x2][y2] (its a static control)
the wm_lbuttondown is working, i checked with a messagebox, but a messagebox won't go inside my if....this should be easy, but im stumped sorry about the stupid question
-
Jan 21st, 2003, 09:22 PM
#2
PowerPoster
try this
Code:
case WM_LBUTTONDOWN:
if(MK_LBUTTON == wParam) && (hWnd == board[x2][y2])
as wparam is holding this value.
wParam
MK_CONTROL The CTRL key is down.
MK_LBUTTON The left mouse button is down.
MK_MBUTTON The middle mouse button is down.
MK_RBUTTON The right mouse button is down.
MK_SHIFT The SHIFT key is down.
MK_XBUTTON1 Windows 2000/XP: The first X button is down.
MK_XBUTTON2 Windows 2000/XP: The second X button is down.
and lParam is holding the current mouse position.
-
Jan 21st, 2003, 09:27 PM
#3
Thread Starter
Frenzied Member
thank you so much for the reply...im sorry about just asking you like that...but nothing happens still when i click the static controls
Code:
case WM_LBUTTONDOWN:
//MEMORY
for(int y2=0; y2<2; y2++)
{
for(int x2=0; x2<5; x2++)
{
if((MK_LBUTTON == wParam) && (hWnd == board[x2][y2]))
{
MessageBox(ghWnd_Main, "TEST", "Warning!", MB_OK);
clicknum++;
if(bmatrix[x2][y2]=="Green" || bmatrix[x2][y2]=="Red" || bmatrix[x2][y2]=="Blue" || bmatrix[x2][y2]=="Yellow" || bmatrix[x2][y2]=="Cyan")
SetWindowText(board[x2][y2], bmatrix[x2][y2].c_str());
if(bmatrix[x2][y2]=="green" || bmatrix[x2][y2]=="red" || bmatrix[x2][y2]=="blue" || bmatrix[x2][y2]=="yellow" || bmatrix[x2][y2]=="cyan")
{
SetFont(board[x2][y2], 50, "Terminal");
//SetWindowText(board[x2][y2], "Û");
}
if(clicknum==1)
{
one = bmatrix[x2][y2];
xold = x2;
yold = y2;
}
else if(clicknum==2)
{
if(x2==xold && y2==yold)
{
MessageBox(ghWnd_Main, "Please Chose A Valid Square", "Warning!", MB_OK);
clicknum--;
}
else
{
two = bmatrix[x2][y2];
Sleep(500); //wait for half a second
MemoryCheck(one, two, x2, y2, xold, yold);
clicknum=0;
SetWindowText(board[xold][yold], " ");
SetWindowText(board[x2][y2], " ");
}
}
}
}
}
return 0;
-
Jan 21st, 2003, 09:38 PM
#4
PowerPoster
or you can capture the event via WM_COMMAND message as below:
PHP Code:
case WM_COMMAND:
if ((HWND)lParam == board[x2][y2])
if (HIWORD(wParam) == BN_CLICKED)
MessageBox(hWnd, "Bingo!", "", MB_OK);
break;
Also, ensure the static control have the style of SS_NOTIFY flag set.
-
Jan 22nd, 2003, 05:43 AM
#5
WM_LBUTTONDOWN is sent to you when the user clicks your window, not when he clicks a child window.
And your decoding of wParam and lParam only applies to WM_COMMAND messages.
Chris' second post should work.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|