c++ - I can't use DrawText() -
i trying drwa text using gdi on c++
it happens have class has method return status , want draw it
the status std::string!
so here have far:
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); the errors have are:
error c2664: 'formatmessagew' : cannot convert parameter 5 'lpwstr' 'char *'687 damas error c2664: 'formatmessagew' : cannot convert parameter 5 'wchar_t *' 'char *'damas error c2664: 'drawtextw' : cannot convert parameter 2 'const char *' 'lpcwstr'
i can't find way solve this... can me out?
a std::string uses chars, drawtextw expecting wide chars (wchars, identical wchar_ts).
you can call drawtexta explicitly string. make copy of string using wide characters , pass on drawtextw.
drawtexta(hdc, game->getstatus().c_str(), 1, &status, 0); (also note takes pointer rect, need & well.)
Comments
Post a Comment