Based on a specific use case of the AssocQueryString function.
Searches for and retrieves the default icon for a provided extension and returns a handle to the icon to be used in a picture control or the string to the associated icon path.
More info at MSDN
fExt
- File extension to work on with optional.
in front e.g.: ahk or .ahkgetHandle
- instruct the function to either return the handle to a resource or the string to the default executable file
- A Handle to an icon resource (Default)
- A string to the default executable and icon number for the extension
The period is optional when passing the extension
MsgBox GetDefaultIcon("ahk")
MsgBox GetDefaultIcon(".ahk")
You can get the path to the default application associated with the extension as well
for ext in ["ahk", ".html", ".bat", "vbs", ".dll"]
strings .= GetDefaultIcon(ext, false) '`n'
MsgBox strings