AutoIt Forums: Screen Resolution Changing UDF - AutoIt Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Screen Resolution Changing UDF Changes resolution, depth and refresh rate Rate Topic: ****- 1 Votes

#1 User is offline   PartyPooper 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 655
  • Joined: 03-November 05
  • Gender:Male
  • Location:Australia

Posted 12 January 2006 - 07:23 AM

Inspired by original thread. All credit should go to psandu.ro, I just converted his code into a UDF and modified it slightly.

Here's a simple example of how it is called and used:
[ code='text' ]    ( Popup )
#include <ChangeResolution.au3> $iWidth = 1024 $iHeight = 768 $iBitsPP = 32 $iRefreshRate = 60 $vRes = _ChangeScreenRes($iWidth, $iHeight, $iBitsPP, $iRefreshRate) If @error Then     MsgBox(262160, "ERROR", "Unable to change screen - check parameters") EndIf



Format for the UDF is as follows:
[ code='text' ]    ( Popup )
#include <ChangeResolution.au3> _ChangeScreenRes( [Width [, Height [, BitsPerPixel [, RefreshRate]]]] )


Parameters
Width - [optional] Width of the desktop screen in pixels. (horizontal resolution). Default (-1) is @DeskTopWidth
Height - [optional] Height of the desktop screen in pixels. (vertical resolution). Default (-1) is @DesktopHeight
BitsPerPixel - [optional] Depth of the desktop screen in bits per pixel. Default (-1) is @DesktopDepth
RefreshRate - [optional] Refresh rate of the desktop screen in hertz. Default (-1) is @DesktopRefresh

Return Value
Success: Screen is adjusted, @ERROR = 0
Failure: Sets @ERROR = 1

Remarks
Current screen parameters may be left unchanged by using '-1' as the parameter.

This post has been edited by PartyPooper: 12 January 2006 - 07:24 AM


#2 User is offline   PartyPooper 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 655
  • Joined: 03-November 05
  • Gender:Male
  • Location:Australia

Posted 12 January 2006 - 07:37 AM

Forgot to add, not sure if it runs on all variants of Windows (I can only test it on XP). Appreciate if you would let me know if it fails on a particular variant.

#3 User is offline   JerryD 

  • Spammer!
  • PipPipPip
  • Group: Full Members
  • Posts: 245
  • Joined: 04-May 04
  • Gender:Male
  • Location:New York, NY

Posted 12 January 2006 - 10:58 AM

View PostPartyPooper, on Jan 12 2006, 01:37 AM, said:

Forgot to add, not sure if it runs on all variants of Windows (I can only test it on XP). Appreciate if you would let me know if it fails on a particular variant.

WOW, that is really impressive!

#4 User is offline   SmOke_N 

  • It's not what you know .... It's what you can prove!
  • Icon
  • Group: Moderators(Mod)
  • Posts: 15,183
  • Joined: 21-February 05
  • Gender:Male
  • Location:UNITED STATES

Posted 12 January 2006 - 11:24 AM

Nice work PartyPooper... FYI - Works on XP Pro SP2 Corp.

Edit:
(Warning... don't stare at your screen when it changes :wacko: ... My eyes are still focusing!! :lol: )

This post has been edited by SmOke_N: 12 January 2006 - 11:24 AM


#5 User is offline   SandelPerieanu 

  • Advanced Member
  • PipPip
  • Group: Full Members
  • Posts: 169
  • Joined: 20-May 05
  • Location:Romania

Posted 12 January 2006 - 12:42 PM

:P

#6 User is offline   PartyPooper 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 655
  • Joined: 03-November 05
  • Gender:Male
  • Location:Australia

Posted 12 January 2006 - 03:25 PM

Cool. Thanks all. I'm going to use it in my FastGaming program as part of the Screen Adjuster option.

#7 User is offline   Sreenath 

  • Newbie
  • Group: Members
  • Posts: 9
  • Joined: 27-June 06

Posted 05 July 2006 - 06:31 AM

Where is this DllStructCreate, DllGetStruct etc. ?

This post has been edited by Sreenath: 05 July 2006 - 08:35 AM


#8 User is offline   RazerM 

  • cowinkeedenky - coincidence?
  • PipPipPipPipPipPip
  • Group: Full Members
  • Posts: 1,240
  • Joined: 27-February 06
  • Location:Scotland

Posted 05 July 2006 - 10:17 AM

@Sreenath you need the beta http://www.autoitscript.com/autoit3/files/beta/autoit/

@PartyPooper
Works really well. Nice job

#9 User is offline   steve8tch 

  • Spammer!
  • PipPipPip
  • Group: Full Members
  • Posts: 283
  • Joined: 03-December 03

Posted 05 July 2006 - 10:55 AM

Can this be submitted to be included with the official AutoIt UDFs that get installed by AutoIt ?

#10 User is offline   marfdaman 

  • ...and when you wake, the morning showers you with light...
  • PipPipPipPip
  • Group: Full Members
  • Posts: 405
  • Joined: 30-April 06
  • Location:Good old Holland

Posted 05 July 2006 - 10:56 AM

Seems like a good idea to me :idea:

#11 User is offline   PartyPooper 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 655
  • Joined: 03-November 05
  • Gender:Male
  • Location:Australia

Posted 05 July 2006 - 12:43 PM

View PostRazerM, on Jul 5 2006, 07:17 PM, said:

@PartyPooper
Works really well. Nice job


Thanks although most of the credit goes to psandu.ro - I just massaged his work to make a UDF.

#12 User is offline   Daniel W. 

  • I hacked 127.0.0.1 !!!
  • PipPipPipPip
  • Group: Full Members
  • Posts: 434
  • Joined: 10-April 06

Posted 05 July 2006 - 01:52 PM

Wow nice done ;)
NIce how you figured it out

#13 User is offline   GaryFrost 

  • I don't need your attitude. I have one of my own
  • Icon
  • Group: Developers(Dev)
  • Posts: 7,854
  • Joined: 01-June 04
  • Gender:Male
  • Location:USA

Posted 05 July 2006 - 03:20 PM

look at http://www.autoitscript.com/forum/index.ph...st&p=153200 also

#14 User is offline   Sreenath 

  • Newbie
  • Group: Members
  • Posts: 9
  • Joined: 27-June 06

Posted 06 July 2006 - 09:16 AM

It works!! Thanks

#15 User is offline   n9mfk9 

  • Spammer!
  • PipPipPip
  • Group: Full Members
  • Posts: 205
  • Joined: 14-May 04

Posted 31 January 2007 - 02:39 AM

PartyPooper hi all wokks but the code will not exit

here is code i used #include <ChangeResolution.au3>


_ChangeScreenRes(800,600,32,60)
If @error Then
MsgBox(262160, "ERROR", "Unable to change screen - check parameters")
EndIf

Exit


why will it not exit the autoit icon says on the toolbar

thanks for any help beau

#16 User is offline   PartyPooper 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 655
  • Joined: 03-November 05
  • Gender:Male
  • Location:Australia

Posted 31 January 2007 - 05:30 AM

Exits fine for me using your code above both as a compiled exe and within SciTE. Since no one else has reported a problem with it exiting, it's more than likely something on your computer (bad AutoIt install perhaps, wrong AutoIt version??). Sorry, I can't be of more help.

#17 User is offline   fisofo 

  • If you can read this, then I suck at being a ninja
  • PipPipPipPip
  • Group: Full Members
  • Posts: 373
  • Joined: 12-August 06
  • Location:Minnesota

Posted 31 January 2007 - 05:30 AM

View Postn9mfk9, on Jan 30 2007, 07:39 PM, said:

PartyPooper hi all wokks but the code will not exit

here is code i used #include <ChangeResolution.au3>


_ChangeScreenRes(800,600,32,60)
If @error Then
MsgBox(262160, "ERROR", "Unable to change screen - check parameters")
EndIf

Exit


why will it not exit the autoit icon says on the toolbar

thanks for any help beau


holy carp batman! You do realize how old this topic is, don't you?

this should probably be in Support too... but anyway, are you running the latest beta?

#18 User is offline   Venus 

  • Newbie
  • Group: Members
  • Posts: 3
  • Joined: 12-May 08

Posted 12 May 2008 - 09:01 AM

i change the screenresolution via system display setting, how to get the result about whether change the resolution successfully?

#19 User is offline   PartyPooper 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 655
  • Joined: 03-November 05
  • Gender:Male
  • Location:Australia

Posted 12 May 2008 - 02:42 PM

See the RETURN Values in the first post.

#20 User is offline   CasaCorupta 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 13
  • Joined: 01-August 07
  • Location:Germany

Posted 26 May 2008 - 01:18 PM

perfectly, this script changes my way of working drasticly....

TOP WORK!

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users