home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4479 < prev    next >
Encoding:
Text File  |  1992-12-26  |  2.6 KB  |  59 lines

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