Thema: Delphi auf Vollbild testen

Einzelnen Beitrag anzeigen

Benutzerbild von chaosben
chaosben

Registriert seit: 27. Apr 2005
Ort: Görlitz
1.358 Beiträge
 
Delphi XE2 Professional
 
#3

Re: auf Vollbild testen

  Alt 5. Apr 2006, 06:52
Du könntest auch den WindowStyle des Fensters untersuchen, um das es geht. Imho hat ein Vollbild-Fenster der meisten Spiele keine Borders und ist maximiert. Das könntest du mit GetWindowLong(Handle,GWL_STYLE) herausfinden.
Oder du machst es dir einfacher und nutzt diesen Code:
Delphi-Quellcode:
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:='FullScreen';
end;
Benjamin Schwarze
If I have seen further it is by standing on the shoulders of Giants. (Isaac Newton)
  Mit Zitat antworten Zitat