Date: Sat, 24 Nov 2001 14:23:40 +0100 Newsgroups: borland.public.delphi.objectpascal Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Virtual Access by Atlantic Coast PLC, http://www.atlantic-coast.com/va Organization: TeamB Message-ID: Subject: Re: Clipboard.HasFormat(cf_Bitmap) Jpeg? From: "Peter Below (TeamB)" <100113.1101@compuXXserve.com> Reply-To: 100113.1101@compuXXserve.com References: <3bff20db_1@dnews> NNTP-Posting-Host: 172.179.39.232 X-Trace: dnews 1006608207 172.179.39.232 (24 Nov 2001 05:23:27 -0800) Lines: 69 Path: dnews Xref: dnews borland.public.delphi.objectpascal:216724 In article <3bff20db_1@dnews>, Matt wrote: > This code checks for Bitmaps in the Clipboard....But how can I check for a > Jpeg? You cannot, there is no standard clipboard format for Jpegs. Any application that copies Jpegs to the clipboard will have to register a custom clipboard format. If you have such an application copy a JPEG into the clipboard from it and then check which clipboard formats that has produced. The Clipboard.Formats array contains all the formats but only as numeric IDs, you have to use GetClipboardFormatname to get the string name of each format. You need that to use with RegisterClipboardFormat when you want to get the format ID later, you cannot rely on the value you found in Clipboard.Formats during the test since it may be different the next time the app is run. procedure TForm1.BtnShowFormatsClick(Sender: TObject); Var buf: Array [0..60] of Char; n : Integer; fmt: Word; name: String[30]; begin MemFormats.Clear; for n := 0 to Clipboard.FormatCount-1 do begin fmt := Clipboard.Formats[n]; If GetclipboardFormatName( fmt, buf, Pred(Sizeof(buf))) <> 0 Then MemFormats.Lines.Add( StrPas( buf )) Else Begin Case fmt of 1: name := 'CF_TEXT'; 2: name := 'CF_BITMAP'; 3: name := 'CF_METAFILEPICT'; 4: name := 'CF_SYLK'; 5: name := 'CF_DIF'; 6: name := 'CF_TIFF'; 7: name := 'CF_OEMTEXT'; 8: name := 'CF_DIB'; 9: name := 'CF_PALETTE'; 10: name := 'CF_PENDATA'; 11: name := 'CF_RIFF'; 12: name := 'CF_WAVE'; 13: name := 'CF_UNICODETEXT'; 14: name := 'CF_ENHMETAFILE'; 15: name := 'CF_HDROP (Win 95)'; 16: name := 'CF_LOCALE (Win 95)'; 17: name := 'CF_MAX (Win 95)'; $0080: name := 'CF_OWNERDISPLAY'; $0081: name := 'CF_DSPTEXT'; $0082: name := 'CF_DSPBITMAP'; $0083: name := 'CF_DSPMETAFILEPICT'; $008E: name := 'CF_DSPENHMETAFILE'; $0200..$02FF: name := 'private format'; $0300..$03FF: name := 'GDI object'; Else name := 'unknown format'; End; MemFormats.Lines.Add( name ); end; end; end; Peter Below (TeamB) 100113.1101@compuserve.com) No e-mail responses, please, unless explicitly requested! Note: I'm unable to visit the newsgroups every day at the moment, so be patient if you don't get a reply immediately.