[fpc-pascal]Draw scaled icon (was: Win32 and system tray)

Bernhard Steffen bernhard.steffen at gmx.net
Mon Nov 18 11:14:27 CET 2002


Hi Thomas,

Thomas Schatzl schrieb:
> In order to hide your application window from the taskbar and alt-tab
> dialog create your window with WS_EX_TOOLWINDOW in the dwExStyle
> param of CreateWindowEx() and don't specify WS_VISIBLE in the dwStyle
> param. It's exact description can be found on msdn.microsoft.com as
> well.

thanks for your help. I found the doc files you mentioned, and hiding my
program from taskbar works well.

I could't download the mentioned unit for ShellNotifyIcon ("unknown
server"), but finally decided I do need a program window, anyway ;-)
(although one in "toolwindow" style)


...which leads to my next question:

- I can extract a program's icon by using the ExtractIcon() function.
- I can paint this icon by using DrawIcon() function - but then it's
  drawn in the icon's original size (16x16 or 32x32).

How can I scale this icon and draw it in 8x8 pixels?

Currently I'm doing the following in the wm_paint section of function
WindowProc:
(ps is a paintstruct, r a rect)

	dc:=BeginPaint(hWindow, at ps);
	GetClientRect(hWindow, at r);
	DrawIcon(dc,0,0,hIcon);
	EndPaint(hWindow,ps);
	Exit;

Sorry, I'm a complete newbie to Win32 gui programming...


Thanks for your help!

Bernhard

-- 
http://www.bernhard-steffen.de/
bernhard.steffen at gmx.net




More information about the fpc-pascal mailing list