I am trying to create a program that will put a white static box or a black static box on the window according to a value in an array and it will do this multiple times in the program but every time i do it the previous sqaures show up and then the new ones. my code is here:
when i generate the data in the array and then call this activity, the first time it till create the array of static boxes just fine and in a quick mannerCode:for(i=0;i<30;i++) { for(k=0;k<30;k++) { DestroyWindow(GetDlgItem(hwnd,1000+stickCounter)); stickCounter++; } } stickCounter=0; for(i=0;i<30;i++) { for(k=0;k<30;k++) { if(stickTemplate[i][k]==0) { hWndStaticBlack[i][k] = CreateWindowEx(0,"STATIC","",WS_CHILD | WS_VISIBLE | SS_BLACKRECT, 10+(k*5), 100+(i*5),5, 5,hwnd,(HMENU)1000+stickCounter,hInstance,0); } else if(stickTemplate[i][k]==255) { hWndStaticBlack[i][k] = CreateWindowEx(0,"STATIC","",WS_CHILD | WS_VISIBLE | SS_WHITERECT, 10+(k*5), 100+(i*5),5, 5,hwnd,(HMENU)1000+stickCounter,hInstance,0); } stickCounter++; } }
when i do it a second time, it will remove the existing static boxes and the proceed to paint the new ones up there but before it gets them painted on the screen, the first ones show up and then the new ones like it is painting over them even though they are supposed to be destroyed
when i do it a third time, the old boxes (from the second time) go away like they should then the first set of boxes flash up there then comes the second set flashing up there and the the third set finally get painted up there
.
.
.
when i do it an nth time, the previous boxes disappear and then the 1st, 2nd, 3rd, ... nth-1 boxes flash up there and then the nth boxes get painted up there
i thought that DestroyWindow would get rid of these old static windows and allow the memory allocated for them to be occupied by the new data that is going to be set in it yet i watch the amount of memory that the program is taking and it just keeps growing
any suggestions or other questions?
any help would be appreciated. thanks in advanced.



LinkBack URL
About LinkBacks


