Windows Data Types for AHK

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Windows Data Types for AHK

05 May 2015, 06:34

Windows Data Types for AHK
Translated MSDN Types for DllCall's in AutoHotkey

Source
AutoHotkey_MSDN_Types (GitHub)

Features
- Offline Version: Pro (Faster than the online version) | Con (Must be updated manually)
- Online Version: Pro (Downloaded every time the latest translation) | Con (Slower than the offline version)

Screenshots
- After starting
Image
- After search something (like LP...)
Image

Info
- Version: v0.2
- URL AHK Thread

Changelog
- 0.2 | Small fixes
- 0.1 | First Release

Contributing
- special thanks to just me
- thanks to AutoHotkey Community

Copyright and License
Unlicense

References and useful links
- Header Annotations
- Windows Data Types
- Data Type Ranges
- Large Integers
- Windows Coding Conventions
- What Is a Window?
- Structure Alignment

Programming Guide for 64-bit Windows
- The New Data Types
- Rules for Using Pointers

Please report any kind of bugs (Script, Gui or Type translation)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Windows Data Types for AHK

05 May 2015, 10:31

Thanks :D
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Windows Data Types for AHK

17 Jul 2015, 09:29

Extremely useful! Thankyou!

May I make a suggestion?
How about a checkbox or something to control matching behavior?

For example, if you type UINT, it shows PUINT etc.
A checkbox to state that the match much start with what you typed would enable you to find the correct datatype quicker, and may also speed up searches.

[Edit]
Also, could you maybe have it ignore trailing spaces?
If you double click a definition on MSDN and copy / paste, you end up with trailing spaces.

For example, on this page, if I double click the word UINT and CTRL+C, you get UINT plus 15 spaces afterwards.

[Yet another Edit]
Also, how about a hotkey, that when you hit it, it copies the selected text and puts it in the search box?
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Windows Data Types for AHK

25 Jul 2015, 01:27

@evilC
Your suggestion is exactly what I needed too. :)
I made these changes:

Code: Select all

Added:
    - "Contains" checkbox.
    - Double-click cell to copy text.
    - Auto select text in edit box when focused.
    - "Always On Top" checkbox.
Modified:
    - Trim keyword, etc...
Source: https://gist.github.com/tmplinshi/cedaf22f1de666539886
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Windows Data Types for AHK

25 Jul 2015, 05:26

Seems not.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Windows Data Types for AHK

25 Jul 2015, 08:15

The version I tested was

https://dl.dropboxusercontent.com/u/406 ... _Types.ahk

He also added some hotkeys to copy what was selected and strip spaces - if you double-click a datatype column in an MSDN definition , you select the whole space-padded column.
I think he was also working on a hotkey such that if you hit it, it pasted the best (ie shortest match) answer straight into your text editor - so you don't even have to have the app visible to use it.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Windows Data Types for AHK

25 Jul 2015, 11:30

Thanks. Good idea to use hotkey.
User avatar
jballi
Posts: 723
Joined: 29 Sep 2013, 17:34

Re: Windows Data Types for AHK

25 Jul 2015, 17:59

I just found this. Late to the game as usual. Looks useful. Thanks.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Windows Data Types for AHK

25 May 2016, 01:37

Added References and useful links.
If you got more, let me know and I will add them.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Windows Data Types for AHK

01 Dec 2018, 15:28

damn, how do i find out about this only just now. this should be linked to from the docs or something.
anyway, what are the alternatives for? whats the upshot of just using the AHK Type all the time, everywhere?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Windows Data Types for AHK

02 Dec 2018, 18:46

- Hello swagfag, I'm unsure what you're asking. I find this kind of info useful for translating the hundreds of types listed on MSDN for Winapi functions and structs, and converting them to the AHK type for use with DllCall and structs. You can also get size/sign info via Visual Studio.

- HotKeyIt keeps a very good list of parameter information, and here are 2 other links where I check and use that list. Cheers.

WinApi
https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
C++: DllCall: get parameter types/sizes - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 23&t=39426
DllCall converter/cleaner (e.g. x32 to x64/x32 two-way compatible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=31365
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Windows Data Types for AHK

02 Dec 2018, 18:49

Ex, LPSTR can be Ptr or alternatively Str, as per this list. So does it make any difference if one were to use the first type, Ptr, all the time everywhere?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Windows Data Types for AHK

02 Dec 2018, 19:00

- You can use Ptr,&var or Str,var, they're generally interchangeable.
- IIRC Str has the advantage of resolving the data to a string for you, otherwise you might need to use VarSetCapacity(var, -1).
- In some situations you need to be careful that a parameter can be both written to and read from, I can't remember if this affects Ptr/Str.
- Maybe there are times when the string could have multiple null characters in it, so you'd have to use Ptr.
- Also, using AStr or WStr can be more convenient than StrPut and Ptr.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Windows Data Types for AHK

05 Dec 2018, 04:56

Nice script :thumbup: .
So does it make any difference if one were to use the first type, Ptr, all the time everywhere?
Assuming the list is correct, you can always use the first and second type, as long as you pass an argument which matches the type. You can read about the types in dllcall -> Types of Arguments and Return Values.

Cheers.
iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Windows Data Types for AHK

06 Dec 2018, 11:12

Thanks! If possible, can this list be included in the help file for DllCall? It would make translation of Windows API calls much easier for everyone.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Windows Data Types for AHK

05 Nov 2019, 00:25

Every time I use the script (offline version), the listview loading time really bugs me.. So I took a look at the script again, and found the reason.
loop, parse, MSDN_TYPES, `n, `r
{
MSDN_TYPES_ARR := StrSplit(A_LoopField, ",")
LV_Add("", MSDN_TYPES_ARR[1], MSDN_TYPES_ARR[2], MSDN_TYPES_ARR[3], MSDN_TYPES_ARR[4]), LV_ModifyCol(1, "Sort")
}
LV_ModifyCol(1, "Sort") should be outside the Loop.

Disable ListView redrawing can helps too.

Code: Select all

GuiControl, -Redraw, LVData
[ Adding a lot of data to ListView.. ]
GuiControl, +Redraw, LVData
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Windows Data Types for AHK

05 Nov 2019, 18:56

Nice, both tweaks improve a bit the online version too.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: ntepa, sanmaodo and 79 guests