Assoc function

Requires: GfaWinx.lg32
Requires: shlwapi.inc

Purpose

Assoc is a wrapper for the AssocQueryString API which retrieves a file association-related string from the registry.

Syntax

a$ = Assoc(file$ [,assocstr%])

a$, file$: string expressions
assocstr%: integer expression

Description

By default Assoc returns the full path of the executable for a file or for an extension (or ProgID and CLSID). By passing a different value for assocstr% other properties of the file can be obtained. Gfawinx does not define the constants used in AssocQueryString, but shlwapi.inc does. After including shlwapi.inc the following constants can be used:

Example

$Library "gfawinx"

$Library "shlwapi.inc"

Debug.Show

Trace Assoc(".txt")

Trace Assoc(".txt", ASSOCSTR_FRIENDLYAPPNAME)

Displays something like this:

TRACE:(1):Assoc(".txt") = D:\Develop\notepad2\Notepad2.exe
TRACE:(2):Assoc(".txt", ASSOCSTR_FRIENDLYAPPNAME) = Notepad2

{Created by Sjouke Hamstra; Last updated: 09/05/2020 by James Gaite}