Order of the Butterfly
Posts: 421 from 2003/2/24
From: Berlin
Here is an old AmigaOberon source of mine, which lists all screens and windows, and also show the Hz value of a screen:
Code:
MODULE Wins;
(* $StackChk- $RangeChk- $CaseChk- $OvflChk- $ReturnChk- $TypeChk- $NilChk- *)
IMPORT
(* NoGuru, *)
y := SYSTEM,
d := Dos, e := Exec, I := Intuition, G := Graphics, u := Utility,
tb:= ToolBox;
TYPE
LS = LONGSET;
VAR
scr: I.ScreenPtr;
win: I.WindowPtr;
monInfo : G.MonitorInfo;
nameInfo: G.NameInfo;
idStr : ARRAY G.displayNameLen OF CHAR;
ID,
scan, fps,
l : LONGINT;
BEGIN
(* (* $IFNOT Debug *) l := I.LockIBase(0); (* $END *) *)
scr := I.base.firstScreen;
REPEAT
ID := G.GetVPModeID(y.ADR(scr.viewPort));
IF G.GetDisplayInfoData (NIL, monInfo, SIZE(G.MonitorInfo), G.dtagMntr,ID) > 0 THEN
(* $RangeChk- *)
fps := ABS(1000000000 DIV (I.UIntToLong(monInfo.mspc.totalRows)*I.UIntToLong(monInfo.mspc.totalColorclocks)*280));
(* $RangeChk= *)
scan := fps * monInfo.mspc.totalRows;
(* d.PrintF ("scan = %ld, fps = %ldn",scan,fps); *)
ELSE
scan := 0; fps := 0
END;
IF G.GetDisplayInfoData (NIL, nameInfo, SIZE(G.NameInfo), G.dtagName, ID) > 0 THEN
COPY(nameInfo.name,idStr)
ELSE
tb.Format (idStr,'Mode not found (%ld)!',ID);
END;
d.PrintF ('nSCREEN [1m"%s"[m %s [%lDkHz/%02ldHz] (%1ld,%1ld,%1ldx%1ldx%1ld):n',
(* scr.defaultTitle, y.ADR(idStr), scan(* DIV 1000, (scan MOD 1000)*10*), fps, *)
scr.defaultTitle, y.ADR(idStr), scan DIV 1000, fps,
scr.leftEdge,scr.topEdge, scr.width,scr.height,scr.bitMap.depth);
win := scr.firstWindow;
WHILE win # NIL DO
d.PrintF ('tWINDOW [1m"%s"[m (%1ld,%1ld,%1ldx%1ld)n',
win.title, win.leftEdge,win.topEdge, win.width,win.height);
win := win.nextWindow
END;
scr := scr.nextScreen
UNTIL scr = NIL;
CLOSE
(* (* $IFNOT Debug *) I.UnlockIBase (l); (* $END *) *)
END Wins.