美文网首页
C++完成昨天的对话框程序

C++完成昨天的对话框程序

作者: le0nard | 来源:发表于2017-09-15 11:50 被阅读0次
// 20170915_testdlg.cpp : Defines the entry point for the application.//#include "stdafx.h"#include#include "resource.h"

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;

}

相关文章

网友评论

      本文标题:C++完成昨天的对话框程序

      本文链接:https://www.haomeiwen.com/subject/yqessxtx.html