dgm5555

Raw Input endstruct query?

5 posts in this topic

#1 ·  Posted (edited)

Just looking at the raw input functions

If I do this:-

 ConsoleWrite($tagRAWINPUTMOUSE & @CRLF)

I get:

 ; struct;dword Type;dword Size;handle hDevice;wparam wParam;endstruct;ushort Flags;ushort Alignment;ushort ButtonFlags;ushort ButtonData;ulong RawButtons;long LastX;long LastY;ulong ExtraInformation;
 

I don't understand why "endstruct" isn't at the end? (although I presume it's correct as its the same in the help file)

 

The relevant code in WinAPISys.au3 is:-

#region Global Variables and Constants

; #CONSTANTS# ===================================================================================================================
Global Const $tagOSVERSIONINFOEX = $tagOSVERSIONINFO & ';ushort ServicePackMajor;ushort ServicePackMinor;ushort SuiteMask;byte ProductType;byte Reserved'
Global Const $tagRAWINPUTDEVICE = 'struct;ushort UsagePage;ushort Usage;dword Flags;hwnd hTarget;endstruct'
Global Const $tagRAWINPUTHEADER = 'struct;dword Type;dword Size;handle hDevice;wparam wParam;endstruct'
Global Const $tagRAWMOUSE = 'ushort Flags;ushort Alignment;ushort ButtonFlags;ushort ButtonData;ulong RawButtons;long LastX;long LastY;ulong ExtraInformation;'
Global Const $tagRAWKEYBOARD = 'ushort MakeCode;ushort Flags;ushort Reserved;ushort VKey;ushort;uint Message;ulong ExtraInformation;'
Global Const $tagRAWHID = 'dword SizeHid;dword Count;' ; & 'byte RawData[n];'
Global Const $tagRAWINPUTMOUSE = $tagRAWINPUTHEADER & ';' & $tagRAWMOUSE
Global Const $tagRAWINPUTKEYBOARD = $tagRAWINPUTHEADER & ';' & $tagRAWKEYBOARD
 

Also incidentally I think there is a typo in the APISysConstants.au3:  ; _WinAPI_*RowInput*() should read RawInput

 

 

 

Edited by dgm5555

Share this post


Link to post
Share on other sites



In DllStruct parlance, the struct; ... endstruct construct (no pun) is used to force correct alignment (padding) of C-style structures as members of an outer C-style structure. See help under DllStructCreate.

You could achieve the same effect by using an "align N" directive after the last member of the inner struct but N would then need to depend on OS architecture, a painful coding inconvenience to work around.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
On 9/1/2017 at 11:15 PM, dgm5555 said:

I think there is a typo in the APISysConstants.au3:  ; _WinAPI_*RowInput*() should read RawInput

Yes, but that line is commented out so it doesn't matter.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Share this post


Link to post
Share on other sites

About typos, these ones could be fixed - by adding the trailing 't'  :)

(WinAPISys.au3)

Global Const $tagRID_DEVICE_INFO_MOUSE = 'struct;dword Id;dword NumberOfButtons;dword SampleRate;int HasHorizontalWheel;endstruc'
Global Const $tagRID_DEVICE_INFO_KEYBOARD = 'struct;dword KbType;dword KbSubType;dword KeyboardMode;dword NumberOfFunctionKeys;dword NumberOfIndicators;dword NumberOfKeysTotal;endstruc'
Global Const $tagRID_DEVICE_INFO_HID = 'struct;dword VendorId;dword ProductId;dword VersionNumber;ushort UsagePage;ushort Usage;endstruc'

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

On 9/3/2017 at 2:10 AM, careca said:

Yes, but that line is commented out so it doesn't matter.

@careca: I only mentioned because I was initially searching for the text and it didn't highlight. HOWEVER:-

@mikell THANKS!!!!!! you were right, the errors in the autoit core code were the cause of my problems in my other HID post (which cost me quite a few wasted hours trying various mutations of code!!

@jchd thanks for the explanation, I think I might have to read around a bit more about memory allocation, as I wouldn't have expected padding to be required in the middle of a data packet.

 

Edited by dgm5555

Share this post


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