barlyee
barlyee

Reputation: 429

Print char[] to messagebox

I am taking the URL value from DocumentComplete and try to copy it to testDest[256] Here is my code:

char *p= _com_util::ConvertBSTRToString(url->bstrVal);

for (int i = 0; i <= strlen(p); i++)
{
  testDest[i] = p[i];   
}

My question is, how can I print the testDest value on a messagebox?

Upvotes: 1

Views: 4062

Answers (2)

ckv
ckv

Reputation: 10830

You can do this

CString cstring( testDest);
AfxMessageBox(testDest);

Upvotes: 0

casablanca
casablanca

Reputation: 70721

The simplest way to create a message box is this:

MessageBox(NULL, testDest, "some title", 0);

If you already have a window and you want to associate the message box with that window, just change the first parameter from NULL to the window handle.

Also, if you're using Unicode, you should convert your char [] to TCHAR [] or otherwise call the ANSI version (MessageBoxA) explicitly.

Upvotes: 2

Related Questions