Konvertierungsproblem bei Nachrichtenprozedur
-
Hallo,
ich habe mich schon durch sämtliche Beiträge
gelesen - konnte aber mein Problem immer noch
nicht Lösen.
TextOut nimmt mein "str" nicht an.LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; switch (message) {. . . case WM_LBUTTONDOWN: hdc = GetDC(hwnd); char str[50]; //bei wchar_t str[50]; hat auch sprintf ein Problem sprintf (str, "%i|%i|%i|%i",hwnd,message,wParam,lParam); TextOut (hdc, 20, 20, str, strlen(str)); ReleaseDC(hwnd,hdc); return 0;Problem: error C2664: 'TextOutW' : cannot convert parameter 4 from 'char [50]'
to 'LPCWSTR'bei wchar_t ... :error C2664: 'sprintf' : cannot convert parameter 1 from
'wchar_t [50]' to 'char *'
error C2664: 'strlen' : cannot convert parameter 1 from
'wchar_t [50]' to 'const char *'Ich benutze VS 9 und arbeite im Unicode. Ich krieg das einfach nich hin...
MfG, Benni
-
Benni* schrieb:
Ich benutze VS 9 und arbeite im Unicode. Ich krieg das einfach nich hin...
Hmmm, wirklich Unicode?
Na, ist Dir dabei ein Licht aufgegangen?guckst Du:
wchar_t str[50]; swprintf (str, L"%i|%i|%i|%i",hwnd,message,wParam,lParam); TextOut (hdc, 20, 20, str, wcslen(str));HTH,
Martin
-
Hey Mmacher, vielden Dank - hat auf anhieb funktioniert.
MfG, Benni