Speicher probleme beim fenster verschieben
-
hi ihr,
ich hab nen kleines programm geschrieben, mit einem hauptfenster
in dem 4 kleine popupfenster aufgehen. im hauptfenster is noch nen
menu und ne toolbar. in einem der popup fenster hab ich d3d initialisiert
wo nen polygon rotiert, klapppt auf den ersten blick auch alles wunderbar.nun hab ich mal den taskmanager aufgemacht und ein bischen rumprobiert,
beim fenster verschieben(egal welches), steigt der zugesicherter speicher.bei ca 10mb fing es an, so ab 48mb wirds dann langsam unansehnlich.
(wenn ich d3d wieder rausnehme, passiert dasselbe)muss ich da noch WM_MOVE speziell behandeln?
danke schonmal
-
du musst WM_PAINT richtig behandeln
-
Kontrollier mal dein GDI-CleanUp, vllt hassu Speicher-Leaks drin ?! ...

-
mhh.. eigendlich zeichne ich nix ausser dem background
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);WM_PAINT hab ich noch garnich drin, denke mal was problem
liegt an dem haupt fenster.
mache erst seit 7tagen winapi. die wndproc vom haupt fenster sieht so
aus.LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static RECT rect; static HINSTANCE hInstance; HWND hwndtb; TBBUTTON buttons[]={ {0,IDR_TOOLBAR1,TBSTATE_ENABLED,TBSTYLE_BUTTON , 0, 0}, {1,IDR_TOOLBAR3,TBSTATE_ENABLED,TBSTYLE_BUTTON , 0, 0}, {2,IDR_TOOLBAR2,TBSTATE_ENABLED,TBSTYLE_BUTTON , 0, 0}, {4, 0,TBSTATE_ENABLED,TBSTYLE_SEP , 0, 0}, {3,IDR_TOOLBAR4,TBSTATE_ENABLED,TBSTYLE_BUTTON , 0, 0}}; HBITMAP hBmp=(HBITMAP)LoadImage(0,"res/toolbar1.bmp",IMAGE_BITMAP,0,0, LR_LOADFROMFILE|LR_DEFAULTSIZE| LR_CREATEDIBSECTION); switch(message) { case WM_CREATE: hInstance = (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE); //hInstance = ((LPCREATESTRUCT) lParam)->hInstance; GetClientRect(hwnd, &rect); hwndChild = CreateWindow( szChildName, TEXT("WEDIT - 3D Render View"), WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE | WS_BORDER, 700, rect.bottom - 868, rect.right - 700, 440, hwnd, NULL, NULL, NULL); hwndChildTop = CreateWindow( szChildNameTop, TEXT("WEDIT - Top View"), WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE | WS_BORDER, 120, rect.bottom - 868, rect.right - 700, 440, hwnd, NULL, NULL, NULL); hwndChildFront = CreateWindow( szChildNameFront, TEXT("WEDIT - Front View"), WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE | WS_BORDER, 120, rect.bottom - 430, rect.right - 700, 440, hwnd, NULL, NULL, NULL); hwndChildLeft = CreateWindow( szChildNameLeft, TEXT("WEDIT - Left View"), WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE | WS_BORDER, 700, rect.bottom - 430 , rect.right - 700, 440, hwnd, NULL, NULL, NULL); hwndtb=CreateToolbarEx(hwnd, WS_CHILD| WS_VISIBLE| WS_BORDER | TBSTYLE_FLAT , 0, 2, 0, (UINT)hBmp, buttons, 5, 16, 16, 16, 16, sizeof(TBBUTTON)); return 0; case WM_COMMAND: switch(LOWORD(wParam)) { case ID_HELP_\1: DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),hwnd, AboutDlgProc); hwndChild = CreateWindow( szChildName, TEXT("WEDIT - 3D Ansicht"), WS_OVERLAPPEDWINDOW | WS_CHILD | WS_VISIBLE | WS_BORDER, 600, rect.bottom - 965, rect.right - 600, 850, hwnd, NULL, NULL, NULL); } */ return 0; case ID_FILE_OPENX: DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG2),hwnd, LoadDlg); return 0; case IDR_TOOLBAR3: DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG2),hwnd, LoadDlg); return 0; } case WM_DESTROY: Destroy(); PostQuitMessage (0); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }
-
und was ist mit dem LoadImage?

-
hehe, gute frage. wie gesagt mache das noch nicht so lange.
und die tutorials sind nicht so toll.könnt ihr mal nen beispiel geben die ich das behandeln soll.
also müsste ich dann wohl den background behandeln und das img.
-
LoadImage nur im WM_CREATE Zweig aufrufen und in WM_DESTROY wieder freigeben!
-
WoW cool danke, das war es:)