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 ?
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 ?