Page 1 of 1

Verifier - Size of Data Types and Constant Values

Posted: 03 May 2017, 15:29
by Alguimist
Image

Usage: enter the name of a data type or constant declared in a header file.
Examples: DWORD, TBYTE, LVM_GETHEADER (requires commctrl.h), etc.

Set compiler and platform before defining the compiler path.

Windows SDK or Visual Studio
Compiler path: path to CL.EXE. Example:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe

Batch file: path to VCVARS32.BAT or VCVARS64.BAT or VCVARSX86_AMD64.BAT. Example:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat

MinGW, TDM-GCC
Compiler path: path to GCC.EXE. Example:
C:\Dev-Cpp\bin\gcc.exe

Batch file: only required if the gcc.exe directory is not in the PATH.

Another tool, Structor, is more appropriate for information about structures (size and offsets).

Credits
Thanks to the authors of AHK-SizeOf-Checker and StdoutToVar.

:arrow: Download (AutoGUI tools)

Re: Size Checker - Check the Size of Structures and Data Types

Posted: 04 May 2017, 01:05
by jNizM
Looks great =)
Since I used a sizeof checker too, I added 1 more line because I got some probs with calc size on unicode

Code: Select all

; some code

; create sizeof.cpp
code := ((A_IsUnicode) ? "#define UNICODE 1`n" : "")    ; <--
     . "#include ..."
; some code[

Re: Size Checker - Check the Size of Structures and Data Types

Posted: 04 May 2017, 04:48
by Alguimist
Thanks, jNizM ;)

Update (version 1.1.0): this tool can also be used to check the offset of structure members and value of constants.
Examples: MSG.time, OPENFILENAME.Flags, WM_USER, TB_AUTOSIZE.

Re: Size Checker - Check the Size of Structures and Data Types

Posted: 04 May 2017, 05:42
by jNizM
2 more tips:

EM_SETCUEBANNER
Use EM_SETCUEBANNER with wParam 1 not 0
DllCall("SendMessage", "Ptr", handle, "UInt", 0x1501, "Ptr", 1, "WStr", Text) last Ptr can be removed since the return is bool
TRUE if the cue banner should show even when the edit control has focus; otherwise, FALSE. FALSE is the default behavior—the cue banner disappears when the user clicks in the control.
Buttons on white Gui's
To remove the grey border around the buttons border you can use this CtlColorBtns (thx to just me)

Re: Size Checker - Check the Size of Structures and Data Types

Posted: 27 May 2017, 04:37
by Drugwash
jNizM wrote:Buttons on white Gui's
To remove the grey border around the buttons border you can use this CtlColorBtns (thx to just me)
That script leaks handles. According to the remarks for CreateSolidBrush():
MSDN wrote:When you no longer need the HBRUSH object, call the DeleteObject function to delete it.
Moreover, color should be manually changed for different window background colors - cumbersome. What about backgrounds made of pattern brush or image?

However, using GetStockObject() with NULL_BRUSH as parameter would avoid handle leaks and suit any window color/pattern/image:
MSDN wrote:It is not necessary (but it is not harmful) to delete stock objects by calling DeleteObject.

Code: Select all

; GLOBAL SETTINGS ===============================================================================================================

#NoEnv
#SingleInstance Force
SetBatchLines -1

; GUI ===========================================================================================================================

Gui, +LastFound
Gui, Margin, 10, 10
Gui, Color, AA88FF
Gui, Add, Radio, w100 vRB1, Radio1
Gui, Add, Radio, xm y+10 w100 vRB2, Radio2
Gui, Add, CheckBox, w100 vCB, CheckBox
Gui, Add, Edit, xm w100 h30
Gui, Add, Button, xm y+2 w100 vPB, Button
Gui, Show, w200 h200
WinSet, Redraw
return

; FUNCTIONS =====================================================================================================================

CtlColorBtns()
{
    static init := OnMessage(0x0135, "CtlColorBtns")
    return DllCall("GetStockObject", "uint", 5, "uptr")
}

; EXIT ==========================================================================================================================

GuiClose:
GuiEscape:
ExitApp

Re: Verifier - Size of Data Types and Constant Values

Posted: 06 Apr 2018, 06:36
by Alguimist
Note: Size Checker was renamed to Verifier.