#include "stdafx.h"
#include "Win32.h"
#include <stdio.h>
#include "Resource.h"
BOOL CALLBACK MainProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM IParam) // 消息回调函数/1.句柄(提示文字) 2.消息种类(点击按钮,输入文字..) 3.附加数据4.附加数据(xy)
{
char s[256];
sprintf(s,"uMsg=%d,wParam=%d,IParam=%d\n",uMsg,wParam,IParam);
OutputDebugString(s);
if(WM_COMMAND==uMsg) //判断点击按钮消息
{
if(LOWORD(wParam)==IDCANCEL)
{
EndDialog(hwndDlg,IDCANCEL);
}
if(LOWORD(wParam)==IDOK)
{
//MessageBox(hwndDlg,"点击ok","提示",0);
int nLeft=GetDlgItemInt(hwndDlg,IDC_LEFT,NULL,TRUE);
int nRight=GetDlgItemInt(hwndDlg,IDC_RIGHT,NULL,TRUE);
int nResult=nLeft+nRight;
SetDlgItemInt(hwndDlg,IDC_SUM,nResult,TRUE);
}
}
return false;
}
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR IpCndLine,int nCndShow)
{
/*int nRet=MessageBox(NULL,"重新开始","提示",MB_OKCANCEL);
if(nRet==IDOK)
{
MessageBox(NULL,"你点击OK按钮","返回值",0);
}
if(nRet==IDCANCEL)
{
MessageBox(NULL,"你点击了cance按钮","返回值",0);
}*/
DialogBox(hInstance,(LPCSTR)IDD_DIALOG1,NULL,MainProc);
return 0;
}
win32程序 day1
猜你喜欢
转载自blog.csdn.net/suntingsheng123/article/details/84347242
今日推荐
周排行