home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / mswindo / programm / misc / 1435 < prev    next >
Encoding:
Text File  |  1992-08-21  |  1.8 KB  |  49 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!ods!scott
  3. From: scott@ods.com (Scott Harper)
  4. Subject: Change App's Icon On The Fly [SOLVED]
  5. Message-ID: <1992Aug21.192540.27849@ods.com>
  6. Organization: Optical Data Systems, Inc.
  7. X-Newsreader: Tin 1.1 PL5
  8. Date: Fri, 21 Aug 1992 19:25:40 GMT
  9. Lines: 38
  10.  
  11. Regarding my previous posting:
  12.  
  13. > I need to change a (minimized) application's icon "on the fly", and
  14. > have the new icon displayed.  In Win 3.0 I used to call
  15. >    SetClassWord(hWnd, GCW_HICON, hNewIcon);    then,
  16. >    if (IsIconic(hWnd))
  17. >       InvalidateRect(hWnd, NULL, TRUE);
  18. > and it worked like I wanted it to.  However, since I've switched
  19. > over to the 3.1 SDK, it no longer works.  Any suggestions?
  20.  
  21. I think the problem I was running into was that InvalidateRect invalidates
  22. the *client* area of a window, but a minimized window's icon is actually
  23. part of its *non-client* area.
  24.  
  25. So now I call 
  26.  
  27.    RedrawWindow(hWnd, NULL, NULL, RDW_FRAME | RDW_ERASE | RDW_INVALIDATE);
  28.  
  29. This call with these flags invalidates a window's non-client area.  The
  30. RDW_ERASE forces a WM_ERASEBKGND.  I needed this because of the two icons
  31. I was switching between, one had a transparent background.  So when I
  32. switched to it, if I didn't erase the background, the old icon's background
  33. still showed through the transparent areas.
  34.  
  35. If my assumption about the non-client vs. client area repaint is correct,
  36. I don't see how anyone gets this type of operation working using 
  37. InvalidateRect and UpdateWindow.  Did the way an application's icon 
  38. gets painted (client vs. non-client) change between 3.0 and 3.1?
  39.  
  40. Thanks to Geoff Lamb for getting me pointed in the right direction.
  41.  
  42. -- 
  43. Scott Harper                       Optical Data Systems, Inc.
  44. scott@ods.com                      1101 E. Arapaho Road
  45. (214) 234-6400                     Richardson, TX  75081
  46.