Click here to Skip to main content
16,010,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: String in C++. Pin
T.RATHA KRISHNAN7-May-08 1:23
T.RATHA KRISHNAN7-May-08 1:23 
QuestionHow to convert LPTSTR to BSTR? Pin
balakrishnan vinchu6-May-08 20:53
balakrishnan vinchu6-May-08 20:53 
AnswerRe: How to convert LPTSTR to BSTR? Pin
Rajkumar R6-May-08 21:11
Rajkumar R6-May-08 21:11 
AnswerRe: How to convert LPTSTR to BSTR? Pin
ThatsAlok6-May-08 21:17
ThatsAlok6-May-08 21:17 
AnswerRe: How to convert LPTSTR to BSTR? Pin
CPallini6-May-08 21:37
mveCPallini6-May-08 21:37 
GeneralRe: How to convert LPTSTR to BSTR? Pin
balakrishnan vinchu6-May-08 21:55
balakrishnan vinchu6-May-08 21:55 
GeneralRe: How to convert LPTSTR to BSTR? [modified] Pin
CPallini6-May-08 22:08
mveCPallini6-May-08 22:08 
GeneralRe: How to convert LPTSTR to BSTR? Pin
balakrishnan vinchu6-May-08 23:04
balakrishnan vinchu6-May-08 23:04 
I changed my code as you explained in previous mail.

LPTSTR lpMsgBuf = NULL;
DWORD messageflags = FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY ;
DWORD retval;
//Format the message from the format string.
retval = FormatMessage(
messageflags,
OLE2T(formatstring),
NULL,
LANG_SYSTEM_DEFAULT,
lpMsgBuf, // Suggested to pass simply lpMsgBug
0,
(va_list*)&argsarray[0]
);
if (!retval)
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());

CComBSTR message(lpMsgBuf);
*outputstring = message.Detach();
LocalFree(lpMsgBuf);

Now i am not getting the Formatted message, since retval returned from FormatMessgae API is zero (i.e 0), Because of this CComBSTR message didn't created. Also if i wont initialize lpMsgBuf = NULL, then functions just gives exception.

Give me some suggestion.
Thanks

Regards,
Bala

GeneralRe: How to convert LPTSTR to BSTR? Pin
Mukesh Kumar6-May-08 23:13
Mukesh Kumar6-May-08 23:13 
GeneralRe: How to convert LPTSTR to BSTR? Pin
balakrishnan vinchu6-May-08 23:31
balakrishnan vinchu6-May-08 23:31 
GeneralRe: How to convert LPTSTR to BSTR? Pin
Mukesh Kumar6-May-08 23:37
Mukesh Kumar6-May-08 23:37 
GeneralRe: How to convert LPTSTR to BSTR? Pin
CPallini6-May-08 23:33
mveCPallini6-May-08 23:33 
AnswerRe: How to convert LPTSTR to BSTR? Pin
Rajkumar R6-May-08 23:16
Rajkumar R6-May-08 23:16 
GeneralRe: How to convert LPTSTR to BSTR? Pin
balakrishnan vinchu6-May-08 23:34
balakrishnan vinchu6-May-08 23:34 
GeneralRe: How to convert LPTSTR to BSTR? Pin
Rajkumar R6-May-08 23:39
Rajkumar R6-May-08 23:39 
Questionlogging information and save as excel, How? [modified] Pin
general_era6-May-08 20:37
general_era6-May-08 20:37 
AnswerRe: logging information and save as excel, How? Pin
ThatsAlok6-May-08 21:19
ThatsAlok6-May-08 21:19 
AnswerRe: logging information and save as excel, How? Pin
ThatsAlok6-May-08 21:21
ThatsAlok6-May-08 21:21 
GeneralRe: logging information and save as excel, How? Pin
general_era6-May-08 21:48
general_era6-May-08 21:48 
GeneralRe: logging information and save as excel, How? Pin
ThatsAlok7-May-08 5:01
ThatsAlok7-May-08 5:01 
QuestionGame screenshot problem Pin
redclover6-May-08 20:00
redclover6-May-08 20:00 
AnswerRe: Game screenshot problem Pin
dehseth6-May-08 20:08
dehseth6-May-08 20:08 
GeneralRe: Game screenshot problem Pin
redclover7-May-08 0:48
redclover7-May-08 0:48 
AnswerRe: Game screenshot problem Pin
Rajkumar R7-May-08 0:23
Rajkumar R7-May-08 0:23 
GeneralRe: Game screenshot problem Pin
redclover7-May-08 0:46
redclover7-May-08 0:46 

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.