S3cret Posted March 26, 2010 Posted March 26, 2010 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
PsaltyDS Posted March 26, 2010 Posted March 26, 2010 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
S3cret Posted March 26, 2010 Author Posted March 26, 2010 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now