RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TClipboard.FormatCount Property

Specifies the number of formats in the Formats array property.

Pascal
property FormatCount: Integer;
C++
__property int FormatCount;

Use FormatCount to find the number of different format types used to encode the information currently stored in the clipboard. FormatCount is read-only. 

To find out if a particular format is available on the clipboard, use the HasFormat method.  

C++ Examples: 

 

/*
The following code adds each format on the Clipboard to
ListBox1 when Button1 is clicked.  Something must be on
the Clipboard for Formats to work.  Load the Clipboard
by doing a Paste in another window.

Note: You will need to add Clipbrd to the uses clause (Delphi)
or include <Clipbrd.hpp> (C++).
*/
#include <clipbrd.hpp>
#include <memory>       //for STL auto_ptr class

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  for(int i=0; i < Clipboard()->FormatCount;i++)
    ListBox1->Items->Add(IntToStr(Clipboard()->Formats[i]));
}

 

Delphi Examples: 

{
The following code adds each format on the Clipboard to
ListBox1 when Button1 is clicked.  Something must be on
the Clipboard for Formats to work.  Load the Clipboard
by doing a Paste in another window.

Note: You will need to add Clipbrd to the uses clause (Delphi)
or include <Clipbrd.hpp> (C++).
}

uses clipbrd;

procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to Clipboard.FormatCount - 1 do
    ListBox1.Items.Add(IntToStr(Clipboard.Formats[I]));
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!