AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Fensterstile auslesen

Ein Thema von CalganX · begonnen am 5. Apr 2006
Antwort Antwort
CalganX

Registriert seit: 21. Jul 2002
Ort: Bonn
5.403 Beiträge
 
Turbo Delphi für Win32
 
#1

Fensterstile auslesen

  Alt 5. Apr 2006, 22:27
chaosben hat hier einen Source-Code gepostet, wie man die Fenster-Stile, die man mit GetWindowLong() auslesen kann, handlicher auslesen und verwenden kann:
Delphi-Quellcode:
type
  TWindowStyles = record
    WS_BORDER,
    WS_CAPTION,
    WS_CHILD,
    WS_CHILDWINDOW,
    WS_CLIPCHILDREN,
    WS_CLIPSIBLINGS,
    WS_DISABLED,
    WS_DLGFRAME,
    WS_GROUP,
    WS_HSCROLL,
    WS_ICONIC,
    WS_MAXIMIZE,
    WS_MAXIMIZEBOX,
    WS_MINIMIZE,
    WS_MINIMIZEBOX,
    WS_OVERLAPPED,
    WS_OVERLAPPEDWINDOW,
    WS_POPUP,
    WS_POPUPWINDOW,
    WS_SIZEBOX,
    WS_SYSMENU,
    WS_TABSTOP,
    WS_THICKFRAME,
    WS_TILED,
    WS_TILEDWINDOW,
    WS_VISIBLE,
    WS_VSCROLL : Boolean;
  end;

procedure GetWindowStyles(const AHandle : HWND; var AWindowStyle : TWindowStyles);
var
  WStyle : Integer;
begin
  WStyle := GetWindowLong(AHandle,GWL_STYLE);
  AWindowStyle.WS_BORDER:= (WStyle and WS_BORDER) = WS_BORDER;
  AWindowStyle.WS_CAPTION:=(WStyle and WS_CAPTION) = WS_CAPTION;
  AWindowStyle.WS_CHILD := (WStyle and WS_CHILD) = WS_CHILD;
  AWindowStyle.WS_CHILDWINDOW := (WStyle and WS_CHILDWINDOW) = WS_CHILDWINDOW;
  AWindowStyle.WS_CLIPCHILDREN := (WStyle and WS_CLIPCHILDREN) = WS_CLIPCHILDREN;
  AWindowStyle.WS_CLIPSIBLINGS := (WStyle and WS_CLIPSIBLINGS) = WS_CLIPSIBLINGS;
  AWindowStyle.WS_DISABLED := (WStyle and WS_DISABLED) = WS_DISABLED;
  AWindowStyle.WS_DLGFRAME := (WStyle and WS_DLGFRAME) = WS_DLGFRAME;
  AWindowStyle.WS_GROUP := (WStyle and WS_GROUP) = WS_GROUP;
  AWindowStyle.WS_HSCROLL := (WStyle and WS_HSCROLL) = WS_HSCROLL;
  AWindowStyle.WS_ICONIC := (WStyle and WS_ICONIC) = WS_ICONIC;
  AWindowStyle.WS_MAXIMIZE := (WStyle and WS_MAXIMIZE) = WS_MAXIMIZE;
  AWindowStyle.WS_MAXIMIZEBOX := (WStyle and WS_MAXIMIZEBOX) = WS_MAXIMIZEBOX;
  AWindowStyle.WS_MINIMIZE := (WStyle and WS_MINIMIZE) = WS_MINIMIZE;
  AWindowStyle.WS_MINIMIZEBOX := (WStyle and WS_MINIMIZEBOX) = WS_MINIMIZEBOX;
  AWindowStyle.WS_OVERLAPPED := (WStyle and WS_OVERLAPPED) = WS_OVERLAPPED;
  AWindowStyle.WS_OVERLAPPEDWINDOW := (WStyle and WS_OVERLAPPEDWINDOW) = WS_OVERLAPPEDWINDOW;
  AWindowStyle.WS_POPUP := (WStyle and WS_POPUP) = WS_POPUP;
  AWindowStyle.WS_POPUPWINDOW := (WStyle and WS_POPUPWINDOW) = WS_POPUPWINDOW;
  AWindowStyle.WS_SIZEBOX := (WStyle and WS_SIZEBOX) = WS_SIZEBOX;
  AWindowStyle.WS_SYSMENU := (WStyle and WS_SYSMENU) = WS_SYSMENU;
  AWindowStyle.WS_TABSTOP := (WStyle and WS_TABSTOP) = WS_TABSTOP;
  AWindowStyle.WS_THICKFRAME := (WStyle and WS_THICKFRAME) = WS_THICKFRAME;
  AWindowStyle.WS_TILED := (WStyle and WS_TILED) = WS_TILED;
  AWindowStyle.WS_TILEDWINDOW := (WStyle and WS_TILEDWINDOW) = WS_TILEDWINDOW;
  AWindowStyle.WS_VISIBLE := (WStyle and WS_VISIBLE) = WS_VISIBLE;
  AWindowStyle.WS_VSCROLL := (WStyle and WS_VSCROLL) = WS_VSCROLL;
end;

procedure TForm2.btn_Button1Click(Sender: TObject);
var
  WS : TWindowStyles;
begin
  GetWindowStyles(Handle,WS);
  if (Ws.WS_MAXIMIZE) then // hier noch einiges anderes testen
    Caption := 'Maximiert';
end;
  Mit Zitat antworten Zitat
Antwort Antwort

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:30 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz