3
我想drwa在C++我不能使用DrawText的()
碰巧我有了返回狀態的方法的類使用GDI一些文字,我想畫它
狀態是一個std :: string!
所以這是我到目前爲止有:
RECT status = RECT();
status.left = rcClient.right-200;
status.left = rcClient.left;
status.top = rcClient.top;
status.bottom = rcClient.bottom;
DrawTextW(hdc, game->GetStatus().c_str(), 1, status, 0);
的錯誤,我已經是:
error C2664: 'FormatMessageW' : cannot convert parameter 5 from 'LPWSTR' to 'char *'687 damas error C2664: 'FormatMessageW' : cannot convert parameter 5 from 'wchar_t *' to 'char *'damas error C2664: 'DrawTextW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR'
我無法找到一個方法來解決這個......誰能幫我出來嗎?
看起來你正在使用不同寬度的字符串要從當前打印文本選定的Windows API。要麼切換到使用窄字符串(可能不是最好的解決方案)或使遊戲狀態變成一個寬字符串。 – Will
使用'DrawTextA()'和'FormatMessageA()'作爲'W'變體寬字符串,但'std :: string'是'char *'。 – hmjd
我嘗試了另一種解決方法,使用textout ...但它打印一些奇怪的東西:( – Killercode