Mike Williams
8/10/2012 7:22:00 AM
"BeeJ" <nospam@spamnot.com> wrote in message
news:k01qe7$1a5$1@speranza.aioe.org...
> I changed the Win XP Pro DPI from 96 to 120 and restarted.
> Everything changed size-wise as expected, and my App looks
> correct just larger (no distortions or picturebox sliding).
That is the default behaviour of a VB6 Form as far as its initial display
size is concerned (before the user attempts to manually resize it if it
happens to be resizable), but only if your Form does not contain any control
repositioning code of any kind and only if the "new expanded version" is
still smaller than the available screen area. That's because a VB6 Form is
itself dpi aware by default (or at least dpi aware in respect of its client
size and most control sizes and menus, although it is not natively dpi aware
with regards to some controls, such as toolbars for example).
For such a Form the VB6 runtime will expand the size of the client area of
the Form in accordance with the dpi setting of the machine, and it will
expand both the size and the position of all the Form's contained controls
by the same amount. Since the positions of the controls relate to the top
left corner of the client area, and since the client area of the Form I have
described is going to expand by the same amount regardless of the version of
Windows on which it is running and regardless of the thickness of its
various borders, then you will still get the same result (for the Form I
have described) even when running on Vista or on Windows7. (The "dpi aware"
stuff I mentioned is still needed to cure other problems though, especially
on Vista and Windows7).
> Is there a clue there for me to look at something?
Yes. You've got some repositiong code that is messing up the above default
behaviour. That's why I asked for your repositioning code. I'm not saying
that you should not have repositioning code of course (and you definitely
need such code if your Form is user resizable or even on a fixed size Form
if there is a chance that your app will be run on a machine on which its
"new expanded as per dpi size" might be larger than the available screen
area). I'm just saying that your repositioning code is where you need to
look for your problem.
Without seeing your code it is hard to tell what it might be doing wrong,
but it very definitely could be because (as David Youngblood has already
suggested) your code is positioning things in accordance with the overall
size of the Form (rather than its client size which a VB6 Form itself does
by default with regards to dpi) and your code will therefore not be taking
account of the different border and caption bar sizes on different machines
(especially between XP and Vista and Win7).
> This app was to be a no install, or rather simple .exe copy
> install which it does now.
That's okay. You do not need a separate dpi aware manifest file because you
can embed one into your compiled exe. I strongly advise you to use such a
manifest though (ether embedded or separate), even if you fix your current
problem without the need for one (which you should be able to do), because
without a manifest the new Vista and Windows7 "tell lies about the dpi
setting" (which will happen on most Vista and Win7 machines running at 144
dpi or above and also on a few running at 120 dpi) will mess up the
appearance of your Form in other ways.
The "lie to apps about the dpi setting", which some Vista and Windows7
machines will be set to do, happens only to programs which have not declared
themselves to be dpi aware. It causes the operating system to tell the app
that the machine is running at 96 dpi even when it actually might be running
at 120 dpi or 144 dpi or more, and it redirects the app's output to an
offscreen buffer from where the operating system then "stretches" that
buffer onto the display at a larger size in accordance with the actual dpi
setting. This causes fuzzy text on your Form and its controls and it causes
your menus and toolbars to be fuzzy as well and it can sometimes cause other
problems. This "lie to an app about the dpi setting" was introduced in order
to force apps to become larger on a large dpi display even (in fact
especially) if those apps would not otherwise do so. It is therefore just a
"kludge" really and is needed only for apps which are not themselves dpi
aware and it seems a shame to allow the system to apply it (and to cause
this fuzzy text and other possible problems) to a VB6 Form when in fact a
VB6 Form is already at least partially dpi aware by default.
Anyway, as David YoungBlood has said, your current problem is more likely to
be related to your repositioning code positioning things in accordance with
overall size of the Form rather than the size of its client area (which is
why I asked you to post it) so it's up to you whether you bother with dpi
awareness or whether you are happy to instead have a fuzzy looking Form on
lots of machines. It's a design decision ;-)
Mike