// JP opened flex table

Click to See Complete Forum and Search --> : one question-sorry for ma english


abab
April 21st, 2007, 03:36 AM
I have also 1 question about my game-saper:
I have 36 buttons and when somebody click RIGHT (not left but right) key of mouse on some button then he will see "X" on this button, and I want display how many "X" must he mark - it will update eerytime when somebody mark "X" or hide some button when he click left key of mouse on this - it is this code:


bomb=6;
for(int idi=201; idi<237; idi++)
{
GetWindowText(GetDlgItem(MainWindow, idi), buff, 2 );


if ((strcmp(buff, "X") ==0) && (IsWindowVisible(GetDlgItem(MainWindow, idi))!=0) )
{
miny--;
SetDlgItemInt(MainWindow ,253,bomb,true);
}
}



Can I place this code in WinMain in GetMessage:

while (GetMessage (&message, NULL, 0, 0))
{
TranslateMessage(&message);
DispatchMessage(&message);

/*
bomb=6;
for(int idi=201; idi<237; idi++)
{
GetWindowText(GetDlgItem(MainWindow, idi), buff, 2 );


if ((strcmp(buff, "X") ==0) && (IsWindowVisible(GetDlgItem(MainWindow, idi))!=0) )
{
miny--;
SetDlgItemInt(MainWindow ,253,bomb,true);
}
}
*/

}


Because in WM_COMMAND I can't place this code because number of mines will be update only when somebody click LEFT key of mouse on some button (and I must update number of mines when somebody click left or RIGHT key of mouse) - so is it a good place ?

ovidiucucu
April 21st, 2007, 08:26 AM
- so is it a good place ?
No.

abab
April 21st, 2007, 12:37 PM
so where it should be ?

Notsosuperhero
April 21st, 2007, 01:02 PM
Check out WM_LBUTTONDOWN (http://msdn2.microsoft.com/en-us/library/ms645607.aspx)
and WM_RBUTTONDOWN (http://msdn2.microsoft.com/en-us/library/ms646242.aspx) to handle the mouse stuff.

You could use a timer (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers.asp) and run your check. Although you don't want the timer updating at a very quick rate since that for loop will suck away the CPU.

abab
April 21st, 2007, 01:45 PM
ooooo timer - I think it will be ok :D Thanks.
Mayby 300 milliseconds for check and update will be ok.

//JP added flex table