Error message (.png attachments don't seem to be working):
Code: Select all
EitherMouse.exe
---------------------------
Error: Can't load icon.
Specifically: HICON:*603392579
Line#
---> 1203: Menu,Tray,Icon,HICON:*%hIcon%
The current thread will exit.
---------------------------
OK
Code: Select all
pBitmap := Gdip_CreateBitmapFromFile(A_ScriptFullPath,27,16)
G := Gdip_GraphicsFromImage(pBitmap)
pBrush := Gdip_BrushCreateSolid(TextColor)
Gdip_TextToGraphics(G, Number, "x-1 y2 w20 h20 Center r4 s10 Bold c" pBrush, "Tahoma")
Gdip_DeleteBrush(pBrush)
hIcon := Gdip_CreateHICONFromBitmap(pBitmap)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Menu, Tray, Icon, HICON:*%hIcon%
DestroyIcon(hIcon)
Thanks
- Joel
PS: functionally what I'm doing here is taking an icon from resource, overlaying GDI+ text onto it and applying the icon to the tray (and gui controls) with HICON:*. I use the same technique in a little tray icon date tool and have never seen this error:
Code: Select all
SetTrayDate(TextColor=0xff222222)
{
pBitmap := Gdip_CreateBitmapFromFile(A_ScriptFullPath,1,16)
G := Gdip_GraphicsFromImage(pBitmap)
pBrush := Gdip_BrushCreateSolid(TextColor)
Gdip_TextToGraphics(G, A_MMM, "x-2 y-1 w20 h20 Center r4 s6 c" pBrush, "Tahoma")
Gdip_TextToGraphics(G, A_DD+0, "x-2 y3 w20 h20 Center r4 s10 Bold c" pBrush, "Tahoma")
Gdip_DeleteBrush(pBrush)
hIcon := Gdip_CreateHICONFromBitmap(pBitmap)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Menu, Tray, Icon, HICON:*%hIcon%
DestroyIcon(hIcon)
Return 0
}