我正在從一個DocumentComplete的URL值,並嘗試將其複製到testDest[256]
這裏是我的代碼:打印的char []到MessageBox的
char *p= _com_util::ConvertBSTRToString(url->bstrVal);
for (int i = 0; i <= strlen(p); i++)
{
testDest[i] = p[i];
}
我的問題是,我怎麼能打印在該值消息框?
我正在從一個DocumentComplete的URL值,並嘗試將其複製到testDest[256]
這裏是我的代碼:打印的char []到MessageBox的
char *p= _com_util::ConvertBSTRToString(url->bstrVal);
for (int i = 0; i <= strlen(p); i++)
{
testDest[i] = p[i];
}
我的問題是,我怎麼能打印在該值消息框?
創建一個消息框,最簡單的方法是這樣的:
MessageBox(NULL, testDest, "some title", 0);
如果你已經有一個窗口,要與該窗口中的消息框關聯,剛剛從NULL
第一個參數更改爲窗口處理。另外,如果您使用的是Unicode,則應將char []
轉換爲TCHAR []
或以其他方式明確調用ANSI版本(MessageBoxA
)。
你可以做到這一點
CString cstring(testDest);
AfxMessageBox(testDest);