XP operating system detection (OpenInsight 32-bit Specific)
At 29 JAN 2004 05:53:45PM Barry Stevens wrote:
In OI how can I detect that the operating system on a PC is XP and theme is Windows XP, so I can adjust the form length to cater for the extra top bar depth.
Barry
At 29 JAN 2004 06:15PM The Sprezzatura Group wrote:
have you tried version=Get_Property("SYSTEM", "VERSION")
The Sprezzatura Group
World Leaders in all things RevSoft
At 29 JAN 2004 06:46PM Barry Stevens wrote:
Ooops…Thanks
At 29 JAN 2004 08:16PM Donald Bakke wrote:
Barry,
That won't really help you. While the default height of the title bar in XP is taller than Win2000 and earlier, it isn't an XP-specific problem. It's simply the way the theme is set up. Hence, XP themes can be adjusted to make the title bar shorter (which is what I do), and Win2000 machines can have their themes adjusted to make the title bar taller.
A better solution would be to get the metrics of the OS so you can adjust your forms on the fly under any situation. We have written our own utility for this that we have considered releasing. Feel free to contact us if you want more information.
dbakke@srpcs.com
At 30 JAN 2004 05:14AM Colin Rule wrote:
A simpler way is to let the user define the title bar depth in your application settings for the user, ie depth in pixels.
It means they have to set it manually, but quick and sweet to implement.
Colin
At 30 JAN 2004 08:11AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Barry
Take a look at the GetSystemMetrics Windows API call and see if it's got what you want - it's very simple to use and just relies on passing integers..
There's also an API called SystemParametersInfo that allows you to set Windows parameters as well as as get them but that's a bit more involved and relies more on playing with structures and pointers.
Themes in XP are handled by uxtheme.dll (so you could make a call to the isLib() function to see if it's on the system and if so you know you'll be on WinXP/Win 2003) - It exports functions like IsAppThemed, IsThemeActive etc which you can find more details on in the MSDN website if you really really want :)
World Leaders in all things RevSoft
At 30 JAN 2004 01:09PM Jim Vaughan wrote:
TITLE_BAR_HEIGHT=GETSYSTEMMETRICS(31)
At 30 JAN 2004 03:47PM Steve Smith wrote:
Barry, you can probably tighten this code up a little, but first prototype the function (in SYSPROCS table DLL_USER32 record) - preserving the case of the examples below:-
USER32 LONG STDCALL SystemParametersInfoA(INT,LPCHAR,LPCHAR,INT)
Then, use this function (you can check it returns the desk size by mousedowning over the task bar and resizing it.
EXPENDABLE FUNCTION GET_DESKTOP_SIZE DECLARE FUNCTION SystemParametersInfoA APIRECT=STR(CHAR(0),16) SPI_GETWORKAREA=48 DUMMY=SystemParametersInfoA(SPI_GETWORKAREA,"",APIRECT,0) right =SEQ(APIRECT12,1) *256 right =right + SEQ(APIRECT11,1) right =right * 256 right =right + SEQ(APIRECT10,1) right =right * 256 right =right + SEQ(APIRECT9,1) bottom=SEQ(APIRECT16,1)*256 bottom=bottom + SEQ(APIRECT15,1) bottom=bottom * 256 bottom=bottom + SEQ(APIRECT14,1) bottom=bottom * 256 bottom=bottom + SEQ(APIRECT13,1) DesktopHeight=bottom DesktopWidth=right RETURN DesktopWidth:@FM:DesktopHeight
Hope this helps,
Steve
At 30 JAN 2004 04:15PM Steve Smith wrote:
In fact, the taskbar can be on any edge of the screen (top, left, bottom (default), right) so use the following code to ascertain the desktop origin as well as the maximum x/y coords available, then you can resize or reposition accordingly.
EXPENDABLE FUNCTION GET_DESKTOP_SIZE DECLARE FUNCTION SystemParametersInfoA APIRECT=STR(CHAR(0),16) SPI_GETWORKAREA=48 DUMMY=SystemParametersInfoA(SPI_GETWORKAREA,"",APIRECT,0) * top :@Fm : left @fm : bottom :@fm : right left=SEQ(APIRECT4,1) *256 left=left + SEQ(APIRECT3,1) left=left * 256 left=left + SEQ(APIRECT2,1) left=left * 256 left=left + SEQ(APIRECT1,1) top=SEQ(APIRECT8,1) *256 top=top + SEQ(APIRECT7,1) top=top * 256 top=top + SEQ(APIRECT6,1) top=top * 256 top=top + SEQ(APIRECT5,1) right =SEQ(APIRECT16,1) *256 right =right + SEQ(APIRECT15,1) right =right * 256 right =right + SEQ(APIRECT14,1) right =right * 256 right =right + SEQ(APIRECT13,1) bottom=SEQ(APIRECT12,1) *256 bottom=bottom + SEQ(APIRECT11,1) bottom=bottom * 256 bottom=bottom + SEQ(APIRECT10,1) bottom=bottom * 256 bottom=bottom + SEQ(APIRECT9,1) RETURN TOP:@FM:LEFT:@FM:BOTTOM:@FM:RIGHT
At 02 FEB 2004 04:56PM Barry Stevens wrote:
Thanks guys…Cool stuff!