home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!newsserver.technet.sg!nuscc!vms1.iscs.nus.sg!nuscss1
- From: nuscss1@vms1.iscs.nus.sg (Vax BULLET-IN-Board SysOps)
- Subject: Re: how to animate icon of minimised window ?
- Message-ID: <26DEC199215074127@vms1.iscs.nus.sg>
- Summary: ok, i've managed to find out how...
- News-Software: VAX/VMS VNEWS 1.41
- Sender: usenet@nuscc.nus.sg
- Organization: National University of Singapore Dept. of Computer Sc.
- References: <25DEC199200040150@vms1.iscs.nus.sg> <1992Dec25.062010.6731@panix.com>
- Date: Sat, 26 Dec 1992 13:07:00 GMT
- Lines: 45
-
- In article <1992Dec25.062010.6731@panix.com>, rryan@panix.com (Rob Ryan) writes...
- >In <25DEC199200040150@vms1.iscs.nus.sg> nuscss1@vms1.iscs.nus.sg (Vax BULLET-IN-Board SysOps) writes:
- >
- >Are you invalidating your window in your WM_TIMER message? As well as telling
- >Windows what the new icon is, you'd probably want to tell it to redraw it (and
- >you do this by invalidating the appropriate window).
- >
- >Personally, I wouldn't do the SetClassWord(), but rather manually take over
- >the processing of the paint command. So, I'd have something like:
- >
- > 1. my WM_TIMER code would invalidate the window for the application and set
- > a static, hIcon to be the handle of my new icon; and
- > 2. have a WM_PAINT (Microsoft doesn't recommend using WM_PAINTICON anymore)
- > check to see if IsIconic(). So, I'd have something like:
- > case WM_PAINT:
- > if (IsIconic(hWnd)) {
- > BeginPaint(hWnd, &ps);
- > DefWindowProc(hWnd, WM_ICONERASEBKGND, (WORD) ps.hdc, 0L);
- > DrawIcon(ps.hdc, 0, 0, hIcon);
- > EndPaint(hWnd, &ps);
- > return 0;
- > } else
- > return DefWindowProc(hWnd, message, wParam, lParam);
-
-
- okie, after fiddling around with DrawIcon, WM_PAINT, and all
- those stuff, i discovered that the trick is, as you've pointed out,
- to invalidate the window. All that is required is :
-
- 0. Set the timer. Upon reception of WM_TIMER, do the following:
- 1. Set the handle of the next icon using the SetClassWord() function.
- 2. Invalidate the window with InvalidateRect(hWnd,NULL,TRUE).
- The important thing here is the 3rd parameter. All along I've set it
- to FALSE, which was why it didn't work before. I *guess* the reason
- could be that if WIndows is forced to redraw the background, it
- will also be forced to redraw the icon, and voila! your new icon
- will be drawn.
- 3. That's it. No further code is required in the WM_PAINT message.
-
- I hope this saves someone out there from a bit of head-scratching.
- >
- >
- >--
- > Rob Ryan
- > rryan@panix.com
-