Viewing the IDL file
A simple way to determine the DISPID for a method or parameter is to view the IDL file.
The following is an excerpt from the IDL file for the included sample component, NxfSvr. The DISPID corresponds to the identification number in the square brackets above the method or property.
Note: There are no
properties shown here.
interface INxf : IDispatch{
[id(1), helpstring("Open the File")]
HRESULT OpenFile([in, string] BSTR File);
[id(2), helpstring("Close current file (called automatically when object
is destroyed)")]
HRESULT CloseFile();
[id(3), helpstring("Retrieve data associated with Key")]
HRESULT GetEntry([in, string] BSTR Key, [out, retval] BSTR* Data);
[id(4), helpstring("Add a new entry named Key")]
HRESULT AddEntry([in, string] BSTR Key, [in, string] BSTR Data);
[id(5), helpstring("Retrieve count of entries")]
HRESULT GetEntryCount([out, retval] long* Count);
[id(6), helpstring("Get name of entry (Key) by integer index")]
HRESULT GetEntryName([in] long Entry, [out, retval] BSTR* Name);
[id(7), helpstring("Delete entry associated with Key")]
HRESULT DeleteEntry([in, string] BSTR Key);
[id(8), helpstring("Call after numerous adds and deletes")]
HRESULT PackFile([in, string] BSTR File);
[id(9), helpstring("Get entry identifed by Key from File")]
HRESULT GetFileEntry([in, string] BSTR File, [in, string] BSTR Key, [in,
out] VARIANT* Data);
};