Question on GetIDsOfNames 
Author Message
 Question on GetIDsOfNames

Hello,
   I have a newbie question, given the following source code:

// Execute the specified method.
void CCalcCliRpcCppDlg::Execute(OLECHAR *pMethodName)
{

 if(Connect())
 {

  HRESULT hr;
  DISPID dispid;
  DISPPARAMS dispparams;
  VARIANTARG params[2];
  VARIANT result;
  CString ParamText;
  EXCEPINFO ExceptInfo;

  // Get dispatch ID corresponding to method name.
  hr = m_pSoapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);
.........

Quote:
}

My interpretaion, pMethodName is the address of  a character string.
So in the following line, what does &pMethodName stand for ? and why is it
neccessary?
  hr = m_pSoapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);

Why not
  hr = m_pSoapClient->GetIDsOfNames(IID_NULL, pMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);

Thanks in advance



Sun, 09 May 2004 03:56:27 GMT  
 Question on GetIDsOfNames
pMethodName points to an array of strings, i.e. an array of character
pointers.

In your case, the array only has one element because you are only querying
the DISPID for one name.

But you could get more than one DISPID in a single call thus:

LPOLESTR pMethodNames[2] = {OLESTR("Method1"), OLESTR("Method2")};
DISPID aDispid[2];
   hr = m_pSoapClient->GetIDsOfNames(IID_NULL, pMethodNames, 2,
 LOCALE_SYSTEM_DEFAULT, aDispid);


Quote:
> Hello,
>    I have a newbie question, given the following source code:

> // Execute the specified method.
> void CCalcCliRpcCppDlg::Execute(OLECHAR *pMethodName)
> {

>  if(Connect())
>  {

>   HRESULT hr;
>   DISPID dispid;
>   DISPPARAMS dispparams;
>   VARIANTARG params[2];
>   VARIANT result;
>   CString ParamText;
>   EXCEPINFO ExceptInfo;

>   // Get dispatch ID corresponding to method name.
>   hr = m_pSoapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
> LOCALE_SYSTEM_DEFAULT, &dispid);
> .........
> }

> My interpretaion, pMethodName is the address of  a character string.
> So in the following line, what does &pMethodName stand for ? and why is it
> neccessary?
>   hr = m_pSoapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
> LOCALE_SYSTEM_DEFAULT, &dispid);

> Why not
>   hr = m_pSoapClient->GetIDsOfNames(IID_NULL, pMethodName, 1,
> LOCALE_SYSTEM_DEFAULT, &dispid);

> Thanks in advance



Sun, 09 May 2004 04:05:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. GetIDsOfNames help

2. GetActiveObject / GetIDsOfNames returns E_NOIMPL

3. problem with parameter 2 of GetIDsOfNames

4. DISP_E_UNKNOWNNAME from GetIDsOfNames

5. IDispatch::GetIDsOfNames (newbie)

6. DISP_E_UNKNOWNNAME from GetIDsOfNames

7. DISP_E_UNKNOWNNAME from GetIDsOfNames

8. IDispatch::GetIDsOfNames (newbie)

9. Use of GetIDsOfNames for methods

10. ActiveX Collections, Containers, GetIdsOfNames, LPDISPATCH

11. GetIDsOfNames Halts

12. If I know the ID in GetIDsOfNames can I use this instead of the name?

 

 
Powered by phpBB® Forum Software