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