Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have COM Server(ATL) where i have few interfaces.I have a interface in which a parameter is BSTR .I need to convert this parameter(bSTR) to LPSTR/LPCSTR to use inside the interface for calling Win32 API's.

<b>Ex:CreateProcess</b>
Posted
Comments
Sergey Chepurin 23-Aug-11 8:57am    
Using _bstr_t don't forget to add:

#include "comutil.h"
#pragma comment( lib, "comsuppwd.lib")

or compile with: /link comsuppw.lib

Take a look at the helper class _bstr_t
http://msdn.microsoft.com/es-es/library/zthfhkd6.aspx[^]

Sample:
_bstr_t bb(BSTR_var);  // Helper class
char *s= bb;       // Convert to LSTR
 
Share this answer
 
Comments
explorerC 23-Aug-11 8:59am    
Hi jose it worked man
thanks for the reply
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900