Remove icon from window titlebar?

Started by chalky, June 14, 2021, 23:31:57

Previous topic - Next topic

chalky

I am trying to remove an icon from a MaxGUI window during runtime. The reason for this is that I need to emulate the Notify/Proceed/Confirm requestors as they must be displayed while a clock is being continually updated in my main loop (since this is no longer executed while the requestors are displayed, the clock freezes). I know I could create the dialog window using the WINDOW_TOOL flag, but would prefer not to if possible. I have come up with the following code after searching the net for C++ examples:

Code (Basic) Select
Extern "win32"
Function GetWindowLong:Int(hWnd:Int,nIndex:Int)="GetWindowLongA@8"
Function SendMessageW:Int(hWnd:Int,MSG:Int,wParam:Int,lParam:Int)
Function SetWindowLong:Int(hWnd:Int,nIndex:Int,dwNewLong:Int)="SetWindowLongA@12"
Function SetWindowPos:Int(hWnd:Int,hAfter:Int,x:Int,y:Int,w:Int,h:Int,flags:Int)
End Extern

Const ICON_SMALL:Int=0
Const ICON_BIG:Int=1

Const GWL_EXSTYLE:Int=-20

Const SWP_NOSIZE:Int=1
Const SWP_NOMOVE:Int=2
Const SWP_NOZORDER:Int=4
Const SWP_FRAMECHANGED:Int=$20

Const WM_SETICON:Int=$80

Const WS_EX_DLGMODALFRAME:Int=$1

Function ccDelIcon(wHandle:Int)
Local exStyle:Int

exStyle=GetWindowLong(wHandle,GWL_EXSTYLE)
SetWindowLong(wHandle,GWL_EXSTYLE,exStyle|WS_EX_DLGMODALFRAME)
' remove icons
SendMessageW(wHandle,WM_SETICON,ICON_SMALL,Null)
SendMessageW(wHandle,WM_SETICON,ICON_BIG,Null)
' Update the window's non-client area to reflect the changes
SetWindowPos(wHandle,Null,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED)
EndFunction

This works perfectly if I compile and run it from within BLide (the dialog is displayed without an icon in the top left corner). However, as soon as I compile an external executable and run it, the dialog window 'inherits' the main window's icon (even if I specify group=Null in CreateWindow) - and the icon is no longer removed.

What am I missing in my code - or is what I'm trying to do not possible?

Sinjin

Get the example from REDRAWGADGET, with that your application runs even if you open a menu/notification or fileselectbox.

GW

Try creating an icon that is all transparent and use that.

chalky

Thanks - this is a 2+ year old thread (I found a solution in 2021 - can't remember now what I did)...