16,551
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
#include "resource.h"
LRESULT CALLBACK DiagFunc(HWND,UINT,WPARAM,LPARAM);
int __stdcall WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nShowCmd)
{
HWND hwnd,hb;
MSG msg;
hwnd=CreateDialog(hInst,(LPCTSTR)IDD_DIALOG,NULL,(DLGPROC)DiagFunc);
hb=CreateWindowEx(
NULL,
"Button",
"Button",
WS_CHILD|WS_VISIBLE,
10,10,65,22,
hwnd,
(HMENU)1001,
hInst,
NULL);
ShowWindow(hwnd,SW_NORMAL);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK DiagFunc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message){
case WM_CREATE:
MessageBox(hwnd,"Hello","Hello",MB_OK);
break;
case WM_INITDIALOG:
//SetWindowPos(hwnd,HWND_TOP,100,100,500,600,SWP_SHOWWINDOW);
break;
case WM_DESTROY:
MessageBox(hwnd,"Hello","Hello",MB_OK);
PostQuitMessage(0);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
return TRUE;
}
return FALSE;
}
#include <windows.h>
#include "resource.h"
LRESULT CALLBACK DiagFunc(HWND,UINT,WPARAM,LPARAM);
int __stdcall WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nShowCmd)
{
HWND hwnd;
MSG msg;
hwnd=CreateDialog(hInst,(LPCTSTR)IDD_DIALOG,NULL,(DLGPROC)DiagFunc);
ShowWindow(hwnd,SW_NORMAL);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK DiagFunc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message){
case WM_CREATE:
MessageBox(hwnd,"Hello","Hello",MB_OK);
CreateWindowEx(
NULL,
"Button",
"Button",
WS_CHILD|WS_VISIBLE,
10,10,65,22,
hwnd,
(HMENU)1001,
((LPCREATESTRUCT)lParam)->hInstance,
NULL);
break;
case WM_INITDIALOG:
//SetWindowPos(hwnd,HWND_TOP,100,100,500,600,SWP_SHOWWINDOW);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
return TRUE;
}
return FALSE;
}