Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 12 of 12
  1. #1
    Join Date
    May 2006
    Posts
    5,380

    DLL: SetDisplaySettings

    This dll will enable you to set the users display settings to suit your app,


    function name: ChangeDisplaySettings

    Arguments: width, height, Depth, Freq, Permanent (0 false, 1 = true)

    Returns:
    • 0 = The settings change was successful.
    • 1 = The computer must be restarted in order for the graphics mode to work.
    • -4 = An invalid set of flags was passed in.
    • -1 = The display driver failed the specified graphics mode.
    • -2 = The graphics mode is not supported.
    • -3 = Windows NT only: Unable to write settings to the registry.

    i have set this into a easy to use function for apms, the function will resize the screen and reposition the app so its in the center

    Code:
    --Global function for the screen settings, !!!DO NOT EDIT!!!
    function ChangeDisplaySettings(width,height,Depth,Freq,Permanent)
    args = width..", "..height..", "..Depth..", "..Freq..", "..Permanent
    result = DLL.CallFunction("AutoPlay\\Docs\\DLLDisplaySettings.dll", "ChangeDisplaySettings", args, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
    	if result == "0" then
    		local hWnd = Application.GetWndHandle();
    		local WndSize = Window.GetSize(hWnd);
    		local ScreenRes = System.GetDisplayInfo();
    		local NewPos_X = (ScreenRes.Width - WndSize.Width)/2;
    		local NewPos_Y = (ScreenRes.Height - WndSize.Height)/2;
    		Window.SetPos(hWnd, NewPos_X, NewPos_Y);
    	else
    		if result == 1 then err = "The computer must be restarted in order for the graphics mode to work"
    			elseif result == "-4" then err = "An invalid set of flags was passed in"
    			elseif result == "-1" then err = "The display driver failed the specified graphics mode"
    			elseif result == "-2" then err = "The graphics mode is not supported"
    			elseif result == "-3" then err = "Unable to write settings to the registry"
    		end
    		Dialog.Message("Error", err, MB_OK, MB_ICONNONE, MB_DEFBUTTON1);
    	end
    end

    which would be called with this
    Code:
    -- arguments: width, height, Depth, Freq, Permanent (0 false, 1 = true)
    ChangeDisplaySettings(800,600,16,70,0)
    if you set permanent to false (0) then the users original settings will be restored when your app exits

    you can download the amp example file (apz) or the dll and function in text file(zip)
    Last edited by RizlaUK; 02-01-2009 at 11:35 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  2. #2
    Join Date
    Oct 2006
    Posts
    209
    thanx m8, really nice work.

  3. #3
    Join Date
    Mar 2007
    Posts
    186

    Re: RizlaUk

    Man you are on fire! - You are simply all over the place...It is just great to see

    Oh Wait, I err...kinda forgot my manners - Thanks!
    Last edited by SiNisTer; 06-12-2007 at 04:00 AM.

  4. #4
    Join Date
    Mar 2005
    Posts
    187
    Yeah way to go RizlaUK! This DLL is very helpful for something I'm working on!

  5. #5
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    Thanks Rizla.
    This type of Dll was on the forum a couple of years back and I want to repeat here what I said then.
    I think changing the screen res for a user on a permanent basis is NOT something acceptable to do. I, for one, would be VERY angry at the app developer if such a thing would occur.
    Yossi

  6. #6
    Join Date
    Mar 2005
    Posts
    187
    Hi Yosik,

    I agree, if the behavior is unexpected or unwanted. There may be instances where a user wants their resolution changed, and needs it handled programtically.

    If a user needs to swap between different resolutions quickly, creating an app with a hotkey would be very beneficial. One example I'm using this for is a bug on my Macbook Pro running Vista. Whenever I come out of sleep mode initiated by a lid close, the resolution changes to its lowest setting. Its a bug in the driver, and without a fix at the moment. So I've created an app that changes the resolution whenever my system comes out of sleep.

    I think your comment is a general rule of thumb for any developer. If a behavior is unexpected or may create a condition that a user does not want, then its poor practice.

    Having said that, there are many benefits to being able to change a resolution with this DLL.

    My 2 cents...

  7. #7
    Join Date
    Nov 2007
    Posts
    19

    Lightbulb

    it change refresh rate to 60 allways ?

  8. #8
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Thanks RizlaUK, I mirrored this on amsuser.com:

    http://www.amsuser.com/ams/examples/...S7-RizlaUK.apz
    Intrigued

  9. #9
    Join Date
    Oct 2007
    Location
    USA
    Posts
    32

    having problem

    if a users system resolution is 800x600 and my project page resolution is
    1024x768 and I use the dll to set the system resolution to 1024x768 for some reason the page only covers 800x600 of the screen when it should cover the whole screen. (note) not using title bar, using border style for project.
    it only works correctly when switching from a higher res to a lower res.
    example :
    system res 1024x768
    page res 800x600
    then use dll to change system res to 800x600
    Last edited by thachsn1; 05-14-2008 at 09:14 PM.

  10. #10
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by thachsn1 View Post
    if a users system resolution is 800x600 and my project page resolution is
    1024x768 and I use the dll to set the system resolution to 1024x768 for some reason the page only covers 800x600 of the screen when it should cover the whole screen. (note) not using title bar, using border style for project.
    it only works correctly when switching from a higher res to a lower res.
    example :
    system res 1024x768
    page res 800x600
    then use dll to change system res to 800x600
    make you app dynamic and have it mini 800X600 and have it resize to the
    screens resalsion

  11. #11
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by hady View Post
    it change refresh rate to 60 allways ?
    Just looking at this post in isolation - that is exactly as it should be. Driving a monitor above it's limit could cause permanent damage. As far as refresh rate is concerned, 60Hertz is the safe baseline apart from H&S considerations if it's a CRT Monitor.

    Fiddling about with monitor settings is an absolute No No as far as I'm concerned. Far better to design to accomodate the existing user settings.

  12. #12
    Join Date
    Jun 2008
    Posts
    165
    RizlaUK: thank very much for this little gem!

    By using your dll & app I have a workable fix for my month long problem

    2 cut a story shot, remote desktop wasnt liking my new graphics card and when trying to connect to pcs it was really slow and slugish, then i found out i had to set the colour to 16bit from 24 and then it would work,

    so i have made an AmS application that when clicked will automaticlly set colour to 16bit, load up RDC and with the switch of the pc i want to connnect to it, does this automatically, and when RDC is closed, the ams application returns my screen to normal so fank you more rizla for this beauty
    Last edited by SteevieNiteHeat; 06-20-2008 at 01:04 PM. Reason: fogot to add emotion

Similar Threads

  1. Official Release Of SetMask DLL
    By Worm in forum AutoPlay Media Studio 5.0
    Replies: 23
    Last Post: 01-24-2005, 09:00 PM
  2. Calling DLL problem
    By Willis in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 05-11-2004, 03:57 PM
  3. Calling a DLL
    By matrix in forum Setup Factory 6.0
    Replies: 1
    Last Post: 12-26-2001, 07:47 PM
  4. SUF6 - Call DLL action
    By Romahe in forum Setup Factory 5.0
    Replies: 1
    Last Post: 11-27-2001, 06:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts