Page 1 of 1

char* into MessageBoxW?

PostPosted: Aug 14, 2002 @ 4:36pm
by refractor
This is surely a really stupid question, but I need to do something (like) :

long my_function(char *str)
{
return MessageBox(str,TEXT("HELLO"),MB_OK);
}

Except MessageBoxW expects str to be a Wide and I can't find a conversion function ... or I'm missing something obvious here...?

Cheers,

Refractor

PostPosted: Aug 14, 2002 @ 4:49pm
by refractor

PostPosted: Aug 14, 2002 @ 5:14pm
by BurningSheep

PostPosted: Aug 14, 2002 @ 9:08pm
by Hosed
CStrings are based around the TCHAR as well so when you build functions to accept TCHARs it becomes much easier to use CStrings with them.

PostPosted: Aug 14, 2002 @ 9:20pm
by R0B

PostPosted: Aug 16, 2002 @ 1:42am
by Guest
hmm.. _T is exactly the same as TEXT.. if you're so concerned about "shortness" not why simply use L"my string"?

call me pedantic ;)

PostPosted: Aug 16, 2002 @ 1:49am
by BurningSheep
L"String" always converts your string to unicode. So it doesn't do the same thing as the _T and TEXT macros do. They leave the string unchanged if unicode isn't used.

PostPosted: Aug 16, 2002 @ 11:21am
by refractor

PostPosted: Aug 16, 2002 @ 12:35pm
by Hosed