Page 1 of 2

Windows Data Types for AHK

Posted: 05 May 2015, 06:34
by jNizM
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)

Re: Windows Data Types for AHK

Posted: 05 May 2015, 08:12
by Coco-guest
Thanks :D

Re: Windows Data Types for AHK

Posted: 05 May 2015, 10:31
by tmplinshi
Thanks :D

Re: Windows Data Types for AHK

Posted: 30 May 2015, 19:43
by The X
Nice tyvm

Re: Windows Data Types for AHK

Posted: 17 Jul 2015, 09:29
by evilC
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?

Re: Windows Data Types for AHK

Posted: 25 Jul 2015, 01:27
by tmplinshi
@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

Re: Windows Data Types for AHK

Posted: 25 Jul 2015, 05:21
by evilC
jnizm has already added my suggestion to his code - I tested a beta version for him with this and some other enhancements in it.

Has he not released it yet?

Re: Windows Data Types for AHK

Posted: 25 Jul 2015, 05:26
by tmplinshi
Seems not.

Re: Windows Data Types for AHK

Posted: 25 Jul 2015, 08:15
by evilC
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.

Re: Windows Data Types for AHK

Posted: 25 Jul 2015, 11:30
by tmplinshi
Thanks. Good idea to use hotkey.

Re: Windows Data Types for AHK

Posted: 25 Jul 2015, 17:59
by jballi
I just found this. Late to the game as usual. Looks useful. Thanks.

Re: Windows Data Types for AHK

Posted: 25 May 2016, 01:37
by jNizM
Added References and useful links.
If you got more, let me know and I will add them.

Re: Windows Data Types for AHK

Posted: 01 Dec 2018, 15:28
by swagfag
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?

Re: Windows Data Types for AHK

Posted: 02 Dec 2018, 18:46
by jeeswg
- 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

Re: Windows Data Types for AHK

Posted: 02 Dec 2018, 18:49
by swagfag
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?

Re: Windows Data Types for AHK

Posted: 02 Dec 2018, 19:00
by jeeswg
- 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.

Re: Windows Data Types for AHK

Posted: 05 Dec 2018, 04:56
by Helgef
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.

Re: Windows Data Types for AHK

Posted: 06 Dec 2018, 11:12
by iseahound
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.

Re: Windows Data Types for AHK

Posted: 05 Nov 2019, 00:25
by tmplinshi
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

Re: Windows Data Types for AHK

Posted: 05 Nov 2019, 18:56
by rommmcek
Nice, both tweaks improve a bit the online version too.