帮帮我,为什么程序运行了之后没有对话框,只有对话框上的控件。
这是源代码
// dialogwork.cpp : Defines the entry point for the application.
//#include "stdafx.h"
#include "resource.h"
#include "dialogwork.h"
#include "commctrl.h"
//BOOL CALLBACK Scopee (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
MSG msg;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
DialogBox (hInstance, MAKEINTRESOURCE (IDD_DIALOG1) , NULL, DLGPROC (Scopee));
return 0;
}BOOL CALLBACK Scopee (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
{
{
ShowWindow(hwnd,SW_SHOW); UpdateWindow(hwnd); return TRUE;
break;
}
while(TRUE)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
/*
if(msg.message==WM_CHAR)
{
tchar = (TCHAR)msg.wParam;
if(tchar == 0x1b)
escKey=1; }
*/
if(msg.message==WM_QUIT)// killing while looking for a message
{
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} case WM_PAINT:
{
return TRUE;
}
break;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDC_BUTTON1:
{
//SendMessage (hwnd, WM_COMMAND, MAKEWPARAM (IDC_STOP, 0), 0);
//DeleteObject (SelectObject (HdblDC, HdblOldBitmap));
//DeleteDC (HdblDC);
//HdblDC = NULL;
//HdblOldBitmap = NULL;
{
EndDialog (hwnd, FALSE);
break;
}
return TRUE;
}
}
}
return TRUE;
}
我也重绘了窗口了给个解释,或者给点别的帮助
这是源代码
// dialogwork.cpp : Defines the entry point for the application.
//#include "stdafx.h"
#include "resource.h"
#include "dialogwork.h"
#include "commctrl.h"
//BOOL CALLBACK Scopee (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
MSG msg;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
DialogBox (hInstance, MAKEINTRESOURCE (IDD_DIALOG1) , NULL, DLGPROC (Scopee));
return 0;
}BOOL CALLBACK Scopee (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
{
{
ShowWindow(hwnd,SW_SHOW); UpdateWindow(hwnd); return TRUE;
break;
}
while(TRUE)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
/*
if(msg.message==WM_CHAR)
{
tchar = (TCHAR)msg.wParam;
if(tchar == 0x1b)
escKey=1; }
*/
if(msg.message==WM_QUIT)// killing while looking for a message
{
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} case WM_PAINT:
{
return TRUE;
}
break;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDC_BUTTON1:
{
//SendMessage (hwnd, WM_COMMAND, MAKEWPARAM (IDC_STOP, 0), 0);
//DeleteObject (SelectObject (HdblDC, HdblOldBitmap));
//DeleteDC (HdblDC);
//HdblDC = NULL;
//HdblOldBitmap = NULL;
{
EndDialog (hwnd, FALSE);
break;
}
return TRUE;
}
}
}
return TRUE;
}
我也重绘了窗口了给个解释,或者给点别的帮助
WM_ERASEBKGND 可以直接返回 false