TextOut and WM_PAINT



I update the window A from other one (B), by sending SendMessage(WM_PAINT...

This window A receives that message and should check the lparam and wparam..
where wparam is handle to window B and lparam - int value.

What I need is to display that int value.

I do the necessary calculations to get new winsizes (A) and draw the wchar
converted value.

so the changing is non-stop, wm_paint is sending constantly from B and I can
see in file, that the value is receive correctly. (see the code) not just
non-stop, but periodically non-stop.

Say, I begin, then stop, then begin again.. let me call it a "seance".

first message of the seance received and I can see the right value, then the
same value is shown all the time, in spite of the int and buffer values are
changed.
then I stop the seance.
when I beging the next seance I can see again the new changed value, and
after the same changed value. no changes.

I checked out the file tracer.txt :- everything received correctly, the
value is getting changed..


seems like somthing wrong with text output.

cause once, I just boldly converted the int value into char* and converted
the char* to LPWSTR.

And I saw the value had been changing constantly, as it suppose to be.

I use UNICODE mode..

Any clue, please, unless you can't understand me.


case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);

RECT rcW, rcP;
SIZE mySize;

ZeroMemory(&mySize, sizeof(mySize));

wchar_t buffer[15] = {0};
_itow((int) lParam, buffer, 10);
int sizeStr = wcslen( buffer );
GetTextExtentPoint32( hdc, buffer, sizeStr, &mySize);

GetWindowRect((HWND)wParam, &rcW);
GetWindowRect(GetParent((HWND)wParam), &rcP);

int yPoz = rcP.top + (rcW.bottom - rcP.top);
int x = rcP.left + (rcW.left - rcP.left);

SetWindowPos(hWnd, NULL, x, yPoz, mySize.cx, mySize.cy,
SWP_NOZORDER);

SetTextColor(hdc, RGB(255,0,0));

TextOut(hdc, 0, 0, buffer, sizeStr);
Beep(600,20);
// Просто в файл сбрасываю параметр и в
файле все корректно
FILE* fl;
fl = _wfopen( _T("c:\\tracer.txt"), _T("a") );
fwrite( buffer, 2*sizeStr, 1, fl );
fwrite(_T("\n"), 1, 1, fl );
fclose( fl );

EndPaint(hWnd, &ps);



.



Relevant Pages

  • Re: CreateProcess() its extermely slow
    ... I notice that if my application has no Window, ... int APIENTRY _tWinMain(HINSTANCE hInstance, ... LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, ... LPARAM lParam) ...
    (microsoft.public.vc.mfc)
  • Re: In window mode, pD3DDevice->SetViewport?
    ... the back buffer is always stretchblit to ... // Holds Our Window Handle ... HINSTANCE hInstance; // Holds The Instance Of The Application ... void ReSizeD3DScene(int width, int height) // Resize And Initialize The ...
    (microsoft.public.win32.programmer.directx.graphics)
  • CreateProcess() its extermely slow
    ... I notice that if my application has no Window, ... int APIENTRY _tWinMain(HINSTANCE hInstance, ... LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, ... LPARAM lParam) ...
    (microsoft.public.vc.mfc)
  • Color Depth of DC for Multi-Monitor System
    ... How does Windows determine the color depth that it uses for a device context ... every time I create a Window (no matter on which desktop I place ... BOOL InitInstance(HINSTANCE, int, int, int); ... LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); ...
    (microsoft.public.win32.programmer.gdi)
  • Re: TextOut and WM_PAINT
    ... This window A receives that message and should check the lparam and wparam.. ... What I need is to display that int value. ... first message of the seance received and I can see the right value, then the same value is shown all the time, in spite of the int and buffer values are changed. ...
    (microsoft.public.vc.mfc)