※ IDispatchインターフェースやWinRT(Windows8以上)のIInspectableインターフェースについては説明していません

HSP3のCOMのメソッドインデックスの取得方法(とっさの思いつき)

取得した情報があっているかどうか確認するため、
http://chokuto.ifdef.jp/urawaza/com/iidexplorer.html
と比較します。

今回は
IShellLinkA インターフェース
を取得してみます。
あらかじめ、Platform SDKはインストールしておいてください。
(インストールしたパスも調べておいてください。Includeまでのパスが必要です。)
※私の環境だと『D:\Program Files\Microsoft Platform SDK\Include』

1.スタートメニューから検索をクリック



2.以下の画像を参考に検索をかけます。


3.検索結果はこうなりましたが、大抵Objと書いてあるほうを使います。


4.メモ帳などで開きます。IID_IShellLinkAで検索をかけます。

5.検索結果

この場合「GetPath」とあるのが3番目のメソッドインデックスです。「GetIDList」が4番目・・・てな感じです。
・・・ちょっと待て!0〜2はどこに行ったって?
IShellLinkA」は「IUnknown」から継承しているので、0から2は以下のようになります。

QueryInterface 0
AddRef 1
Release 2

まとめるとこんな感じ
http://chokuto.ifdef.jp/urawaza/com/iidexplorer.html
と同じ結果になったはずです。

#define IID_IShellLinkA "{000214EE-0000-0000-C000-000000000046}"
#define IShellLinkA_QueryInterface 0
#define IShellLinkA_AddRef 1
#define IShellLinkA_Release 2
#define IShellLinkA_GetPath 3
#define IShellLinkA_GetIDList 4
#define IShellLinkA_SetIDList 5
#define IShellLinkA_GetDescription 6
#define IShellLinkA_SetDescription 7
#define IShellLinkA_GetWorkingDirectory 8
#define IShellLinkA_SetWorkingDirectory 9
#define IShellLinkA_GetArguments 10
#define IShellLinkA_SetArguments 11
#define IShellLinkA_GetHotkey 12
#define IShellLinkA_SetHotkey 13
#define IShellLinkA_GetShowCmd 14
#define IShellLinkA_SetShowCmd 15
#define IShellLinkA_GetIconLocation 16
#define IShellLinkA_SetIconLocation 17
#define IShellLinkA_SetRelativePath 18
#define IShellLinkA_Resolve 19
#define
IShellLinkA_SetPath 20