问题?
请问朋友InvokeHelper()函数的是怎么用法的?里面的参数都代表怎么意思来得?<BR>比如:<BR>InvokeHelper(DISPID_REFRESH, DISPATCH_METHOD, VT_EMPTY, NULL, NULL)<BR>帮帮忙,可以吗?[em08]<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>void CActiveMovie3::Run()<BR>{<BR> InvokeHelper(0x60020001, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);<BR>}<BR></TD></TR></TABLE><BR> 2、暂停播放的函数: void CActiveMovie3::Pause()<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> InvokeHelper(0x60020002, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);<BR>}</TD></TR></TABLE><BR> 4、停止播放的函数: void CActiveMovie3::Stop()<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> InvokeHelper(0x60020003, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); <BR>}</TD></TR></TABLE><BR> 5、获得文件的函数: CString CActiveMovie3::GetFileName()<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> CString result;<BR> InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);<BR> return result;<BR>}</TD></TR></TABLE><BR> 6、设置文件的函数: void CActiveMovie3::SetFileName(LPCTSTR lpszNewValue)<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> static BYTE parms[] = VTS_BSTR;<BR> InvokeHelper(0xb, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,<BR> lpszNewValue);<BR>}</TD></TR></TABLE><BR> 7、获得播放位置的函数: double CActiveMovie3::GetCurrentPosition()<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> double result;<BR> InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL);<BR> return result;<BR>}</TD></TR></TABLE><BR> 8、设置播放位置的函数: void CActiveMovie3::SetCurrentPosition(double newValue)<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> static BYTE parms[] = VTS_R8;<BR> InvokeHelper(0xd, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);<BR>} </TD></TR></TABLE><BR> 9、获得音量的函数: long CActiveMovie3::GetVolume()<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> long result;<BR> InvokeHelper(0x13, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);<BR> return result;<BR>}</TD></TR></TABLE><BR> 10、设置音量的函数: void CActiveMovie3::SetVolume(long nNewValue)<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> static BYTE parms[] = VTS_I4;<BR> InvokeHelper(0x13, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue);<BR>}</TD></TR></TABLE><BR> 11、设置自动开始播放的函数: void CActiveMovie3::SetAutoStart(BOOL bNewValue)<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TR>
<TD>{<BR> static BYTE parms[] = VTS_BOOL;<BR> InvokeHelper(0x28, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue);<BR>}</TD></TR></TABLE> <FONT face=Verdana size=2> </FONT>
<H1>COleDispatchDriver::InvokeHelper</H1>
<P><B>void</B> <B>InvokeHelper(</B> <B>DISPID</B> <I>dwDispID</I><B>,</B> <B>WORD</B> <I>wFlags</I><B>,</B> <B>VARTYPE</B> <I>vtRet</I><B>,</B> <B>void*</B> <I>pvRet</I><B>,</B> <B>const</B> <B>BYTE</B> <B>FAR*</B> <I>pbParamInfo</I><B>,</B> <I>...</I> <B>);</B><BR><B>throw( COleException );</B><BR><B>throw( COleDispatchException );</B></P>
<P><B>Parameters</B></P>
<P><I>dwDispID</I></P>
<P>Identifies the method or property to be invoked. This value is usually supplied by ClassWizard.</P>
<P><I>wFlags</I></P>
<P>Flags describing the context of the call to
<OBJECT><PARAM><PARAM><PARAM></OBJECT><a>IDispatch::Invoke</A>. For possible values, see the <I>Platform SDK</I>.</P>
<P><I>vtRet</I></P>
<P>Specifies the type of the return value. For possible values, see the Remarks section.</P>
<P><I>pvRet</I></P>
<P>Address of the variable that will receive the property value or return value. It must match the type specified by <I>vtRet</I>.</P>
<P><I>pbParamInfo</I></P>
<P>Pointer to a null-terminated string of bytes specifying the types of the parameters following <I>pbParamInfo</I>.</P>
<P><I>...</I></P>
<P>Variable list of parameters, of types specified in <I>pbParamInfo</I>.</P>
<P><B>Remarks</B></P>
<P>Calls the object method or property specified by <I>dwDispID</I>, in the context specified by <I>wFlags</I>. The <I>pbParamInfo</I> parameter specifies the types of the parameters passed to the method or property. The variable list of arguments is represented by <B>...</B> in the syntax declaration.</P>
<P>Possible values for the <I>vtRet</I> argument are taken from the <B>VARENUM</B> enumeration. Possible values are as follows:</P>
<TABLE cols=2 cellPadding=5 rules=rows border=1 frame=below>
<TR vAlign=top>
<TD class=label width="34%"><B>Symbol</B></TD>
<TD class=label width="66%"><B>Return Type</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_EMPTY</B></TD>
<TD width="66%"><B>void</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_I2</B></TD>
<TD width="66%"><B>short</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_I4</B></TD>
<TD width="66%"><B>long</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_R4</B></TD>
<TD width="66%"><B>float</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_R8</B></TD>
<TD width="66%"><B>double</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_CY</B></TD>
<TD width="66%"><B>CY</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_DATE</B></TD>
<TD width="66%"><B>DATE</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_BSTR</B></TD>
<TD width="66%"><B>BSTR</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_DISPATCH</B></TD>
<TD width="66%"><B>LPDISPATCH</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_ERROR</B></TD>
<TD width="66%"><B>SCODE</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_BOOL</B></TD>
<TD width="66%"><B>BOOL</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_VARIANT</B></TD>
<TD width="66%"><B>VARIANT</B></TD></TR>
<TR vAlign=top>
<TD width="34%"><B>VT_UNKNOWN</B></TD>
<TD width="66%"><B>LPUNKNOWN</B></TD></TR></TABLE><BR>
<P><FONT color=#000000>The <I>pbParamInfo</I> 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 </FONT><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20Visual%20Studio\MSDN\2001OCT\1033\vcmfc.chm::/html/_mfc_event_custom.htm" target="_blank" ><FONT color=#000000>EVENT_CUSTOM</FONT></A><FONT color=#000000> macro.</FONT></P>
<P><FONT color=#000000>This function converts the parameters to VARIANTARG values, then invokes the
<OBJECT><PARAM><PARAM><PARAM></OBJECT></FONT><a><FONT color=#000000>IDispatch::Invoke</FONT></A><FONT color=#000000> 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 </FONT><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20Visual%20Studio\MSDN\2001OCT\1033\vcmfc.chm::/html/_mfc_coleexception.htm" target="_blank" ><FONT color=#000000>COleException</FONT></A><FONT color=#000000> object; otherwise it throws a </FONT><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20Visual%20Studio\MSDN\2001OCT\1033\vcmfc.chm::/html/_mfc_coledispatchexception.htm" target="_blank" ><FONT color=#000000>COleDispatchException</FONT></A><FONT color=#000000>.</FONT></P>
<P><FONT color=#000000>For more information, see
<OBJECT><PARAM><PARAM><PARAM></OBJECT></FONT><a><FONT color=#000000>VARIANTARG</FONT></A><FONT color=#000000>,
<OBJECT><PARAM><PARAM><PARAM></OBJECT></FONT><a><FONT color=#000000>IDispatch</FONT></A><FONT color=#000000>,
<OBJECT><PARAM><PARAM><PARAM></OBJECT></FONT><a><FONT color=#000000>IDispatch::Invoke</FONT></A><FONT color=#000000>, and
<OBJECT><PARAM><PARAM><PARAM></OBJECT></FONT><a><FONT color=#000000>Structure of COM Error Codes</FONT></A><FONT color=#000000> in the <I>Platform SDK</I>.</FONT></P> 运行代码就可以了,如果你觉得你英文不错的话,我还能给你些相关的资料(全都是英文的) <P>多谢斑竹,可以的话,我很乐意需要这样的资料。<BR>但我还是不打清楚InvokeHelper()里面的东西,各个参数是这样设的,又都是代表什么样的意思?</P> 我其实是做mis用ado时遇到这样问题的,加了控件后就自动添加了不少系统给你的类,比如datalist类里就有很多自带的函数都是带有InvokeHelper()的函数,不知道他是怎样设的? 我找了很多资料,但是能解释InvokeHelper的却没有,我也很无奈,贴上那些,也只是希望能给你点帮助 按照InvokeHelper的名称猜,它应该是调用助手的方法,第一个参数可能是更新的内存地址。<BR>以上纯属本人猜测[em04] [em01]<BR>无论如何,还是多多谢斑竹的帮助,你该是个好斑竹,蛮关心大家的,我顶. 谢谢楼上
页:
[1]
