vc sdk编程 如何使用对话框资源创建主窗口
RT,要可以正常响应syscommand消息的代码和处理messagebox之类的函数的代码..这里不要mfc的.....
RT,要可以正常响应syscommand消息的代码和处理messagebox之类的函数的代码..
这里不要mfc的.. 展开
这里不要mfc的.. 展开
2个回答
展开全部
#include <Windows.h>
#include <tchar.h>
#include "resource.h"
HWND dhwnd;
BOOL CALLBACK dlgp(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
int WINAPI _tWinMain(HINSTANCE hinstance,HINSTANCE,LPTSTR lp,int cmd)
{
dhwnd=CreateDialog(0,LPTSTR(IDD_DIALOG1),0,dlgp);
ShowWindow(dhwnd,1);
MSG msg;
ZeroMemory(&msg,sizeof(MSG));
while(msg.message!=WM_QUIT)
{ Sleep(2);
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
}
}
return 0;
}
BOOL CALLBACK dlgp(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
break;
case WM_CLOSE:
exit(0);
break;
/*case WM_COMMAND:
switch(LOWORD(wparam))
{case IDC_BUTTON1:
EndDialog(hwnd,0);
break;
}
break;*/
}
return FALSE;
}
//WinSDK的 IDD_DIALOG1 是你的对话框ID
#include <tchar.h>
#include "resource.h"
HWND dhwnd;
BOOL CALLBACK dlgp(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
int WINAPI _tWinMain(HINSTANCE hinstance,HINSTANCE,LPTSTR lp,int cmd)
{
dhwnd=CreateDialog(0,LPTSTR(IDD_DIALOG1),0,dlgp);
ShowWindow(dhwnd,1);
MSG msg;
ZeroMemory(&msg,sizeof(MSG));
while(msg.message!=WM_QUIT)
{ Sleep(2);
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
}
}
return 0;
}
BOOL CALLBACK dlgp(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
break;
case WM_CLOSE:
exit(0);
break;
/*case WM_COMMAND:
switch(LOWORD(wparam))
{case IDC_BUTTON1:
EndDialog(hwnd,0);
break;
}
break;*/
}
return FALSE;
}
//WinSDK的 IDD_DIALOG1 是你的对话框ID
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询