Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Change apps perceived width of desktop


  • Please log in to reply
5 replies to this topic

#1 Sunaj

Sunaj

    Prodigy

  • Active Members
  • PipPipPip
  • 190 posts

Posted 06 September 2008 - 09:32 PM

A simple question that may not have a very simple solution - what code should I be looking at to make normal windows applications (Firefox/Office/Notepad..etc.) think that the screen resolution is 1480x 1050 instead of 1680x1050.

Or stated in another way: how do I make it so that I can press 'maximize' in a given window (Firefox/Office/Notepad..etc.) and have that window leave space free, say 200px, on the right side of the screen?

Any input would be appreciated, have searched high and low with no result..

Cheers.







#2 baghenamoth

baghenamoth

    Wayfarer

  • Active Members
  • Pip
  • 52 posts

Posted 07 September 2008 - 12:08 AM

A simple question that may not have a very simple solution - what code should I be looking at to make normal windows applications (Firefox/Office/Notepad..etc.) think that the screen resolution is 1480x 1050 instead of 1680x1050.

Or stated in another way: how do I make it so that I can press 'maximize' in a given window (Firefox/Office/Notepad..etc.) and have that window leave space free, say 200px, on the right side of the screen?

Any input would be appreciated, have searched high and low with no result..

Cheers.


not very clean solution but it seems to work :
waiting for a solution with titlebar hook and api, but I have no idea how to to this...

Dim $s_OldTitle,$v_OldState $CS_Maximized = 32 $CS_Minimized = 16 $i_MaxWidth = @DesktopWidth*2/3 $i_MaxHeight = @DesktopHeight*2/3 While 1     $s_Title = WinGetTitle("")     $v_State = WinGetState($s_Title)     If $s_OldTitle==$s_Title And $v_OldState<>$v_State Then         If BitAnd($v_State,$CS_Maximized) Then             WinMove($s_Title,"",0,0,$i_MaxWidth,$i_MaxHeight)         EndIf     EndIf     $s_OldTitle = $s_Title     $v_OldState = $v_State     Sleep(500) WEnd


#3 Sunaj

Sunaj

    Prodigy

  • Active Members
  • PipPipPip
  • 190 posts

Posted 07 September 2008 - 07:18 AM

not very clean solution but it seems to work :
waiting for a solution with titlebar hook and api, but I have no idea how to to this...


Thanks for your ideas here baghenamoth; but yes; an api-hook would by far be the best solution; in a production environment the GUI shuffling that occurs with a simple loop solution is simply not very workable!

The best possible solution would be to define part of the desktop as 'keep off' in the same way the taskbar works - no matter how large you make it a window which is maximized will only use the space available to it. I intend to make a lite-style deskbar application but this basic problem really needs to be dealt with before I care to invest my time in the project! ;)

Anyone?

Edited by Sunaj, 07 September 2008 - 08:01 AM.


#4 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,321 posts

Posted 07 September 2008 - 04:05 PM

Thanks for your ideas here baghenamoth; but yes; an api-hook would by far be the best solution; in a production environment the GUI shuffling that occurs with a simple loop solution is simply not very workable!

The best possible solution would be to define part of the desktop as 'keep off' in the same way the taskbar works - no matter how large you make it a window which is maximized will only use the space available to it. I intend to make a lite-style deskbar application but this basic problem really needs to be dealt with before I care to invest my time in the project! ;)

Anyone?

This might help.
Plain Text         
Const $SPI_SETWORKAREA = 47, $SPI_GETWORKAREA = 48 Const $SPIF_SENDCHANGE = 11 $newWid = @DesktopWidth - 300 $newHt = @DesktopHeight $DtopRect = DllStructCreate("int[4]") $PDTopRect = DllStructGetPtr($DtopRect) $OrigRect = DllStructCreate("int[4]") $POrigRect = DllStructGetPtr($OrigRect) $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETWORKAREA, "int", 0, "ptr", $POrigRect, "int", 0) MsgBox(262144, 'The work area is ', DllStructGetData($OrigRect, 1, 1) & ', ' & DllStructGetData($OrigRect, 1, 2) & _         ' x ' & DllStructGetData($OrigRect, 1, 3) & ', ' & DllStructGetData($OrigRect, 1, 4)) Sleep(2000) MsgBox(262144, "next step", "we'll change it to something smaller") DllStructSetData($DtopRect, 1, DllStructGetData($OrigRect, 1, 1), 1);top DllStructSetData($DtopRect, 1, DllStructGetData($OrigRect, 1, 2), 2);left DllStructSetData($DtopRect, 1, DllStructGetData($OrigRect, 1, 3) - 300, 3);bottom DllStructSetData($DtopRect, 1, DllStructGetData($OrigRect, 1, 4) - 200, 4);right $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_SETWORKAREA, "int", 0, "ptr", $PDTopRect, "int", $SPIF_SENDCHANGE) MsgBox(262144, "somthing might have changed on your desktop", "better have a look. (Try to maximize something)") $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETWORKAREA, "int", 0, "ptr", $PDTopRect, "int", 0) MsgBox(262144, 'work area is now', DllStructGetData($DtopRect, 1, 1) & ', ' & DllStructGetData($DtopRect, 1, 2) & _                ' x ' & DllStructGetData($DtopRect, 1, 3) & ', ' & DllStructGetData($DtopRect, 1, 4)) ;we'll put the working area back to how it was sleep(2000) MsgBox(262144, "final step", "we'll put it back how it was") $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_SETWORKAREA, "int", 0, "ptr", $POrigRect, "int", $SPIF_SENDCHANGE) $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETWORKAREA, "int", 0, "ptr", $POrigRect, "int", 0) MsgBox(262144, 'work area is now', DllStructGetData($OrigRect, 1, 1) & ', ' & DllStructGetData($OrigRect, 1, 2) & _         ' x ' & DllStructGetData($OrigRect, 1, 3) & ', ' & DllStructGetData($OrigRect, 1, 4));right

Edited by martin, 07 September 2008 - 04:06 PM.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#5 Sunaj

Sunaj

    Prodigy

  • Active Members
  • PipPipPip
  • 190 posts

Posted 07 September 2008 - 06:24 PM

This might help.


Dude, that is, to me, simply amazing! ;) Thank you so much for helping out; this post is going straight in my signature to create reference for future budding deskbar writers :D

#6 dreniarb

dreniarb

    Seeker

  • Active Members
  • 9 posts

Posted 21 March 2011 - 06:29 PM

Dude, that is, to me, simply amazing! :) Thank you so much for helping out; this post is going straight in my signature to create reference for future budding deskbar writers :)


No kidding! I've been working on my own custom shell application and now I can make my own taskbar and not worry about a maximized program covering it up. Awesome!

Edited by dreniarb, 21 March 2011 - 06:30 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users