ok, here some new information, i was using spy++ to look at what all my program was creating and i found out that it is making the static boxes just fine, but it is having trouble getting rid of all of the static boxes
i created the first set of boxes and it of course works fine, now i create another set of boxes and then it shows up, 675 boxes from the first set still exist
when i create yet another set, i have 675 boxes from both the first set and the second set plus all the boxes that it just created.
any clue as to why its only deleting 25% of my boxes and leaving the rest on the window?
i even tried putting a while loop in there incrementing a variable from 0 to 99 to see if maybe it was just going through it too fast and it didnt work, i just got the same results as before.
holy geez, as i am typing this thing up, i am trying new things and since it is only deleting 25% of the windows, i thought about maybe repeating the loop 4 times to see if that does anything. it did! now i only have the 900 windows that should be there!!!
why is this? why should i have to repeat the same loop 4 times to get it to delete all of the windows...i dont know if its just my computer, i can test it on a few others to see but it still confuses me.
this is now the code that seems to get rid of all those windows:
Code:
for(j=0;j<4;j++)
{
for(i=0;i<30;i++)
{
for(k=0;k<30;k++)
{
//DestroyWindow(GetDlgItem(hwnd,1000+stickCounter));
SendMessage(GetDlgItem(hwnd,1000+stickCounter), WM_CLOSE,(WPARAM)0,(LPARAM)0);
stickCounter++;
}
}
}
stickCounter=0;
for(i=0;i<30;i++)
{
for(k=0;k<30;k++)
{
char chTemp[255];
sprintf(chTemp,"%d",stickCounter);
if(stickTemplate[i][k]==0)
{
hWndStaticBlack[i][k] = CreateWindowEx(0,"STATIC",chTemp,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",chTemp,WS_CHILD | WS_VISIBLE | SS_WHITERECT,
10+(k*5), 100+(i*5),5, 5,hwnd,(HMENU)1000+stickCounter,hInstance,0);
}
stickCounter++;
}
}
also just so you know, i tried it with both WM_CLOSE message and the DestroyWindow function and both of them would only delete 25% of the windows.