Set Icon on Window (Correctly Sized)
Posted: Sun Jul 15, 2007 3:42 pm
I spend about an hour on this. Not just to set the icon on the window but stuffing around with the built in loadImage() and SendMessage_() only to find that the 32x32 icon resized badly and looked awful. After hunting around on the forums reading about people resaving their icons so the 32x32 layer is taken out and PB reads the 16x16, and other people who tried resizeimage only to be dissapointed (with a known -to some- bug) I found some bits that eventually worked so I thought I'd put them all together here in a couple of lines.
I'm sure 99.99% of PBer's know this already but the new comers will lose a little hair getting here.
If you set this to 32, 32 you'll get what I had for the inbuilt loadimage method... yuk 
I'm sure 99.99% of PBer's know this already but the new comers will lose a little hair getting here.
Code: Select all
Window_Icon.l=LoadImage_(GetModuleHandle_(0),"D:\icons\MyIcon.ico",#IMAGE_ICON,16,16,#LR_LOADFROMFILE)
SendMessage_(WindowID(#Window_0), #WM_SETICON, 0, Window_Icon)
