home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!usc!howland.reston.ans.net!spool.mu.edu!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: Re: When to take a snapshot?
- Message-ID: <1993Jan11.220717.650@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- References: <1993Jan7.141729.2931@brandonu.ca>
- Date: Mon, 11 Jan 1993 22:07:17 GMT
- Lines: 30
-
- In article <1993Jan7.141729.2931@brandonu.ca> dueck@brandonu.ca writes:
- >I have an application that draws graphics in a window. I want to save the
- >contents of the window across task switches so they can be restored when my
- >application is reactivated. At what point should I take a snapshot of the
- >screen?
- When you receive WM_PAINT and draw your screen, also save
- the whole thing as a bitmap. If you get WM_SIZE, then kill
- the bitmap, it is now invalid. You may also kill it when
- you change the picture yourself.
-
- Subsequently, when you get WM_PAINT messages, if the bitmap
- still exists, then BitBlt it to the screen, to redraw:
-
- static HBITMAP hbitmap=NULL;
- ...
- case WM_PAINT: if(hbitmap){
- BitBlt using hbitmap
- }else{
- hdc=BeginPaint(...)
- DrawMyPicture();
- hbitmap=SaveMyPictureAsBitmap();
- EndPaint(...);
- }
- break;
-
- If you need more details, e-mail me and I'll send you some code.
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-