Seite 1 von 1

Icon von Fenster entfernen (Windows only)

Verfasst: 18.04.2013 15:49
von Josh
Dialogfenster haben in Windows ja kein Icon vor dem Fenstertitel. Vielleicht war ich zu blöd zum suchen, auf jeden Fall habe ich im Forum keine wirklich funktionierende Lösung gefunden.

Diese Version funktioniert auch, wenn in den Compileroptionen ein Icon eingetragen ist.

Code: Alles auswählen

  EnableExplicit
  
  Define nWnd
  Define hWnd
  Define hMenu
  Define ExStyle

  nWnd = OpenWindow (#PB_Any, 0, 0, 300, 150, "Dialogfenster", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  hWnd = WindowID (nWnd)

 ;Icon aus Fenster entfernen
  SetClassLongPtr_(hWnd, #GCL_HICON, 0)
  HideWindow (nWnd, #True)
  ExStyle = GetWindowLongPtr_(hWnd, #GWL_EXSTYLE)
  SetWindowLongPtr_(hWnd, #GWL_EXSTYLE, ExStyle | #WS_EX_DLGMODALFRAME)
  HideWindow (nWnd, #False)

 ;Systemmenü schrumpfen (stolen by Fluid Byte)
  hMenu = GetSystemMenu_(hWnd,0)
  RemoveMenu_(hMenu,#SC_RESTORE,0)
  RemoveMenu_(hMenu,#SC_SIZE,0)
  RemoveMenu_(hMenu,#SC_MINIMIZE,0)
  RemoveMenu_(hMenu,#SC_MAXIMIZE,0)
  RemoveMenu_(hMenu,0,0)

  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
getestet:
Win7 x64
Pb 5.11 x64

Re: Icon von Fenster entfernen (Windows only)

Verfasst: 18.04.2013 16:06
von RSBasic

Re: Icon von Fenster entfernen (Windows only)

Verfasst: 18.04.2013 16:08
von Josh
Dein Code

Code: Alles auswählen

If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)
  SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_DLGMODALFRAME)
  HideWindow(0, 0)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
funktioniert aber nicht, wenn in den Compileroptionen ein Icon eingetragen ist.

Re: Icon von Fenster entfernen (Windows only)

Verfasst: 18.04.2013 16:26
von RSBasic
OKay, dann so:

Code: Alles auswählen

EnableExplicit

If OpenWindow(0, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)
  SetClassLongPtr_(WindowID(0), #GCL_HICON, 0)
  SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_DLGMODALFRAME)
  HideWindow(0, 0)
 
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
:mrgreen: