有一段程序,我编译了好多此,每次都弹出很多次消息框
我是想获取文本框的内容,用消息框显示出来
我初学C++的SDK编程,这个问题都问了n个人了,没人肯解,请各位前辈多多帮忙啊!在这谢谢了!用Radasm编译
#include <windows.h>
#define IDC_EDT1 1002
BOOL DlgProc(HWND, UINT, WPARAM, LPARAM) ;
HINSTANCE hInst;
char Buff[80];
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow)
{
//添加处理代码;
hInst=hInstance;
DialogBoxParam(hInstance,MAKEINTRESOURCE(1000),0,(DLGPROC)DlgProc,(1000));
return TRUE;
}
BOOL DlgProc (HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
int lowID;
switch (uMsg){
case WM_INITDIALOG:
LoadIcon( hInst , MAKEINTRESOURCE(10));
break;
case WM_COMMAND:
lowID=LOWORD(wParam);
if (lowID==IDOK) //<---就是这儿
GetDlgItemText(hWnd,IDC_EDT1,Buff,sizeof(Buff));
MessageBox(NULL,Buff,"Test",MB_OK);
break;
case WM_CLOSE:
EndDialog(hWnd,FALSE);
break;
default:
return FALSE;
}
return TRUE;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!