home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- 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
- From: rryan@panix.com (Rob Ryan)
- Subject: Re: F****d Borland forgot to define the message in BC 3.1's windows.h !!!!!
- Message-ID: <1992Dec15.211723.29175@panix.com>
- Date: Tue, 15 Dec 1992 21:17:23 GMT
- References: <1992Dec9.045940@avsht.sph.spb.su>
- Organization: Panix, NYC
- Lines: 65
-
- In <1992Dec9.045940@avsht.sph.spb.su> avsht@sph.spb.su (Alex V. Shturm) writes:
-
- >Trying to recompile my Windows project under BC 3.1, I was wondering
- >very much when compiler suddenly reported me that he doesn't know
- >the message WM_PAINTICON. I looked into windows.h and didn't find it!!!
- >Although nearest win30.h file (former windows.h from BC 3.0)
- >defines it.
- >
- >1. Is it Borland mistake or mine?
- >2. What is the best way to avoid it:
- > - to feed bcc the option -DWM_PAINTICON=0x0026
- > - to change windows.h by adding #define WM_PAINTICON 0x0026
- > - another way
-
- According to the Fall issue of Microsoft Develop Network News, Microsoft
- deliberately removed WM_PAINTICON because "[t]his unnecessary message was
- extremely confusing to developers and caused some version compatibility
- problems for Windows."
-
- They suggest that you (if you don't want to just register the icon under
- RegisterClass()) use the WM_PAINT message, and check IsIconic(hWnd) to
- see if it's an icon or not. Their sample code suggests that you'd have
- something like:
-
- case WM_PAINT: {
- PAINTSTRUCT ps;
- 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; /* microsoft's sample didn't have this "return", */
- /* but we want it, don't we? */
- } else {
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- }
-
- case WM_ERASEBKGND:
- if (IsIconic(hWnd))
- return TRUE;
- else
- return DefWindowProc(hWnd, message, wParam, lParam);
-
- case WM_QUERYDRAGICON:
- return (LONG) (WORD)hIcon;
-
-
- They also point out that (a) you should register a NULL icon with
- RegisterClass if you're doing it yourself; and (b) "You might also
- want to use the new Windows v3.1 DDE capabilities of the Program
- Manager to get the icon the user has associated with you application.
- Doing this will give you changeable icons, just as MS-DOS applications
- do."
-
- Hope this helps. In answer to your question of how to get your code
- to use WM_PAINTICON, the answer is, unfortunately, change you code so
- you don't use WM_PAINTICON. Given that it's no longer supported, you
- aren't guaranteed that later version of Windows will even have this
- message. It looks like v3.1 still does (though undocumented), but
- you shouldn't rely on it.
-
- --
- Rob Ryan
- rryan@panix.com
-