🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14921

What is wrong with this code

#14921
From: micheal davis
Date: Sun, 27 Jul 2003 13:32
34 lines
1743 bytes
Hi all,

I am getting access violation every time I try to execute the following
code......can some one please tell me what is wrong with this code
all I am trying to do is to move the image captured in the clipboard from
Bitmap format to JPEG format to get better size compression...

thanks in advance


 TClipboard *CBContent = Clipboard();

  keybd_event(VK_SNAPSHOT, 0, 0, 0);

 if(SaveDialog1->Execute()==true)
 {
  if (CBContent->HasFormat(CF_BITMAP))
  {
    TJPEGImage *jp = new TJPEGImage();
    try
    {
      jp->LoadFromClipboardFormat(CF_BITMAP,
CBContent->GetAsHandle(CF_BITMAP), 0);
      jp->Compress();
      jp->SaveToFile(SaveDialog1->FileName);
    }
    __finally
    {
      delete jp;
    }
  }
 }

 delete CBContent;
Technical Details
Message-ID: <3f23d46d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,3d8447d7c3e5ad9d,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-27 06:39:21 PST
From: "micheal davis" <micheal_davis@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: What is wrong with this code
Date: Sun, 27 Jul 2003 05:32:28 -0800
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 62.135.27.44
Message-ID: <3f23d46d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1059312749 62.135.27.44 (27 Jul 2003 06:32:29 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail