Path: utzoo!attcan!uunet!snorkelwacker.mit.edu!usc!almaak.usc.edu!ajayshah From: ajayshah@almaak.usc.edu (Ajay Shah) Newsgroups: comp.lang.pascal Subject: Re: Saving graphics screen to file in TP 5.5 Message-ID: <28137@usc> Date: 14 Nov 90 20:22:39 GMT References: <90318.10233434ZL4RT@CMUVM.BITNET> Sender: news@usc Organization: University of Southern California, Los Angeles, CA Lines: 59 Nntp-Posting-Host: almaak.usc.edu In article <90318.10233434ZL4RT@CMUVM.BITNET> 34ZL4RT@CMUVM.BITNET (Nilesh) writes: >and would like to save the screen image to disk for retrieval later. I have I can contribute part of the code, provided you tell me how to do the rest when you figure it out! Part A: grabbing the screen into memory: procedure GrabScreen(var p:pointer); var p:pointer; Need : word; begin Need := ImageSize(0, 0, GetMaxX, GetMaxY); if (maxavail < Need) then begin writeln('Sorry, no memory available.'); exit end; getmem(p, Need); {hence need p above as var} GetImage(0, 0, GetMaxX, GetMaxY, p^) end; Part B: writing it to disk. If you were committed to (say) a CGA, then you know the size above (Need = 16k) and you can write code like: --------------------------------------------------------------------------- procedure WriteScreen(var data; fname:string); type CGAScreen = array[1..16384] of byte; ScreenFileType = file of CGAScreen; var thiscreen : CGAScreen absolute data; f : ScreenFileType; begin assign(f, fname); rewrite(f); write(f, data); close(f) end; where you would issue the call as follows: WriteScreen(screen^, 'afile'); NOT WriteScreen(screen, 'afile'); --------------------------------------------------------------------------- But you can't because you don't know how big Need is going to be. The trick is to use the bufstm module bundled with tp5.5, except that I don't know how it's done. Remember what you promised me at the start of this posting! -- _______________________________________________________________________________ Ajay Shah, (213)734-3930, ajayshah@usc.edu The more things change, the more they stay insane. _______________________________________________________________________________