October 26, 2021, 15:57:23

Author Topic: Remove icon from window titlebar?  (Read 814 times)

Offline chalky

  • Jr. Member
  • **
  • Posts: 88
Remove icon from window titlebar?
« on: June 14, 2021, 23:31:57 »
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: [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 WM_SETICON:Int=$80


Function ccDelIcon(wHandle:Int)
Local exStyle:Int

' remove icons
' Update the window's non-client area to reflect the changes

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?


SimplePortal 2.3.6 © 2008-2014, SimplePortal