Popular Post genius257 Posted June 10, 2021 Popular Post Share Posted June 10, 2021 (edited) 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.1.0 or DllstructEx.au3 Example: expandcollapse popup#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.au3 can be used, and feedback for missing debug features is welcome Edited August 1, 2022 by genius257 version bump funkey, Gianni, UEZ and 4 others 7 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
UEZ Posted June 10, 2021 Share Posted June 10, 2021 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 comment Share on other sites More sharing options...
genius257 Posted June 10, 2021 Author Share Posted June 10, 2021 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 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
UEZ Posted June 10, 2021 Share Posted June 10, 2021 The example works now properly. Thx. 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 comment Share on other sites More sharing options...
genius257 Posted July 27, 2022 Author Share Posted July 27, 2022 Version 1.1.0 released! Most important change is a fix to the byte padding, that previously made DllStructEx useless with unions and nested structs with external calls! 🎊 argumentum 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
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