Jump to content

find out a window's styles?


Sven
 Share

Recommended Posts

Hey,

I often wonder what styles a window is using. Now of course I can use _WinAPI_GetWindowLong($hwnd, $GWL_style) and _WinAPI_GetWindowLong($hwnd, $GWL_exstyle), but the results aren't exactly human readable, so I have this script that does a bit additional processing by using a brute force approach.

Is there a more elegant solution to this? Did I even get all the styles to check against?

Here's my script:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <winapi.au3>
#include <constants.au3>

Global $aStyles[26][2] = [[25],["WS_TILED", "0"],["WS_OVERLAPPED", "0"],["WS_MAXIMIZEBOX", "0x00010000"],["WS_MINIMIZEBOX", "0x00020000"],["WS_TABSTOP", "0x00010000"],["WS_GROUP", "0x00020000"], _
        ["WS_SIZEBOX", "0x00040000"],["WS_THICKFRAME", "0x00040000"],["WS_SYSMENU", "0x00080000"],["WS_HSCROLL", "0x00100000"],["WS_VSCROLL", "0x00200000"],["WS_DLGFRAME", "0x00400000"], _
        ["WS_BORDER", "0x00800000"],["WS_CAPTION", "0x00C00000"],["WS_OVERLAPPEDWINDOW", "0x00CF0000"],["WS_TILEDWINDOW", "0x00CF0000"],["WS_MAXIMIZE", "0x01000000"],["WS_CLIPCHILDREN", "0x02000000"], _
        ["WS_CLIPSIBLINGS", "0x04000000"],["WS_DISABLED", "0x08000000"],["WS_VISIBLE", "0x10000000"],["WS_MINIMIZE", "0x20000000"],["WS_CHILD", "0x40000000"],["WS_POPUP", "0x80000000"], _
        ["WS_POPUPWINDOW", "0x80880000"]]

Global $aExStyles[20][2] = [[19],["WS_EX_ACCEPTFILES", "0x00000010"],["WS_EX_MDICHILD", "0x00000040"],["WS_EX_APPWINDOW", "0x00040000"],["WS_EX_COMPOSITED", "0x02000000"],["WS_EX_CLIENTEDGE", "0x00000200"], _
        ["WS_EX_CONTEXTHELP", "0x00000400"],["WS_EX_DLGMODALFRAME", "0x00000001"],["WS_EX_LEFTSCROLLBAR", "0x00004000"],["WS_EX_OVERLAPPEDWINDOW", "0x00000300"], _
        ["WS_EX_RIGHT", "0x00001000"],["WS_EX_STATICEDGE", "0x00020000"],["WS_EX_TOOLWINDOW", "0x00000080"],["WS_EX_TOPMOST", "0x00000008"],["WS_EX_TRANSPARENT", "0x00000020"], _
        ["WS_EX_WINDOWEDGE", "0x00000100"],["WS_EX_LAYERED", "0x00080000"],["WS_EX_CONTROLPARENT", "0x10000"],["WS_EX_LAYOUTRTL", "0x400000"],["WS_EX_RTLREADING", "0x2000"]]

HotKeySet("^a", "_getwinstyle")

While 1
    Sleep(100)
WEnd

Func _getwinstyle()
    Local $sStyles = ""
    Local $sExStyles = ""
    Sleep(1000)
    $windowname = "[active]"
    $hwnd = WinGetHandle($windowname)
    $aReturn = _GetWindowStyles($hwnd)
    If IsArray($aReturn) Then
        For $i = 1 To $aStyles[0][0]
            If BitAND($aReturn[0], $aStyles[$i][1]) Then
                $sStyles &= $aStyles[$i][0] & @CRLF
            EndIf
        Next
        For $i = 1 To $aExStyles[0][0]
            If BitAND($aReturn[1], $aExStyles[$i][1]) Then
                $sExStyles &= $aExStyles[$i][0] & @CRLF
            EndIf
        Next
        MsgBox(0, "Styles", $sStyles)
        MsgBox(0, "ExStyles", $sExStyles)
    EndIf
EndFunc   ;==>_getwinstyle

Func _GetWindowStyles($hwnd)
    Local $aOriginalStyles[2] = [_WinAPI_GetWindowLong($hwnd, $GWL_style), _WinAPI_GetWindowLong($hwnd, $GWL_exstyle)]
    Return ($aOriginalStyles)
EndFunc   ;==>_GetWindowStyles
Edited by Sven
Link to comment
Share on other sites

Check this out

#include <winapi.au3>
#include <constants.au3>
#include <Array.au3>

Global $aStyles[26][2] = [[25],["WS_TILED", "0"],["WS_OVERLAPPED", "0"],["WS_MAXIMIZEBOX", "0x00010000"],["WS_MINIMIZEBOX", "0x00020000"],["WS_TABSTOP", "0x00010000"],["WS_GROUP", "0x00020000"], _
["WS_SIZEBOX", "0x00040000"],["WS_THICKFRAME", "0x00040000"],["WS_SYSMENU", "0x00080000"],["WS_HSCROLL", "0x00100000"],["WS_VSCROLL", "0x00200000"],["WS_DLGFRAME", "0x00400000"], _
["WS_BORDER", "0x00800000"],["WS_CAPTION", "0x00C00000"],["WS_OVERLAPPEDWINDOW", "0x00CF0000"],["WS_TILEDWINDOW", "0x00CF0000"],["WS_MAXIMIZE", "0x01000000"],["WS_CLIPCHILDREN", "0x02000000"], _
["WS_CLIPSIBLINGS", "0x04000000"],["WS_DISABLED", "0x08000000"],["WS_VISIBLE", "0x10000000"],["WS_MINIMIZE", "0x20000000"],["WS_CHILD", "0x40000000"],["WS_POPUP", "0x80000000"], _
["WS_POPUPWINDOW", "0x80880000"]]

Global $aExStyles[20][2] = [[19],["WS_EX_ACCEPTFILES", "0x00000010"],["WS_EX_MDICHILD", "0x00000040"],["WS_EX_APPWINDOW", "0x00040000"],["WS_EX_COMPOSITED", "0x02000000"],["WS_EX_CLIENTEDGE", "0x00000200"], _
["WS_EX_CONTEXTHELP", "0x00000400"],["WS_EX_DLGMODALFRAME", "0x00000001"],["WS_EX_LEFTSCROLLBAR", "0x00004000"],["WS_EX_OVERLAPPEDWINDOW", "0x00000300"], _
["WS_EX_RIGHT", "0x00001000"],["WS_EX_STATICEDGE", "0x00020000"],["WS_EX_TOOLWINDOW", "0x00000080"],["WS_EX_TOPMOST", "0x00000008"],["WS_EX_TRANSPARENT", "0x00000020"], _
["WS_EX_WINDOWEDGE", "0x00000100"],["WS_EX_LAYERED", "0x00080000"],["WS_EX_CONTROLPARENT", "0x10000"],["WS_EX_LAYOUTRTL", "0x400000"],["WS_EX_RTLREADING", "0x2000"]]

_getwinstyle($aStyles)
_getwinstyle($aExStyles)

Func _getwinstyle(ByRef $aArray)
For $i = 1 To UBound( $aArray ) -1
$aArray[$i][1] = Number($aStyles[$i][1])
Next
_ArraySort( $aArray, 0, 1, 0, 1 )
_ArrayDisplay( $aArray )
EndFunc   ;==>_getwinstyle
And check the Function Enum

You would surely get some relations.

Try it :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

All of those values are in the WindowsConstants.au3 file that comes with AutoIt, you could replace the hex values in the code with the constants in there so there's no need for number conversions. You can also check to see if you missed any.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Orelse simply an Array with VarNames, thereafter use Eval

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

You guys totally lost me.

From reading the help file and examples in the forum I take it Enum assigns values to variables based on how many variables there are and parameters and values manually assigned to these variables. I'm afraid I don't see how that helps with anything in my case.

The constant values have been assigned to their constant names in WindowsConstants.au3, but I need the look up table to convert the constant values as returned by _WinAPI_GetWindowLong($hwnd, $GWL_style) and _WinAPI_GetWindowLong($hwnd, $GWL_exstyle) back to their constant names.

I also checked in the MSDN and it appears there are a couple more styles than declared in WindowsConstants.au3.

Link to comment
Share on other sites

Check this out

#include <winapi.au3>
#include <windowsConstants.au3>
#include <constants.au3>
#include <Array.au3>

Global $aStyles[25] = ["WS_TILED", "WS_OVERLAPPED", "WS_MAXIMIZEBOX", "WS_MINIMIZEBOX", "WS_TABSTOP", "WS_GROUP", _
"WS_SIZEBOX", "WS_THICKFRAME", "WS_SYSMENU", "WS_HSCROLL", "WS_VSCROLL", "WS_DLGFRAME", _
"WS_BORDER", "WS_CAPTION", "WS_OVERLAPPEDWINDOW", "WS_TILEDWINDOW", "WS_MAXIMIZE", "WS_CLIPCHILDREN", _
"WS_CLIPSIBLINGS", "WS_DISABLED", "WS_VISIBLE", "WS_MINIMIZE", "WS_CHILD", "WS_POPUP", _
"WS_POPUPWINDOW"]

Global $aExStyles[19] = ["WS_EX_ACCEPTFILES", "WS_EX_MDICHILD", "WS_EX_APPWINDOW", "WS_EX_COMPOSITED", "WS_EX_CLIENTEDGE", _
"WS_EX_CONTEXTHELP", "WS_EX_DLGMODALFRAME", "WS_EX_LEFTSCROLLBAR", "WS_EX_OVERLAPPEDWINDOW", _
"WS_EX_RIGHT", "WS_EX_STATICEDGE", "WS_EX_TOOLWINDOW", "WS_EX_TOPMOST", "WS_EX_TRANSPARENT", _
"WS_EX_WINDOWEDGE", "WS_EX_LAYERED", "WS_EX_CONTROLPARENT", "WS_EX_LAYOUTRTL", "WS_EX_RTLREADING"]

_getwinstyle()

Func _GetWindowStyles($hWnd)
Local $aOriginalStyles[2] = [_WinAPI_GetWindowLong($hWnd, $GWL_Style), _WinAPI_GetWindowLong($hWnd, $GWL_ExStyle)]
Return ($aOriginalStyles)
EndFunc   ;==>_GetWindowStyles

Func _getwinstyle()
Local $hWnd = WinGetHandle("[ACTIVE]")
Local $Title = WinGetTitle($hWnd)

Local $sArray[1] = [$Title]
Local $Style = _GetWindowStyles($hWnd)

For $i = 1 To UBound($aStyles) - 1
If BitAND($Style[0], Eval($aStyles[$i])) Then _ArrayAdd($sArray, $aStyles[$i])
Next
_ArrayDisplay($sArray, "Style List")

ReDim $sArray[1]
For $i = 1 To UBound($aExStyles) - 1
If BitAND($Style[1], Eval($aExStyles[$i])) Then _ArrayAdd($sArray, $aExStyles[$i])
Next
_ArrayDisplay($sArray, "Ex-Style List")
EndFunc   ;==>_getwinstyle
Thumbs up if it helped ;)

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Eval made sense and I just did pretty much the same thing you did:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <winapi.au3>
#include <Windowsconstants.au3>
#include <constants.au3>

Global $aStyles[28] = [27, "WS_TILED", "WS_OVERLAPPED", "WS_MAXIMIZEBOX", "WS_MINIMIZEBOX", "WS_TABSTOP", "WS_GROUP", "WS_SIZEBOX", "WS_THICKFRAME", "WS_SYSMENU", "WS_HSCROLL", "WS_VSCROLL", "WS_DLGFRAME", _
        "WS_BORDER", "WS_CAPTION", "WS_OVERLAPPEDWINDOW", "WS_TILEDWINDOW", "WS_MAXIMIZE", "WS_CLIPCHILDREN", "WS_CLIPSIBLINGS", "WS_DISABLED", "WS_VISIBLE", "WS_MINIMIZE", "WS_CHILD", "WS_POPUP", _
        "WS_POPUPWINDOW", "WS_CHILDWINDOW", "WS_ICONIC"]

Global $aExStyles[28] = [27, "WS_EX_ACCEPTFILES", "WS_EX_MDICHILD", "WS_EX_APPWINDOW", "WS_EX_COMPOSITED", "WS_EX_CLIENTEDGE", "WS_EX_CONTEXTHELP", "WS_EX_DLGMODALFRAME", "WS_EX_LEFTSCROLLBAR", _
        "WS_EX_OVERLAPPEDWINDOW", "WS_EX_RIGHT", "WS_EX_STATICEDGE", "WS_EX_TOOLWINDOW", "WS_EX_TOPMOST", "WS_EX_TRANSPARENT", "WS_EX_WINDOWEDGE", "WS_EX_LAYERED", "WS_EX_CONTROLPARENT", _
        "WS_EX_LAYOUTRTL", "WS_EX_RTLREADING", "WS_EX_LEFT", "WS_EX_LTRREADING", "WS_EX_NOACTIVATE", "WS_EX_NOINHERITLAYOUT", "WS_EX_NOPARENTNOTIFY", "WS_EX_NOREDIRECTIONBITMAP", _
        "WS_EX_PALETTEWINDOW", "WS_EX_RIGHTSCROLLBAR"]

HotKeySet("^a", "_getwinstyle")

While 1
    Sleep(100)
WEnd

Func _getwinstyle()
    Local $sStyles = ""
    Local $sExStyles = ""
    Sleep(1000)
    $windowname = "[active]"
    $hwnd = WinGetHandle($windowname)
    $aReturn = _GetWindowStyles($hwnd)
    If IsArray($aReturn) Then
        For $i = 1 To $aStyles[0]
            If BitAND($aReturn[0], Eval($aStyles[$i])) Then
                $sStyles &= $aStyles[$i] & @CRLF
            EndIf
        Next
        For $i = 1 To $aExStyles[0]
            If BitAND($aReturn[1], Eval($aExStyles[$i])) Then
                $sExStyles &= $aExStyles[$i] & @CRLF
            EndIf
        Next
        MsgBox(0, "Styles", $sStyles)
        MsgBox(0, "ExStyles", $sExStyles)
    EndIf
EndFunc   ;==>_getwinstyle

Func _GetWindowStyles($hwnd)
    Local $aOriginalStyles[2] = [_WinAPI_GetWindowLong($hwnd, $GWL_style), _WinAPI_GetWindowLong($hwnd, $GWL_exstyle)]
    Return ($aOriginalStyles)
EndFunc   ;==>_GetWindowStyles

But Enum still got me stumped.

Anyhow: :thumbsup: for PhoenixXL

Edited by Sven
Link to comment
Share on other sites

You guys totally lost me.

From reading the help file and examples in the forum I take it Enum assigns values to variables based on how many variables there are and parameters and values manually assigned to these variables. I'm afraid I don't see how that helps with anything in my case.

I'm afraid I don't see where Enum would help in this case either.

The constant values have been assigned to their constant names in WindowsConstants.au3, but I need the look up table to convert the constant values as returned by _WinAPI_GetWindowLong($hwnd, $GWL_style) and _WinAPI_GetWindowLong($hwnd, $GWL_exstyle) back to their constant names.

I also checked in the MSDN and it appears there are a couple more styles than declared in WindowsConstants.au3.

You would still need your look up table to covert from the numbers to the value names, I was proposing replacing the number strings in your code to the constants that are assigned to those value names. This way you'd be sure that the numbers were correct and that there weren't any constants missed. Which values are missing from the WindowsConstants.au3 file?

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <winapi.au3>
#include <constants.au3>
#include <WindowsConstants.au3>
Global $aStyles[26][2] = [[25],["WS_TILED", $WS_TILED],["WS_OVERLAPPED", $WS_OVERLAPPED], _
        ["WS_MAXIMIZEBOX", $WS_MAXIMIZEBOX],["WS_MINIMIZEBOX", $WS_MINIMIZEBOX],["WS_TABSTOP", $WS_TABSTOP], _
        ["WS_GROUP", $WS_GROUP],["WS_SIZEBOX", $WS_SIZEBOX],["WS_THICKFRAME", $WS_THICKFRAME], _
        ["WS_SYSMENU", $WS_SYSMENU],["WS_HSCROLL", $WS_HSCROLL],["WS_VSCROLL", $WS_VSCROLL], _
        ["WS_DLGFRAME", $WS_DLGFRAME],["WS_BORDER", $WS_BORDER],["WS_CAPTION", $WS_CAPTION], _
        ["WS_OVERLAPPEDWINDOW", $WS_OVERLAPPEDWINDOW],["WS_TILEDWINDOW", $WS_TILEDWINDOW],["WS_MAXIMIZE", $WS_MAXIMIZE], _
        ["WS_CLIPCHILDREN", $WS_CLIPCHILDREN],["WS_CLIPSIBLINGS", $WS_CLIPSIBLINGS],["WS_DISABLED", $WS_DISABLED], _
        ["WS_VISIBLE", $WS_VISIBLE],["WS_VISIBLE", $WS_VISIBLE],["WS_CHILD", $WS_CHILD], _
        ["WS_POPUP", $WS_POPUP],["WS_POPUPWINDOW", $WS_POPUPWINDOW]]
Global $aExStyles[20][2] = [[19],["WS_EX_ACCEPTFILES", $WS_EX_ACCEPTFILES],["WS_EX_MDICHILD", $WS_EX_MDICHILD], _
        ["WS_EX_APPWINDOW", $WS_EX_APPWINDOW],["WS_EX_COMPOSITED", $WS_EX_COMPOSITED], _
        ["WS_EX_CLIENTEDGE", $WS_EX_CLIENTEDGE],["WS_EX_CONTEXTHELP", $WS_EX_CONTEXTHELP], _
        ["WS_EX_DLGMODALFRAME", $WS_EX_DLGMODALFRAME],["WS_EX_LEFTSCROLLBAR", $WS_EX_LEFTSCROLLBAR], _
        ["WS_EX_OVERLAPPEDWINDOW", $WS_EX_OVERLAPPEDWINDOW],["WS_EX_RIGHT", $WS_EX_RIGHT], _
        ["WS_EX_STATICEDGE", $WS_EX_STATICEDGE],["WS_EX_TOOLWINDOW", $WS_EX_TOOLWINDOW], _
        ["WS_EX_TOPMOST", $WS_EX_TOPMOST],["WS_EX_TRANSPARENT", $WS_EX_TRANSPARENT], _
        ["WS_EX_WINDOWEDGE", $WS_EX_WINDOWEDGE],["WS_EX_LAYERED", $WS_EX_LAYERED], _
        ["WS_EX_CONTROLPARENT", $WS_EX_CONTROLPARENT],["WS_EX_LAYOUTRTL", $WS_EX_LAYOUTRTL], _
        ["WS_EX_RTLREADING", $WS_EX_RTLREADING]]

HotKeySet("^a", "_getwinstyle")
HotKeySet("{F11}", "_Exit")
While 1
    Sleep(100)
WEnd
Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _GetWindowStyles($hwnd)
    Local $aOriginalStyles[2] = [_WinAPI_GetWindowLong($hwnd, $GWL_style), _WinAPI_GetWindowLong($hwnd, $GWL_exstyle)]
    Return ($aOriginalStyles)
EndFunc   ;==>_GetWindowStyles

Func _getwinstyle()
    Local $sStyles = ""
    Local $sExStyles = ""
    Sleep(1000)
    $windowname = "[active]"
    $hwnd = WinGetHandle($windowname)
    $aReturn = _GetWindowStyles($hwnd)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aReturn = ' & hex($aReturn[0], 8) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    If IsArray($aReturn) Then
        For $i = 1 To $aStyles[0][0]
            If BitAND($aReturn[0], $aStyles[$i][1]) Then
                $sStyles &= $aStyles[$i][0] & @CRLF
            EndIf
        Next
        For $i = 1 To $aExStyles[0][0]
            If BitAND($aReturn[1], $aExStyles[$i][1]) Then
                ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aExStyles[$i][1] = ' & $aExStyles[$i][1] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
                $sExStyles &= $aExStyles[$i][0] & @CRLF
            EndIf
        Next
        MsgBox(0, "Styles", $sStyles)
        MsgBox(0, "ExStyles", $sExStyles)
    EndIf
EndFunc   ;==>_getwinstyle

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Ah, now I get you. Yeah, that's certainly something where one might make careless mistakes.

Now, for the missing constants: The MSDN lists a couple things like WS_EX_RIGHTSCROLLBAR, which cannot be found in WindowsConstants.au3. I'm not certain if that's got to do with it's value being 0x00000000 (zero), but there are such constants not just in WindowsConstants.au3, but in Constants.au3 as well, like $CDRF_DODEFAULT and $OBJID_window.

Link to comment
Share on other sites

I first thought of a relation of double the previous number and including the same values together, but there was a better way :P

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

I see what you're saying about the "missing" constants in the file. Fortunately for your script they wouldn't work anyways, because they are, as you said, equal to zero. They're the default values, so your script wouldn't pick them up, because they'll all show up as being equal to WS_TILED and/or WS_OVERLAPPED, probably only WS_TILED because it's the first one found that equals zero. As soon as you have 2 constants being equal to the same value, the script is probably going to choose them all or only the first one, I haven't looked at that part of the script much so I can't say for sure.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

But Enum still got me stumped.

#include <Constants.au3>

Example()

Func Example()
    ; Create variables in Local scope and enumerate through the variables. Default is to start from 0.
    Local Enum $eCat, $eDog, $eMouse, $eHamster ; $eHamster is equal to the value 3, not 4.

    ; Create an array in Local scope with 4 elements.
    Local $aAnimalNames[4]

    ; Assign each array element with the name of the respective animal. For example the name of the cat is Jasper.
    $aAnimalNames[$eCat] = 'Jasper' ; $eCat is equal to 0, similar to using $aAnimalNames[0]
    $aAnimalNames[$eDog] = 'Beethoven' ; $eDog is equal to 1, similar to using $aAnimalNames[1]
    $aAnimalNames[$eMouse] = 'Pinky' ; $eMouse is equal to 2, similar to using $aAnimalNames[2]
    $aAnimalNames[$eHamster] = 'Fidget' ; $eHamster is equal to 3, similar to using $aAnimalNames[3]

    ; Display the values of the array.
    MsgBox($MB_SYSTEMMODAL, '', '$aAnimalNames[$eCat] = ' & $aAnimalNames[$eCat] & @CRLF & _
            '$aAnimalNames[$eDog] = ' & $aAnimalNames[$eDog] & @CRLF & _
            '$aAnimalNames[$eMouse] = ' & $aAnimalNames[$eMouse] & @CRLF & _
            '$aAnimalNames[$eHamster] = ' & $aAnimalNames[$eHamster] & @CRLF)

    ; Sometimes using this approach for accessing an element is more practical than using a numerical value, due to the fact changing the index value of
    ; the enum constant has no affect on it's position in the array. Therefore changing the location of $eCat in the array is as simple as changing the order
    ; it appears in the initial declaration e.g.

    ; Local Enum $eDog, $eMouse, $eCat, $eHamster

    ; Now $eCat is the 2nd element in the array. If you were using numerical values, you would have to manually change all references of $aAnimalNames[0] to
    ; $aAnimalNames[2], as well as for the other elements which have now shifted.
EndFunc   ;==>Example
Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I've seen your example in a different thread already. I know how it works, I just don't know how Eval is supposed to help in my particular case.

You said Enum, not Eval.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I just don't know how Enum is supposed to help in my particular case.

You can see that there is an increment of double the previous, thats what I was pointing ;)
#include <winapi.au3>
#include <constants.au3>
#include <Array.au3>

Global $aStyles[19][2] = [["WS_MAXIMIZEBOX", "0x00010000"],["WS_MINIMIZEBOX", "0x00020000"],["WS_TABSTOP", "0x00010000"],["WS_GROUP", "0x00020000"], _
["WS_SIZEBOX", "0x00040000"],["WS_THICKFRAME", "0x00040000"],["WS_SYSMENU", "0x00080000"],["WS_HSCROLL", "0x00100000"],["WS_VSCROLL", "0x00200000"],["WS_DLGFRAME", "0x00400000"], _
["WS_BORDER", "0x00800000"],["WS_TILEDWINDOW", "0x00CF0000"],["WS_MAXIMIZE", "0x01000000"],["WS_CLIPCHILDREN", "0x02000000"], _
["WS_CLIPSIBLINGS", "0x04000000"],["WS_DISABLED", "0x08000000"],["WS_VISIBLE", "0x10000000"],["WS_MINIMIZE", "0x20000000"],["WS_CHILD", "0x40000000"]]


_getwinstyle($aStyles)
;Excluded
#cs

[0]|WS_TILED|WS_OVERLAPPED|0
[1]|WS_POPUP|-2147483648
[2]|WS_POPUPWINDOW|-2138570752
[15]|WS_CAPTION|12582912
[16]|WS_OVERLAPPEDWINDOW|13565952

#ce
Func _getwinstyle(ByRef $aArray)
For $i = 0 To UBound($aArray) - 1
$aArray[$i][1] = Number($aStyles[$i][1])
Next
_ArraySort($aArray, 0, 1, 0, 1)
_ArrayDisplay($aArray)
EndFunc   ;==>_getwinstyle

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

You said Enum, not Eval.

Sorry, my mistake. The part of my previous posting you quoted should have said Enum and was meant to be Enum in the context I used it in, but my fingers somehow converted Enum to Eval.

You can see that there is an increment of double the previous, thats what I was pointing ;)

I get that. Something like
Local Enum Step *2 $1 = 0x00000001, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30
MsgBox(0, "enum test", hex($1) & @CRLF & _
hex($2) & @CRLF & _
hex($3) & @CRLF & _
hex($4) & @CRLF & _
hex($5) & @CRLF & _
hex($6) & @CRLF & _
hex($7) & @CRLF & _
hex($8) & @CRLF & _
hex($9) & @CRLF & _
hex($10) & @CRLF & _
hex($11) & @CRLF & _
hex($12) & @CRLF & _
hex($13) & @CRLF & _
hex($14) & @CRLF & _
hex($15) & @CRLF & _
hex($16) & @CRLF & _
hex($17) & @CRLF & _
hex($18) & @CRLF & _
hex($19) & @CRLF & _
hex($20) & @CRLF & _
hex($21) & @CRLF & _
hex($22) & @CRLF & _
hex($23) & @CRLF & _
hex($24) & @CRLF & _
hex($25) & @CRLF & _
hex($26) & @CRLF & _
hex($27) & @CRLF & _
hex($28) & @CRLF & _
hex($29) & @CRLF & _
hex($30))

but it would still require me to manually compile a look up table carrying both, the constant name and the constant value. Frankly, I like the Eval approach better.

Link to comment
Share on other sites

But neither of those functions return correct results. Some constants are defined as bitwise OR-ed values of two or more basic constants. That's why you will get lots of incorrect results.

First you have to check for composite values (like WS_POPUPWINDOW or WS_OVERLAPPEDWINDOW or WS_CAPTION or DS_SHELLFONT or WS_EX_OVERLAPPEDWINDOW or WS_EX_PALETTEWINDOW) and if detected substract its value from the input before adding more styles strings.

ConsoleWrite("Style " & Hex($iStyle) & " : " & GetStyleString($iStyle) & @CRLF & _
        "ExStyle " & Hex($iExStyle) & " : " & GetExStyleString($iExStyle) & @CRLF)


Func GetStyleString($iStyle)
    Local $sStyle
    If BitAND($iStyle, 0x80880000) = 0x80880000 Then ; $WS_POPUPWINDOW
        $sStyle &= " WS_POPUPWINDOW |"
        $iStyle -= 0x80880000
    EndIf
    If BitAND($iStyle, 0x00CF0000) = 0x00CF0000 Then ; $WS_OVERLAPPEDWINDOW
        $sStyle &= " WS_OVERLAPPEDWINDOW |"
        $iStyle -= 0x00CF0000
    EndIf
    If BitAND($iStyle, 0x00C00000) = 0x00C00000 Then ; $WS_CAPTION
        $sStyle &= " WS_CAPTION |"
        $iStyle -= 0x00C00000
    EndIf
    If BitAND($iStyle, 0x00000048) = 0x00000048 Then ; $DS_SHELLFONT
        $sStyle &= " DS_SHELLFONT |"
        $iStyle -= 0x00000048
    EndIf
    If BitAND($iStyle, 0x80000000) Then $sStyle &= " WS_POPUP |" ; $WS_POPUP
    If BitAND($iStyle, 0x40000000) Then $sStyle &= " WS_CHILD/WS_CHILDWINDOW |" ; $WS_CHILD
    If BitAND($iStyle, 0x20000000) Then $sStyle &= " WS_MINIMIZE/WS_ICONIC |" ; $WS_MINIMIZE
    If BitAND($iStyle, 0x10000000) Then $sStyle &= " WS_VISIBLE |" ; $WS_VISIBLE
    If BitAND($iStyle, 0x08000000) Then $sStyle &= " WS_DISABLED |" ; $WS_DISABLED
    If BitAND($iStyle, 0x04000000) Then $sStyle &= " WS_CLIPSIBLINGS |" ; $WS_CLIPSIBLINGS
    If BitAND($iStyle, 0x02000000) Then $sStyle &= " WS_CLIPCHILDREN |" ; $WS_CLIPCHILDREN
    If BitAND($iStyle, 0x01000000) Then $sStyle &= " WS_MAXIMIZE |" ; $WS_MAXIMIZE
    If BitAND($iStyle, 0x00800000) Then $sStyle &= " WS_BORDER |" ; $WS_BORDER
    If BitAND($iStyle, 0x00400000) Then $sStyle &= " WS_DLGFRAME |" ; $WS_DLGFRAME
    If BitAND($iStyle, 0x00200000) Then $sStyle &= " WS_VSCROLL |" ; $WS_VSCROLL
    If BitAND($iStyle, 0x00100000) Then $sStyle &= " WS_HSCROLL |" ; $WS_HSCROLL
    If BitAND($iStyle, 0x00080000) Then $sStyle &= " WS_SYSMENU |" ; $WS_SYSMENU
    If BitAND($iStyle, 0x00040000) Then $sStyle &= " WS_SIZEBOX/WS_THICKFRAME |" ; $WS_SIZEBOX
    If BitAND($iStyle, 0x00020000) Then $sStyle &= " WS_MINIMIZEBOX |" ; $WS_MINIMIZEBOX
    If BitAND($iStyle, 0x00010000) Then $sStyle &= " WS_MAXIMIZEBOX |" ; $WS_MAXIMIZEBOX
    If BitAND($iStyle, 0x00008000) Then $sStyle &= " DS_WINDOWSUI |" ; $DS_WINDOWSUI
    If BitAND($iStyle, 0x00004000) Then $sStyle &= " 0x00004000 |" ; UNKNOWN STYLE
    If BitAND($iStyle, 0x00002000) Then $sStyle &= " DS_CONTEXTHELP |" ; $DS_CONTEXTHELP
    If BitAND($iStyle, 0x00001000) Then $sStyle &= " 0x00001000 |" ; UNKNOWN STYLE
    If BitAND($iStyle, 0x00000800) Then $sStyle &= " 0x00000800 |" ; UNKNOWN STYLE
    If BitAND($iStyle, 0x00000400) Then $sStyle &= " DS_CONTROL |" ; $DS_CONTROL
    If BitAND($iStyle, 0x00000200) Then $sStyle &= " DS_SETFOREGROUND |" ; $DS_SETFOREGROUND
    If BitAND($iStyle, 0x00000100) Then $sStyle &= " DS_NOIDLEMSG |" ; $DS_NOIDLEMSG
    If BitAND($iStyle, 0x00000080) Then $sStyle &= " DS_MODALFRAME |" ; $DS_MODALFRAME
    If BitAND($iStyle, 0x00000040) Then $sStyle &= " DS_SETFONT |" ; $DS_SETFONT
    If BitAND($iStyle, 0x00000020) Then $sStyle &= " DS_LOCALEDIT |" ; $DS_LOCALEDIT
    If BitAND($iStyle, 0x00000010) Then $sStyle &= " DS_NOFAILCREATE |" ; $DS_NOFAILCREATE
    If BitAND($iStyle, 0x00000008) Then $sStyle &= " DS_FIXEDSYS |" ; $DS_FIXEDSYS
    If BitAND($iStyle, 0x00000004) Then $sStyle &= " DS_3DLOOK |" ; $DS_3DLOOK
    If BitAND($iStyle, 0x00000002) Then $sStyle &= " DS_SYSMODAL |" ; $DS_SYSMODAL
    If BitAND($iStyle, 0x00000001) Then $sStyle &= " DS_ABSALIGN |" ; $DS_ABSALIGN
    Return StringTrimRight($sStyle, 1)
EndFunc

Func GetExStyleString($iExStyle)
    Local $sExStyle
    If BitAND($iExStyle, 0x00000300) = 0x00000300 Then ; $WS_EX_OVERLAPPEDWINDOW
        $sExStyle &= " WS_EX_OVERLAPPEDWINDOW |"
        $iExStyle -= 0x00000300
    EndIf
    If BitAND($iExStyle, 0x00000188) = 0x00000188 Then ; $WS_EX_PALETTEWINDOW
        $sExStyle &= " WS_EX_PALETTEWINDOW |"
        $iExStyle -= 0x00000188
    EndIf
    If BitAND($iExStyle, 0x08000000) Then $sExStyle &= " WS_EX_NOACTIVATE |" ; $WS_EX_NOACTIVATE
    If BitAND($iExStyle, 0x04000000) Then $sExStyle &= " 0x04000000 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x02000000) Then $sExStyle &= " WS_EX_COMPOSITED |" ; $WS_EX_COMPOSITED
    If BitAND($iExStyle, 0x01000000) Then $sExStyle &= " 0x01000000 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x00800000) Then $sExStyle &= " 0x00800000 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x00400000) Then $sExStyle &= " WS_EX_LAYOUTRTL |" ; $WS_EX_LAYOUTRTL
    If BitAND($iExStyle, 0x00200000) Then $sExStyle &= " 0x00200000 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x00100000) Then $sExStyle &= " WS_EX_NOINHERITLAYOUT |" ; $WS_EX_NOINHERITLAYOUT
    If BitAND($iExStyle, 0x00080000) Then $sExStyle &= " WS_EX_LAYERED |" ; $WS_EX_LAYERED
    If BitAND($iExStyle, 0x00040000) Then $sExStyle &= " WS_EX_APPWINDOW |" ; $WS_EX_APPWINDOW
    If BitAND($iExStyle, 0x00020000) Then $sExStyle &= " WS_EX_STATICEDGE |" ; $WS_EX_STATICEDGE
    If BitAND($iExStyle, 0x00010000) Then $sExStyle &= " WS_EX_CONTROLPARENT |" ; $WS_EX_CONTROLPARENT
    If BitAND($iExStyle, 0x00008000) Then $sExStyle &= " 0x00008000 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x00004000) Then $sExStyle &= " WS_EX_LEFTSCROLLBAR |" ; $WS_EX_LEFTSCROLLBAR
    If BitAND($iExStyle, 0x00002000) Then $sExStyle &= " WS_EX_RTLREADING |" ; $WS_EX_RTLREADING
    If BitAND($iExStyle, 0x00001000) Then $sExStyle &= " WS_EX_RIGHT |" ; $WS_EX_RIGHT
    If BitAND($iExStyle, 0x00000800) Then $sExStyle &= " 0x00000800 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x00000400) Then $sExStyle &= " WS_EX_CONTEXTHELP |" ; $WS_EX_CONTEXTHELP
    If BitAND($iExStyle, 0x00000200) Then $sExStyle &= " WS_EX_CLIENTEDGE |" ; $WS_EX_CLIENTEDGE
    If BitAND($iExStyle, 0x00000100) Then $sExStyle &= " WS_EX_WINDOWEDGE |" ; $WS_EX_WINDOWEDGE
    If BitAND($iExStyle, 0x00000080) Then $sExStyle &= " WS_EX_TOOLWINDOW |" ; $WS_EX_TOOLWINDOW
    If BitAND($iExStyle, 0x00000040) Then $sExStyle &= " WS_EX_MDICHILD |" ; $WS_EX_MDICHILD
    If BitAND($iExStyle, 0x00000020) Then $sExStyle &= " WS_EX_TRANSPARENT |" ; $WS_EX_TRANSPARENT
    If BitAND($iExStyle, 0x00000010) Then $sExStyle &= " WS_EX_ACCEPTFILES |" ; $WS_EX_ACCEPTFILES
    If BitAND($iExStyle, 0x00000008) Then $sExStyle &= " WS_EX_TOPMOST |" ; $WS_EX_TOPMOST
    If BitAND($iExStyle, 0x00000004) Then $sExStyle &= " WS_EX_NOPARENTNOTIFY |" ; $WS_EX_NOPARENTNOTIFY
    If BitAND($iExStyle, 0x00000002) Then $sExStyle &= " 0x00000002 |" ; UNKNOWN EXSTYLE
    If BitAND($iExStyle, 0x00000001) Then $sExStyle &= " WS_EX_DLGMODALFRAME |" ; $WS_EX_DLGMODALFRAME
    Return StringTrimRight($sExStyle, 1)
EndFunc

Edited by trancexx
Link to comment
Share on other sites

Frankly, I like the Eval approach better.

Indeed me too :)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

I just found out that WS_CAPTION contains 2 styles

Global $stl[24][2] = [[ _
        23, 23],[ _
        '0x00800000', 'WS_BORDER'],[ _
        '0x80000000', 'WS_POPUP'],[ _
        '0x00C00000', 'WS_CAPTION'],[ _
        '0x02000000', 'WS_CLIPCHILDREN'],[ _
        '0x04000000', 'WS_CLIPSIBLINGS'],[ _
        '0x08000000', 'WS_DISABLED'],[ _
        '0x00400000', 'WS_DLGFRAME'],[ _
        '0x00100000', 'WS_HSCROLL'],[ _
        '0x01000000', 'WS_MAXIMIZE'],[ _
        '0x00010000', 'WS_MAXIMIZEBOX, WS_TABSTOP'],[ _
        '0x20000000', 'WS_MINIMIZE'],[ _
        '0x00020000', 'WS_MINIMIZEBOX, WS_GROUP'],[ _
        '0x00000000', 'WS_OVERLAPPED'],[ _
        '0x00CF0000', 'WS_OVERLAPPEDWINDOW'],[ _
        '0x80880000', 'WS_POPUPWINDOW'],[ _
        '0x00080000', 'WS_SYSMENU'],[ _
        '0x00040000', 'WS_SIZEBOX, WS_THICKFRAME'],[ _
        '0x00200000', 'WS_VSCROLL'],[ _
        '0x10000000', 'WS_VISIBLE'],[ _
        '0x40000000', 'WS_CHILD'],[ _
        '0x00000080', 'DS_MODALFRAME'],[ _
        '0x00000200', 'DS_SETFOREGROUND'],[ _
        '0x00002000', 'DS_CONTEXTHELP']]
For $i = 1 To $stl[0][0]
    $stl[$i][0] = _ArrGetVal($stl[$i][0])
    If StringInStr($stl[$i][0], @LF) Then MsgBox(0, $stl[$i][1], $stl[$i][0])
Next

Func _ArrGetVal($Value)
    If $Value = 0 Then Return
    Local $sOut, $n = 0.5
    For $i = 0 To Int(Log($Value) / Log(2))
        $n *= 2
        If BitAND($Value, $n) Then $sOut &= '0x' & Hex(Int($n), 8) & @LF
        ; If BitAnd($Value, $n) Then $sOut&='0x'&StringFormat("%08x", $n) &@LF
        ; If BitAnd($Value, $n) Then $sOut&=StringFormat("%#x", $n) &@LF
    Next
    Return StringTrimRight($sOut, 1)
EndFunc
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...