BOOL CALLBACK DialogProc( HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
BOOL CALLBACK DialogProc( HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
char szBuffer1[256];
char szBuffer2[256];
char szOutputBuf[256];
switch (uMsg)
{
case WM_INITDIALOG:
memset(szBuffer1,0,sizeof(szBuffer1));
memset(szBuffer2,0,sizeof(szBuffer2));
memset(szOutputBuf,0,sizeof(szOutputBuf));
break;
case WM_COMMAND:
if (wParam ==IDC_BTN_OUTPUT)
{
GetDlgItemText(hwndDlg,IDC_EDT_FIRST,szBuffer1,sizeof(szBuffer1));
GetDlgItemText(hwndDlg,IDC_EDT_SECOND,szBuffer2,sizeof(szBuffer2));
wsprintf(szOutputBuf,"%s%s",szBuffer1,szBuffer2);
SetDlgItemText(hwndDlg,IDC_EDT_OUTPUT,szOutputBuf);
}
if (wParam == IDC_BTN_EXITAPP)
SendMessage(hwndDlg,WM_CLOSE,0,0);
break;
case WM_CLOSE:
if (IDYES == MessageBox(NULL,"确定关闭?","",MB_YESNO))
EndDialog(hwndDlg,0);
break;
default:
break;
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DLG_MAIN),NULL,DialogProc,NULL);
return 0;
}
网友评论