这个模态对话框是用SDK做的,用的是DialogBox函数.我用函数加了一个图标,在任务栏能够显示(即最小化的窗口能够显示),但在窗口的图标显示处是空白.不知道是怎么回事.谁能该解答一下.
代码如下:
HICON hicon;
BOOL CALLBACK DlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,DlgProc);
hicon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1));
return 0;
}
BOOL CALLBACK DlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
SetClassLong(hWnd,GCL_HICON,(LONG)hicon);
return true;
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
EndDialog(hWnd,0);
return true;
}
break;
}
}
return false;
}