LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Restoring Screen Resolutions

Hi Adam,

Glad the solution passed the first hurdle <g.

Just to explain the difference. The API wizard, accurately, defines the
function as:

Private Declare Function ChangeDisplaySettings Lib "user32" _
Alias "ChangeDisplaySettingsA" _
(lpDevMode As Any, _
ByVal dwFlags As Long) As Long

The first parameter is passed by reference (i.e. a pointer in C parlance).
API calls are treated by the O/S using C language. In C Null is the *value*
0. When you pass in 0& (unqualified), which is what vbNullString evaluates
to, you are telling the O/S to reference the memory at address 0 (sadly this
is the start of the O/S memory and unless your computer is in a sad state
its value will not be zero!). By changing the call to ByVal 0& you
overwrite the function declaration and tell the O/S to use the value 0 which
is correctly interpreted as Null.

Best wishes,

Peter Beach

"adam99 " wrote in message
...
Thanks for replying Peter, it works well on my PC(further testing on
other OS will be required). I really don't like changing the screen
resolutioin but at the moment I can't get around it. I will have to put
some error handling for situations where reboots are required & those
similair to your LCD monitor.

Thanks Again,
Adam.:)


---
Message posted from http://www.ExcelForum.com/



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Status bar disappears when restoring screen size Ernie Excel Discussion (Misc queries) 0 November 24th 08 05:24 PM
Need to convert point on screen to various screen resolutions Donna YaWanna Excel Discussion (Misc queries) 5 October 26th 05 10:10 PM
How to position form in same place with different screen resolutions Joe 90[_2_] Excel Programming 5 May 6th 04 10:27 AM
Resizing BackgroundPicture Gifs programmatically for varying screen resolutions Charles Jordan Excel Programming 4 April 13th 04 06:53 PM
different screen resolutions Rob Excel Programming 0 December 10th 03 09:48 PM


All times are GMT +1. The time now is 09:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"