Sign in to follow this  
Followers 0
dantay9

Window Size

14 posts in this topic

#1 ·  Posted (edited)

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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)

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

It's a constant not a string.

#define SPI_SETWORKAREA          0x002F

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

DllCall("user32.dll", "int", "SystemParametersInfo", "uint", 0x002F, "uint", 0, "ptr", DllStructGetPtr($Structure), "uint", $SPIF_SENDCHANGE)

...and MsgBox will return always 0 because that it what it shows when you pass in an array type variable.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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 :}.

Share this post


Link to post
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


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

I just figured I would post it on the forum so I could get everyone's opinions and ideas. Do you know how the widget bar is formed?


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0