Titlebar Icon

BlitzPlus Forums/BlitzPlus Programming/Titlebar Icon

Andres(Posted 2006) [#1]
I created a function to add icon to my window's titlebar:
Function AppIcon(gadget%, iconfile$)
	Local hwnd% = QueryObject(gadget%, 1)
	Local icon% = api_LoadIcon(hwnd%, iconfile$)
	api_SetClassLong hwnd, -14, icon
End Function


It used to work, but now I can't get icon loaded. Can anyone tell me what could be wrong with it?


Pineapple(Posted 2006) [#2]
Function SetWindowIcon(hWnd,ICOfile$)
icon=ExtractIconA(hWnd,ICOfile$,0)
SetClassLongA(hWnd,-14,icon)
End Function


Thats mine from here:-

http://www.blitzbasic.com/codearcs/codearcs.php?code=1589

Only difference between to the two is you use the LoadIcon command, whereas I use the ExtractIcon. Try mine, it does work (just tested it)

Dabz


Andres(Posted 2007) [#3]
Does it extract icon from an executable too?