开发者

icon working as base weird icon appearing inside window

I just recently found out how to add an icon to a win32 project after I tried it out the base icon on my application worked fine but when I open the application the actual 16x16 icon 开发者_Python百科in the top left corner is a question mark in a bubble

the odd thing is when I accidently forgot to put -mwindows in my compile code the cmd window had the icon I intentenally wanted for my window

does this make sense

heres a bit of code

wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(THEICON));

and

wc.hIconSm = LoadIcon(NULL, MAKEINTRESOURCE(THEICON));

maybe a visual aid will help

icon working as base weird icon appearing inside window

P.S. If any one is felling generous I don't have the privilege to create new tags but can someone add 'icon'


Windows uses the "first" icon resource as application icon. This icon is displayed by Windows Explorer and e.g. a console window, but is not used automatically for windows that you create. Note: as I recall the definition of "first" has varied or was never well-defined in the first place, but typically icon with lowest id (check it out if that turns out to be wrong).

You provide very little code but it seems as if you're providing the correct icon to an API-level window class. However, using NULL as the module handle means load a system icon. Replace that NULL with GetModuleHandle( 0 ) (if I recall correctly, check).

Much more can't be said without seeing more complete code.

Cheers & hth.,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜