home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4262 < prev    next >
Encoding:
Text File  |  1992-12-15  |  2.9 KB  |  76 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!caen!malgudi.oar.net!news.ans.net!cmcl2!panix!rryan
  3. From: rryan@panix.com (Rob Ryan)
  4. Subject: Re: F****d Borland forgot to define the message in BC 3.1's windows.h !!!!!
  5. Message-ID: <1992Dec15.211723.29175@panix.com>
  6. Date: Tue, 15 Dec 1992 21:17:23 GMT
  7. References: <1992Dec9.045940@avsht.sph.spb.su>
  8. Organization: Panix, NYC
  9. Lines: 65
  10.  
  11. In <1992Dec9.045940@avsht.sph.spb.su> avsht@sph.spb.su (Alex V. Shturm) writes:
  12.  
  13. >Trying to recompile my Windows project under BC 3.1, I was wondering
  14. >very much when compiler suddenly reported me that he doesn't know
  15. >the message WM_PAINTICON. I looked into windows.h and didn't find it!!!
  16. >Although nearest win30.h file (former windows.h from BC 3.0)
  17. >defines it.
  18. >
  19. >1. Is it Borland mistake or mine?
  20. >2. What is the best way to avoid it:
  21. >   - to feed bcc the option -DWM_PAINTICON=0x0026
  22. >   - to change windows.h by adding #define WM_PAINTICON 0x0026
  23. >   - another way
  24.  
  25. According to the Fall issue of Microsoft Develop Network News, Microsoft
  26. deliberately removed WM_PAINTICON because "[t]his unnecessary message was
  27. extremely confusing to developers and caused some version compatibility
  28. problems for Windows."
  29.  
  30. They suggest that you (if you don't want to just register the icon under
  31. RegisterClass()) use the WM_PAINT message, and check IsIconic(hWnd) to
  32. see if it's an icon or not.  Their sample code suggests that you'd have
  33. something like:
  34.  
  35.     case WM_PAINT: {
  36.         PAINTSTRUCT ps;
  37.         if (IsIconic(hWnd)) {
  38.             BeginPaint(hWnd, &ps);
  39.             DefWindowProc(hWnd, WM_ICONERASEBKGND, (WORD) ps.hdc, 0L);
  40.             DrawIcon(ps.hdc, 0, 0, hIcon);
  41.             EndPaint(hWnd, &ps);
  42.             return 0;  /* microsoft's sample didn't have this "return", */
  43.                        /* but we want it, don't we?                     */
  44.         } else {
  45.             return DefWindowProc(hWnd, message, wParam, lParam);
  46.         }
  47.      }
  48.  
  49.      case WM_ERASEBKGND:
  50.         if (IsIconic(hWnd))
  51.             return TRUE;
  52.         else
  53.             return DefWindowProc(hWnd, message, wParam, lParam);
  54.  
  55.      case WM_QUERYDRAGICON:
  56.         return (LONG) (WORD)hIcon;
  57.  
  58.  
  59. They also point out that (a) you should register a NULL icon with
  60. RegisterClass if you're doing it yourself; and (b) "You might also
  61. want to use the new Windows v3.1 DDE capabilities of the Program
  62. Manager to get the icon the user has associated with you application.
  63. Doing this will give you changeable icons, just as MS-DOS applications
  64. do."
  65.  
  66. Hope this helps.  In answer to your question of how to get your code
  67. to use WM_PAINTICON, the answer is, unfortunately, change you code so
  68. you don't use WM_PAINTICON.  Given that it's no longer supported, you
  69. aren't guaranteed that later version of Windows will even have this
  70. message.  It looks like v3.1 still does (though undocumented), but
  71. you shouldn't rely on it.
  72.  
  73. -- 
  74.  Rob Ryan
  75.     rryan@panix.com
  76.