比如:
InvokeHelper(DISPID_REFRESH, DISPATCH_METHOD, VT_EMPTY, NULL, NULL)
帮帮忙,可以吗?
void CActiveMovie3::Run() { InvokeHelper(0x60020001, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } |
{ InvokeHelper(0x60020002, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } |
{ InvokeHelper(0x60020003, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } |
{ CString result; InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); return result; } |
{ static BYTE parms[] = VTS_BSTR; InvokeHelper(0xb, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, lpszNewValue); } |
{ double result; InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); return result; } |
{ static BYTE parms[] = VTS_R8; InvokeHelper(0xd, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue); } |
{ long result; InvokeHelper(0x13, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } |
{ static BYTE parms[] = VTS_I4; InvokeHelper(0x13, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } |
{ static BYTE parms[] = VTS_BOOL; InvokeHelper(0x28, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue); } |
void InvokeHelper( DISPID dwDispID, WORD wFlags, VARTYPE vtRet, void* pvRet, const BYTE FAR* pbParamInfo, ... );
throw( COleException );
throw( COleDispatchException );
Parameters
dwDispID
Identifies the method or property to be invoked. This value is usually supplied by ClassWizard.
wFlags
Flags describing the context of the call to IDispatch::Invoke. For possible values, see the Platform SDK.
vtRet
Specifies the type of the return value. For possible values, see the Remarks section.
pvRet
Address of the variable that will receive the property value or return value. It must match the type specified by vtRet.
pbParamInfo
Pointer to a null-terminated string of bytes specifying the types of the parameters following pbParamInfo.
...
Variable list of parameters, of types specified in pbParamInfo.
Remarks
Calls the object method or property specified by dwDispID, in the context specified by wFlags. The pbParamInfo parameter specifies the types of the parameters passed to the method or property. The variable list of arguments is represented by ... in the syntax declaration.
Possible values for the vtRet argument are taken from the VARENUM enumeration. Possible values are as follows:
Symbol | Return Type |
VT_EMPTY | void |
VT_I2 | short |
VT_I4 | long |
VT_R4 | float |
VT_R8 | double |
VT_CY | CY |
VT_DATE | DATE |
VT_BSTR | BSTR |
VT_DISPATCH | LPDISPATCH |
VT_ERROR | SCODE |
VT_BOOL | BOOL |
VT_VARIANT | VARIANT |
VT_UNKNOWN | LPUNKNOWN |
The pbParamInfo argument is a space-separated list of VTS_ constants. One or more of these values, separated by spaces (not commas), specifies the function’s parameter list. Possible values are listed with the EVENT_CUSTOM macro.
This function converts the parameters to VARIANTARG values, then invokes the IDispatch::Invoke method. If the call to Invoke fails, this function will throw an exception. If the SCODE (status code) returned by IDispatch::Invoke is DISP_E_EXCEPTION, this function throws a COleException object; otherwise it throws a COleDispatchException.
For more information, see VARIANTARG, IDispatch, IDispatch::Invoke, and Structure of COM Error Codes in the Platform SDK.