update im fenster ???
-
Hi !
Wie kann ich die Elemente im Fenster updaten, weil immer, wenn ich das Fenster verschiebe, dann ist z.b. der Button weg oder b.z.w. wird nicht mehr neu gezeichnet.Gibts da eine Funktion ???
cu
-
Nimmst du Standard-Buttons oder malst du deine selber? Das ist auf jeden Fall nicht normal ;). Zeig mal ein bisschen Code :).
cya
-
hier is etwas *G*
#include <windows.h> #define but1 1 #define but2 2 #define but3 3 #define but4 4 char szAppName[] = "Name" ; HWND hwnd ; HWND button1; HWND button2; HWND button3; HWND button4; MSG msg ; WNDCLASSEX wndclass ; LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { wndclass.cbSize = sizeof (wndclass) ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION) ; RegisterClassEx (&wndclass) ; hwnd = CreateWindow (szAppName, "Play", WS_CAPTION, 800, 500, 50, 200, NULL, NULL, hInstance, NULL) ; button1 = CreateWindow ("button","AVI",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,10,60,30,hwnd,(HMENU) but1, hInstance,NULL); button2 = CreateWindow ("button","WAV",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,50,60,30,hwnd,(HMENU) but2, hInstance,NULL); button3 = CreateWindow ("button","MP3",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,90,60,30,hwnd,(HMENU) but3, hInstance,NULL); button4 = CreateWindow ("button","Exit",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,140,60,30,hwnd,(HMENU) but4, hInstance,NULL); ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; } LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { case WM_CREATE : return 0 ; case WM_COMMAND: switch (HIWORD(wParam))//Aktionsauswahl { case BN_CLICKED://Button gedrückt ? switch(LOWORD(wParam))//Welcher ? { case but1: break; case but2: break; case but3: break; case but4: SendMessage(hwnd,WM_DESTROY,0,0); break; } break; } return 0; case WM_PAINT : return 0 ; case WM_DESTROY : PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, iMsg, wParam, lParam) ; }
-
Entweder WM_PAINT + return 0; rausnehemen oder darin Begin/EndPaint aufrufen!
-
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { wndclass.cbSize = sizeof (wndclass) ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION) ; RegisterClassEx (&wndclass) ; ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; } LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { case WM_CREATE : { HWND hwnd = CreateWindow (szAppName, "Play", WS_CAPTION, 800, 500, 50, 200, NULL, NULL, hInstance, NULL) ; HWND button1 = CreateWindow ("button","AVI",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,10,60,30,hwnd,(HMENU) but1, hInstance,NULL); HWND button2 = CreateWindow ("button","WAV",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,50,60,30,hwnd,(HMENU) but2, hInstance,NULL); HWND button3 = CreateWindow ("button","MP3",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,90,60,30,hwnd,(HMENU) but3, hInstance,NULL); HWND button4 = CreateWindow ("button","Exit",WS_CHILD | WS_VISIBLE | ES_LEFT, 25,140,60,30,hwnd,(HMENU) but4, hInstance,NULL); }break; case WM_COMMAND: switch (HIWORD(wParam))//Aktionsauswahl { case BN_CLICKED://Button gedrückt ? switch(LOWORD(wParam))//Welcher ? { case but1: break; case but2: break; case but3: break; case but4: SendMessage(hwnd,WM_DESTROY,0,0); break; } break; } return 0; case WM_DESTROY : PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, iMsg, wParam, lParam) ; }
[ Dieser Beitrag wurde am 26.01.2003 um 18:09 Uhr von mosta editiert. ]
[ Dieser Beitrag wurde am 26.01.2003 um 18:12 Uhr von mosta editiert. ]
-
danke klapt
.