Path: utzoo!utgpu!attcan!uunet!husc6!bbn!bbn.com!dtani From: dtani@bbn.com (Dan Tani) Newsgroups: comp.sys.mac.programmer Subject: AARRGG! Need help with OpenPicture() Message-ID: <31922@bbn.COM> Date: 7 Nov 88 14:44:06 GMT Sender: news@bbn.COM Reply-To: dtani@BBN.COM (Dan Tani) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 43 Hi, I've got a programming problem that is driving me up the wall. I am programming in LSC 3.0 and I want to be able to export some drawings via the clipboard. I wrote this subroutine and I use all the standard include files. First, here's the code: PicToClip() { Rect testRect; extern PicHandle ClipPic; SetRect(&testRect,0,0,200,200); ClipPic = OpenPicture(&testRect); HLock(ClipPic); /* my drawing calls*/ ClosePicture(); ZeroScrap(); PutScrap(GetHandleSize(ClipPic),'PICT', *ClipPic); HUnlock(ClipPic); KillPicture(ClipPic); } The problem is that OpenPicture(&testRect) doesn't change ClipPic - it returns a handle of 0x0000 which crashes everything. The Rect gets set correctly, and I even tried putting a ClipRect(&testRect) right before the OpenPicture call like IM 1 suggests - and got even more problems! That returned an odd address error right at the ClipRect call. This seems very simple. The PutScrap part works great - I had it write a PICT from a resource, and everything worked fine. Also, are there any other things I should look out for while drawing picture? I assume that any SetPorts should be avoided, but I'm just calling some routines that I use to draw to the screen and to the printer. Any help is appreciated! I'll post a summary if there is interest. Thanks in advance, Dan Tani DTANI@BBN.COM