Jump to content

Window Size


Recommended Posts

I would like to know how to make all windows have a limited size so I can add a bar on the side of the window. I want it to look like a widget bar, but that isn't what it is for. I know this can be done, probably with multiple dll calls, I just don't know how. I want extra space on the edge of the desktop even when windows are maximized.

Edited by dantay9
Link to comment
Share on other sites

I tried that out, but I don't think I am doing it right. Here's what I got:

Global Const $SPIF_SENDCHANGE = 0x0002
$Structure = DllStructCreate("int var1; int var2; int var3; long var4")
DllStructSetData($Structure, "var1", 0)
DllStructSetData($Structure, "var2", 0)
DllStructSetData($Structure, "var3", 500)
DllStructSetData($Structure, "var4", 500)
DllCall("user32.dll", "int", "SystemParametersInfo", "uint", "SPI_SETWORKAREA", "uint", 0, "ptr", $Structure, "uint", $SPIF_SENDCHANGE)
Link to comment
Share on other sites

It doesn't work. When I maximize windows, they still cover the whole screen. Am I still doing something wrong?

Global Const $SPIF_SENDCHANGE = 0x0002
 $Structure = DllStructCreate("int var1; int var2; int var3; long var4")
 DllStructSetData($Structure, "var1", 0)
 DllStructSetData($Structure, "var2", 0)
 DllStructSetData($Structure, "var3", 500)
 DllStructSetData($Structure, "var4", 500)
 MsgBox(0, '', DllCall("user32.dll", "int", "SystemParametersInfo", "uint", 0x002F, "uint", 0, "ptr", $Structure, "uint", $SPIF_SENDCHANGE))
Edited by dantay9
Link to comment
Share on other sites

It doesn't work. When I maximize windows, they still cover the whole screen. Am I still doing something wrong?

Global Const $SPIF_SENDCHANGE = 0x0002
 $Structure = DllStructCreate("int var1; int var2; int var3; long var4")
 DllStructSetData($Structure, "var1", 0)
 DllStructSetData($Structure, "var2", 0)
 DllStructSetData($Structure, "var3", 500)
 DllStructSetData($Structure, "var4", 500)
 MsgBox(0, '', DllCall("user32.dll", "int", "SystemParametersInfo", "uint", 0x002F, "uint", 0, "ptr", $Structure, "uint", $SPIF_SENDCHANGE))
DllCall("user32.dll", "int", "SystemParametersInfo", "uint", 0x002F, "uint", 0, "ptr", DllStructGetPtr($Structure), "uint", $SPIF_SENDCHANGE)
Link to comment
Share on other sites

Thank you for your help and patience. The limits work when the window is maximized, but when the window isn't maximized, it can still go into the area for the "widget bar". How can I fix that?

Global Const $SPIF_SENDCHANGE = 0x0002
$Structure = DllStructCreate("int var1; int var2; int var3; int var4")
DllStructSetData($Structure, "var1", 0)
DllStructSetData($Structure, "var2", 0)
DllStructSetData($Structure, "var3", @DesktopWidth / 2)
DllStructSetData($Structure, "var4", @DesktopHeight)
DllCall("user32.dll", "int", "SystemParametersInfo", "uint", 0x002F, "uint", 0, "ptr", DllStructGetPtr($Structure), "uint", $SPIF_SENDCHANGE)
Edited by dantay9
Link to comment
Share on other sites

Heh, that is the annoying thing. If your window has always on top such as the taskbar window then if another window has also $WM_EX_TOPMOST extended style it'll go over top of yours, and the top of the taskbar window for that matter. In my opinion you can make your window top most but if another window is willing to go top over your window you should allow it and not play annoying WinMove tricks :}.

Link to comment
Share on other sites

I found exactly what I want, but I don't understand all the dll calls and the functions. It makes a widget bar and allows widgets to be added. All I want is the widget bar. I need help understanding the code. If someone could cut out the code that makes the widget bar and explain to me what each of the dll calls and functions are doing, that would be great! Here's the link:

http://www.autoitscript.com/forum/index.ph...rank%27s+gadget

Link to comment
Share on other sites

I found exactly what I want, but I don't understand all the dll calls and the functions. It makes a widget bar and allows widgets to be added. All I want is the widget bar. I need help understanding the code. If someone could cut out the code that makes the widget bar and explain to me what each of the dll calls and functions are doing, that would be great! Here's the link:

http://www.autoitscript.com/forum/index.ph...rank%27s+gadget

Why do not you ask the author?
Link to comment
Share on other sites

Hi I was wondering if someone could provide a demonstration or tell me how to use the SPI_GETWORKAREA to get the work space dimensions. Sorry if this is considered hijacking a thread but the topic is same, just in reverse.

Link to comment
Share on other sites

#include <WinAPI.au3>

Global Const $SPI_GETWORKAREA = 0x0030

Global $tRECT, $pRECT
Global $aRet

$tRECT = DllStructCreate($tagRECT)
$pRECT = DllStructGetPtr($tRECT)

$aRet = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_GETWORKAREA, 'uint', 0, _
            'ptr', $pRECT, 'uint', 0)

If Not @error And $aRet[0] Then
    ConsoleWrite(StringFormat("Width: %d\tHeight: %d\n", DllStructGetData($tRECT, 'Right'), _
            DllStructGetData($tRECT, 'Bottom')))
Else
    ConsoleWrite(_WinAPI_GetLastErrorMessage())
EndIf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...