Click here to Skip to main content
15,894,955 members
Home / Discussions / COM
   

COM

 
GeneralCString and COM Pin
monrobot1325-May-04 8:02
monrobot1325-May-04 8:02 
GeneralRe: CString and COM Pin
Rory Solley25-May-04 21:46
Rory Solley25-May-04 21:46 
GeneralRe: CString and COM Pin
monrobot1326-May-04 4:37
monrobot1326-May-04 4:37 
GeneralRe: CString and COM Pin
Andrew Quinn AUS25-May-04 23:16
Andrew Quinn AUS25-May-04 23:16 
GeneralRe: CString and COM Pin
monrobot1326-May-04 4:36
monrobot1326-May-04 4:36 
GeneralRe: CString and COM Pin
Andrew Quinn AUS26-May-04 5:51
Andrew Quinn AUS26-May-04 5:51 
GeneralRe: CString and COM Pin
monrobot1326-May-04 6:14
monrobot1326-May-04 6:14 
GeneralRe: CString and COM Pin
f6427-May-04 8:08
f6427-May-04 8:08 
Hi Aaron,
There is an error in the way you are returning the string, what you are doing is passing the address of the string contained on m_bsResponse to the caller, the problem there is if the instance of CPopClient is destroyed the client will end having an address to a string that is not longer valid. So, what you should do is create a copy of the string and return the address of the copy. Remember BSTR is a pointer to a wide character string, so BSTR * is a pointer to a pointer!!!
STDMETHODIMP CPopClient::get_Response(BSTR *pVal)
{	
       *pVal = m_bsResponse.Copy();  // m_bsResponse is a CComBSTR<br>
       return S_OK;
}


And the client should do something like this to call it
BSTR sResponse;
IPop->get_Response(&sResponse);<br>
 
... do something with the string<br>
 
//Free the string
SysFreeString(sResponse);


Fabian
QuestionDownload my .ocx that depends on 2 other dll&#8217;s ? Pin
anderslundsgard25-May-04 1:48
anderslundsgard25-May-04 1:48 
GeneralNeed help with COM+ application Pin
ori74925-May-04 0:58
ori74925-May-04 0:58 
GeneralHELP!!! How to use GoToDate in C++ for Outlook View Control Pin
Kingwulf24-May-04 12:18
Kingwulf24-May-04 12:18 
Generalhelp! for ATL COM server methods Pin
reddys24-May-04 0:02
reddys24-May-04 0:02 
GeneralNo move or size notification Pin
mrw22-May-04 18:06
mrw22-May-04 18:06 
GeneralConnectable objects and threads Pin
Janagn21-May-04 0:13
Janagn21-May-04 0:13 
GeneralRe: Connectable objects and threads Pin
Roger Stoltz22-May-04 7:37
Roger Stoltz22-May-04 7:37 
GeneralRe: Connectable objects and threads Pin
Janagn25-May-04 3:26
Janagn25-May-04 3:26 
GeneralRe: Connectable objects and threads Pin
Roger Stoltz25-May-04 6:39
Roger Stoltz25-May-04 6:39 
GeneralMore info.. Pin
Janagn26-May-04 5:07
Janagn26-May-04 5:07 
QuestionHow to send union structures thru rpc in DCOm Pin
Benny M Kurian20-May-04 2:36
Benny M Kurian20-May-04 2:36 
Generalamazon upload need help.... Pin
Sumit Kapoor19-May-04 19:56
Sumit Kapoor19-May-04 19:56 
GeneralUsing a flash ActiveX control in Win32 Pin
Pablo Hernandez Valdes18-May-04 16:58
Pablo Hernandez Valdes18-May-04 16:58 
GeneralRe: Using a flash ActiveX control in Win32 Pin
Andrew Quinn AUS19-May-04 0:54
Andrew Quinn AUS19-May-04 0:54 
GeneralRegistering a COM server dll Pin
Robertcoder18-May-04 7:50
Robertcoder18-May-04 7:50 
GeneralRe: Registering a COM server dll Pin
Giles18-May-04 8:15
Giles18-May-04 8:15 
GeneralRe: Registering a COM server dll Pin
Robertcoder18-May-04 8:23
Robertcoder18-May-04 8:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.