home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4852 < prev    next >
Encoding:
Text File  |  1993-01-11  |  1.4 KB  |  41 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!usc!howland.reston.ans.net!spool.mu.edu!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: Re: When to take a snapshot?
  5. Message-ID: <1993Jan11.220717.650@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. References: <1993Jan7.141729.2931@brandonu.ca>
  8. Date: Mon, 11 Jan 1993 22:07:17 GMT
  9. Lines: 30
  10.  
  11. In article <1993Jan7.141729.2931@brandonu.ca> dueck@brandonu.ca writes:
  12. >I have an application that draws graphics in a window. I want to save the
  13. >contents of the window across task switches so they can be restored when my
  14. >application is reactivated. At what point should I take a snapshot of the
  15. >screen? 
  16.     When you receive WM_PAINT and draw your screen, also save
  17.     the whole thing as a bitmap.  If you get WM_SIZE, then kill
  18.     the bitmap, it is now invalid.  You may also kill it when
  19.     you change the picture yourself.
  20.  
  21.     Subsequently, when you get WM_PAINT messages, if the bitmap
  22.     still exists, then BitBlt it to the screen, to redraw:
  23.  
  24.     static HBITMAP hbitmap=NULL;
  25.     ...
  26.         case WM_PAINT:    if(hbitmap){
  27.                   BitBlt using hbitmap
  28.                 }else{
  29.                   hdc=BeginPaint(...)
  30.                   DrawMyPicture();
  31.                   hbitmap=SaveMyPictureAsBitmap();
  32.                   EndPaint(...);
  33.                 }
  34.                 break;
  35.  
  36.     If you need more details, e-mail me and I'll send you some code.
  37. -- 
  38. John A. Grant                        jagrant@emr1.emr.ca
  39. Airborne Geophysics
  40. Geological Survey of Canada, Ottawa
  41.