Jump to content
Sign in to follow this  
S3cret

ControlSetStyle

Recommended Posts

S3cret

Hi.

I want to change the style of a static control in another window. I just want to center the text. But there is no function to change other controls style. I googled and searched in msdn library for dll calls to achieve my goal, but I didn't find something useful for me. I got a function to change window styles:

;Set Window Styles
Func WinSetStyle($hWnd, $Style = -1, $ExStyle = 0)
    Local Const $GWL_STYLE = -16
    Local Const $GWL_EXSTYLE = -20
    Local Const $SWP_NOMOVE = 0x2
    Local Const $SWP_NOSIZE = 0x1
    Local Const $SWP_SHOWWINDOW = 0x40
    Local Const $SWP_NOZORDER = 0x4
    Local $iFlags = BitOR($SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER)
    If $Style = -1 Then $Style = $WS_MINIMIZEBOX + $WS_CAPTION + $WS_POPUP + $WS_SYSMENU
    DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $Style)
    DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_EXSTYLE, "int", $ExStyle)
    DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, _
            "int", 0, "int", 0, "int", $iFlags)
EndFunc

Sorry, I don't know who made this function.

My question:

Is there any way to change this function to work with controls or is there any other way?

Ty so far.

S3cret

Share this post


Link to post
Share on other sites
PsaltyDS

A control is sort of like a little child window. Just use the control's handle for $hwnd.

This is covered by _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iValue). See help file.

:(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
S3cret

A control is sort of like a little child window. Just use the control's handle for $hwnd.

This is covered by _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iValue). See help file.

:(

Yeah u were right. If I combine the old styles with the centerstyle it works, thanks =)

S3cret

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.