|
20鱼币
本帖最后由 风之残月 于 2014-11-9 22:40 编辑
#include <Windows.h>
#include "resource.h"
HINSTANCE g_hInstance;
INT_PTR WINAPI DiaLogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
int msg = LOWORD(wParam);
switch(msg)
{
case WM_INITDIALOG:
{
LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
}
case SC_CLOSE:
{
EndDialog(hWnd,0);
return 0;
}
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
g_hInstance = hInstance;
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,DiaLogProc);
return 0;
}
|
最佳答案
查看完整内容
LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
这句改成:
HICON hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
SendMessage(hWnd, WM_SETICON, 1, (LPARAM)hicon);
还有就是WM_INITDIALOG是直接用uMsg传递的
|