Thread: API
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Steve Garman Steve Garman is offline
external usenet poster
 
Posts: 107
Default API

ChangeDisplaySettings can be really useful in a controlled environment.

However, if you really must offer this on other people's systems, can I
please make a couple of suggestions.

Remember, this is a fundamental change to the computer's settings

At the very least, check the return value of ChangeDisplaySettings

Const DISP_CHANGE_SUCCESSFUL As Long = 0
Const DISP_CHANGE_RESTART As Long = 1

If it returns 0, the machine thinks it has succeeded
If it returns 1, you have made a change the user won't see till next
time (s)he reboots. That can be really nasty.

Any other return value probably means failure of some sort.

Const DISP_CHANGE_FAILED As Long = -1
Const DISP_CHANGE_BADMODE As Long = -2
Const DISP_CHANGE_NOTUPDATED As Long = -3
Const DISP_CHANGE_BADFLAGS As Long = -4
Const DISP_CHANGE_BADPARAM As Long = -5

I recommend after a successful change you ask the user to confirm all is
OK (do not use a msgBox or modal form) and, if not, reset the resolution
after say 45 seconds.

And, of course, whatever else you do, aways reset to the original
settings before finishing.
These settings may well be neither 1280x768 nor 800x600

Having said all that, I still think you'd be much better to offer
alternate versions of you forms to the user instead of messing with
things of which the users may not understand the significance.

DennisE wrote:

Harald,

I'd never in a million years mess with
anyone's laptop in an arbitrary fashion.
The decision to switch from 1280X768
to 800X600 (or the reverse) will be left entirely in the hands of users who
might wish to see userforms larger or smaller (perhaps even selectively so as
they move through the program) without having to leave Excel to adjust their
desktop parameters.

-- Dennis Eisen