i'm trying using the SetTimer() it's good, but for deferent delay between frames it's a big problem... instead a Multimedia Timers, is there another timer that i can use?
By the way: a timer with a period of 10ms and below makes little sense for a gui (it just keeps the gui busy). The user will see changes only when the delay is 200ms and more.
yes you have right. but theres 1 timer that 'stops' when the form wins the focus. that timer just change the form icon:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void SetIcon(image &imgIcon)
{
if(hWindowIcon!=NULL)
DestroyIcon(hWindowIcon);
if(hWindowIconBig!=NULL)
DestroyIcon(hWindowIconBig);
hWindowIcon =CopyIcon((HICON)imgIcon);
hWindowIconBig =CopyIcon((HICON)imgIcon);
//DrawHICONtoHDC(NULL, (HICON)imgIcon,100,100);
if(hWindowIcon!=NULL)
{
SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)(HICON)hWindowIcon);//if i don't use these line
}
if(hWindowIconBig!=NULL)
{
SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)(HICON)hWindowIconBig );
}
}
see these on DrawHICONtoHDC():
1 - if i use it,the icon is changed;
2 - NULL is a HDC, so it's wrong... i just did these for not draw it.
but what you think?
They are destroyed (line 26/28). Just make sure that the window doesn't access any data from the icon when you destroy it. Hence destroy the icon after it is removed from the window (with WM_SETICON).
correct me 1 thing: before destroy a timer\multithread or something like that, is the best use the wait functions and CreateEvent() and SetEvent() first?