home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / mswindo / programm / misc / 1401 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  1.2 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!wupost!sdd.hp.com!elroy.jpl.nasa.gov!nntp-server.caltech.edu!vex!hihunn
  2. From: hihunn@vex.ugcs.caltech.edu (Heath I Hunnicutt)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Change App's Icon On The Fly
  5. Message-ID: <hihunn.714274051@vex>
  6. Date: 20 Aug 92 01:27:31 GMT
  7. References: <1992Aug17.235109.17512@cco.caltech.edu> <1992Aug18.141851.25525@ods.com>
  8. Sender: news@cco.caltech.edu
  9. Organization: California Institute of Technology, Pasadena
  10. Lines: 23
  11. Nntp-Posting-Host: vex.ugcs.caltech.edu
  12.  
  13. Here is some working code to change an icon on the fly.
  14.  
  15. This has been compiled using Turbo C++ 3.0.
  16.  
  17. One thing that might be causing trouble is using an old window.h with
  18. Windows 3.1. According to Undocumented Windows (Schulman, et al. - Addison
  19. Wesley) , the various GCW_ xxx constants changed with 3.1.  I guess 
  20. that means you have to do version checking around your calls to
  21. Get|Set Window|Class Word|Long.
  22. ---CUT HERE---
  23.     if (Flashing) {
  24.         if (GetClassWord(hWnd,GCW_HICON)==HIconRed)
  25.             SetClassWord(hWnd,GCW_HICON,HIconGreen);
  26.         else
  27.             SetClassWord(hWnd,GCW_HICON,HIconRed);
  28.         InvalidateRect(hWnd,NULL,TRUE);
  29.     }
  30. ---END CODE---
  31.  
  32. For the record, my GCW_HICON equals -14.
  33.  
  34. Good luck,
  35. Heath
  36.