Jump to content

DllStructEx - Extended DllStruct for AutoIt3


Recommended Posts

Ever needed C style nested structs, unions or easy pointer references in your DllStruct?

Then this may be your solution!

It also comes with some quality of life functions for better debugging, like being able to get the original string you used when creating the struct.

Download: v1.0.1 or DllstructEx.au3

Example:

#include "DllStructEx.au3"

$tagINPUT_RECORD = _
"WORD  EventType;"& _
"union {"& _
"    KEY_EVENT_RECORD          KeyEvent;"& _
"    MOUSE_EVENT_RECORD        MouseEvent;"& _
"    WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;"& _
"    MENU_EVENT_RECORD         MenuEvent;"& _
"    FOCUS_EVENT_RECORD        FocusEvent;"& _
"} Event;"

$tagKEY_EVENT_RECORD = _
"BOOL  bKeyDown;"& _
"WORD  wRepeatCount;"& _
"WORD  wVirtualKeyCode;"& _
"WORD  wVirtualScanCode;"& _
"union {"& _
"  WCHAR UnicodeChar;"& _
"  CHAR  AsciiChar;"& _
"} uChar;"& _
"DWORD dwControlKeyState;"

$tagMOUSE_EVENT_RECORD = _
"COORD dwMousePosition;" & _
"DWORD dwButtonState;" & _
"DWORD dwControlKeyState;" & _
"DWORD dwEventFlags;"

$tagCOORD = _
"SHORT X;"& _
"SHORT Y;"

$tagWINDOW_BUFFER_SIZE_RECORD = _
"COORD dwSize;"

$tagMENU_EVENT_RECORD = _
"UINT dwCommandId;"

$tagFOCUS_EVENT_RECORD = _
"BOOL bSetFocus;"

$oINPUT_RECORD = DllStructExCreate($tagINPUT_RECORD)
$oINPUT_RECORD.EventType = 0x0010 ;FOCUS_EVENT
$oINPUT_RECORD.Event.FocusEvent.bSetFocus = 1
$tINPUT_RECORD = DllStructExGetStruct($oINPUT_RECORD)
;...

Note: the example will be updated to show it working with the ReadConsoleInput and WriteConsoleInput soon.

For debugging, DllStructEx.debug.dll can be used, and feedback for missing debug features is welcome :)

Edited by genius257
version bump
Link to post
Share on other sites

Getting an error when executing Example.au3:

123
321
DllStructEx\Example.au3" (55) : ==> The requested action with this object has failed.:
$tKEY_EVENT_RECORD = DllStructExGetStruct($txINPUT_RECORD.Event.KeyEvent)
$tKEY_EVENT_RECORD = DllStructExGetStruct($txINPUT_RECORD.Event^ ERROR

 

Interesting approach.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites
36 minutes ago, UEZ said:

Getting an error when executing Example.au3

Hi @UEZ :)

Sorry it was a mistake on my part, not running my example code before release 😖

It should be fixed in version 1.0.1

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...