对话框怎么加载图标?
本帖最后由 风之残月 于 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;
}
本帖最后由 漩涡鸣人 于 2014-8-31 17:30 编辑
LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
这句改成:
HICON hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
SendMessage(hWnd, WM_SETICON, 1, (LPARAM)hicon);
还有就是WM_INITDIALOG是直接用uMsg传递的
强烈支持楼主ing…… 来看看了
页:
[1]