C++ MessageBox character array
I am having difficulties using MessageBox function with variables
I have
int main(int argc, char* argv[])
{
char* filename = argv[0];
DWORD length = strlen(filename);
MessageBox(0, TEXT("filename text"), TEXT("length text"), 0); // Works
}
But I want to output variables filename and length as:
MessageBox(0, filename, length, 0); -- compiler error
Function MessageBox has syntax:
int WINAPI MessageBox(
_In_opt_ HWND hWnd,
_In_opt_ LPCTSTR lpText,
_In_opt_ LPCTSTR lpCaption,
_In_ UINT uType
);
I tried using
MessageBox(0, (LPCWSTR)filename, (LPCWSTR)length, 0);
but the output is in some kind of hieroglyphs.
No comments:
Post a Comment