Sign in to follow this  
Followers 0
Tenaya

GUICreate - different form size on different PCs

7 posts in this topic

I'm using GUICreate to create a from with a certain size. With the code below, the real size on the form differs from PC to PC. Maybe the difference is related to different Windows versions and screen resolutions - on one machine the form is bigger on another PC it's smaller. How can I specify the real size of a form which will work the same on different PCs and Windows versions?

$Form_Main = GUICreate($TitleMain, 115, 26, $SIP_XPos, $SIP_YPos, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))

Share this post


Link to post
Share on other sites



I'm using GUICreate to create a from with a certain size. With the code below, the real size on the form differs from PC to PC. Maybe the difference is related to different Windows versions and screen resolutions - on one machine the form is bigger on another PC it's smaller. How can I specify the real size of a form which will work the same on different PCs and Windows versions?

$Form_Main = GUICreate($TitleMain, 115, 26, $SIP_XPos, $SIP_YPos, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
The size of the form should be 115 pixels wide x 26 pixels high on any PC. If one PC has a screen resolution of 1600 x 1200 pixels the form will take up a very much smaller part of the screen than one which has a resolution of 800 x 600.

The screen resolution width is obtainable from the sytem info macros @DesktopWidth and @DesktopHeight.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

It's not that simple. I've made two screen-shots:

- Form1 post-5013-1159290549_thumb.gif

- From2 post-5013-1159290574_thumb.gif

Both screen-shots show the same form created with the same code and exe. Form1 is from my desktop PC with a resolution of 1152x864 and Form2 is from my notebook with a resolution of 1400x1050. Both PCs run Windows XP. As you can see, the client area differs. On a third machine running Windows XP embedded the rigth boarder line cut's the "ABC" button. It's not only a matter of a different boarder or title bar. It doesn't desturb me, whether title bar or boarder are different from machine to machine. But the asymetric appearence of Form2 is very annoying.

Any ideas?

Share this post


Link to post
Share on other sites

Yes, in deed the reason for the different sizes is the dpi setting. So is there a possibility to query the dpi setting? This way it would be possible to readjust the form.

Share this post


Link to post
Share on other sites

So is there a possibility to query the dpi setting? This way it would be possible to readjust the form.

$DPI_setting = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "AppliedDPI")

Share this post


Link to post
Share on other sites

I've fixed it now. At least the different size was not related to the size of the form itself. It's related to the form style. I create now the form with

$Form_Main = GUICreate($TitleMain, 117, 25, $SIP_XPos, $SIP_YPos, $WS_CAPTION, $WS_EX_TOOLWINDOW)

This works fine for both dpi settings (96/120).

However, thanks a lot for your advise.

Great forum and great people here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0