Home > Software engineering >  Response wm_command program
Response wm_command program

Time:10-27

In wm_command response button, the program will die card, can press the button a pop-up message box, but after that it didn't reflect, the code is as follows:

 BOOL CALLBACK DlgMain (HWND hwndDlg, UINT uMsg, WPARAM WPARAM, LPARAM LPARAM) 
{
The switch (uMsg)
{
Case WM_INITDIALOG:
{
CreateWindowEx (NULL, __TEXT (" BUTTON "), __TEXT (" Update "), the WS_VISIBLE | WS_CHILD, rcDlg. Right - 100, 0, 50, 20, hwndDlg, NULL, hInst, NULL);
}
return TRUE;
break;

Case WM_CLOSE:
{
EndDialog (hwndDlg, 0);
}
return TRUE;
break;
Case WM_COMMAND:
{
The switch (LOWORD (wParam))
{
Case IDGO1:
MessageBox (hwndDlg, __TEXT (" xx "), __TEXT (" yy "), MB_OK);
break;
}
}
return TRUE;
break;
}
Return FALSE;
}


Int APIENTRY WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HInst=hInstance;
The InitCommonControls ();
Return DialogBox (hInst, MAKEINTRESOURCE (DLG_MAIN), NULL, DLGPROC DlgMain);
}

CodePudding user response:

CreateWindowEx (NULL, __TEXT (" BUTTON "), __TEXT (" Update "), the WS_VISIBLE | WS_CHILD, 100, 0, 50, 20, hwndDlg, (HMENU) IDGO1 , hInst, NULL);

CodePudding user response:

Is not this ID problem, click on the button after messagebox can play out, but it didn't take long interface card dead, on windbg see stack after additional information, found that:
0:00 0 & gt; K
The Child - SP RetAddr Call Site
00000000 ` 0028 fd14 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fd34 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fd54 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fd74 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fd94 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fdb4 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fdd4 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fdf4 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fe14 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fe34 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fe54 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fe74 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fe94 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 feb4 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
00000000 ` 0028 fed4 00000000 ` 765261 a0 USER32! ValidateHwnd + 0 x19
Has been around in USER32, seemingly message loop was stuck dead:
0:00 0 & gt; K
The Child - SP RetAddr Call Site
00000000 0028 fc40 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fc60 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fc80 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fca0 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fcc0 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fce0 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fd00 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fd20 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fd40 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fd60 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fd80 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fda0 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
00000000 0028 fdc0 ` 00000000 ` 765262 b7 USER32! MapKernelClientFnToClientFn + 0 x5c
  • Related