Czesc.
Moj problem polega na tym ze po wcisnieciu przycisku "wypisz" w polu static (hPole) nie wyswietla sie wartosc pobrana z pola tekstowego (hText) za pomoca GetWindowText, zamiast tego pole robi sie puste. Jezeli w SetWindowText "Bufor" zastapie normalnym tekstem typu "asd" wszystko dziala. Bede wdzieczny jesli powiecie co robie zle : D.
Fragment programu:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_CREATE:
{
hbutton=CreateWindowEx( 0, "BUTTON", "Pobierz", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 0, 230, 134, 40, hwnd, NULL, hThisInstance, NULL );
hbutton2=CreateWindowEx( 0, "BUTTON", "Wypisz", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 130, 230, 135, 40, hwnd, NULL, hThisInstance, NULL );
hText=CreateWindowEx( WS_EX_CLIENTEDGE, "EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 50, 50, 150, 30, hwnd, NULL, hThisInstance, NULL );
hPole=CreateWindowEx (0, "STATIC", "0", WS_CHILD | WS_VISIBLE | SS_CENTER, 75, 100, 100, 30, hwnd, NULL, hThisInstance, NULL);
}
break;
case WM_COMMAND:
{
DWORD dlugosc = GetWindowTextLength( hText );
LPSTR Bufor =( LPSTR ) GlobalAlloc( GPTR, dlugosc + 1 );
if(( HWND ) lParam == hbutton )
GetWindowText( hText, Bufor, dlugosc + 1 );
if(( HWND ) lParam == hbutton2 )
SetWindowText(hPole,Bufor);
}
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}