I am currently working on adding Inifile support to my application to keep track of window sizes and position. I asked on StackOverflow if FireMonkey has anything similar to GetSystemMetrics. Whiler posted a snice snippet of code that uses FX.Platform. (Merci Beaucoup Whiler)
My first thought was it's too bad I can't use this piece of code today. Then I had one of those aha moments. I thought to myself,
"Why not add this as a comment in your Delphi code."So that's what I did.
Begin Code Snippet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | { ---------------------------------------------------------------- FireMonkey Consideration: ---------------------------------------------------------------- Question asked on stackoverflow: I'm rewriting an old application using Delphi 2010 and I'd like to put placeholders in my code for when I port it over to XE2. Just curious if FireMonkey has an equivilent to GetSystemMetrics. I'm specifically interested in: GetSystemMetrics(SM_CXSCREEN) GetSystemMetrics(SM_CYSCREEN) ---------------------------------------------------------------- If you just need the main monitor size, and not the desktop size (n monitors sum), you can use this: uses ..., FMX.Platform; var p: TPointF; begin p := Platform.GetScreenSize; ShowMessage(Format('X: %f' + LineFeed + 'Y: %f', [p.X, p.Y])); From: Whiler ---------------------------------------------------------------- } unit IniFileStuff; interface uses Windows, SysUtils, Forms, IniFiles; type TScreenType = (MainScreen, PreviewScreen); Procedure InitializeIniFile(); Procedure ResetScreenSection(ScreenType:TScreenType); Function WindowStateToInt(WSType:TWindowState): integer ; Function IntToWindowState(WSInt: integer ):TWindowState; ... |
So, even though I'm not using FireMonkey today, I've documented my code so when I do go to use FireMonkey I'll have a decent head start.
Don't keep it - Pass it on.
Semper Fi - Gunny Mike