我还是坚持我的观点:两者不一样的,你们看看下面的代码,我讲的两种情况
在执行下面代码后出现在listbox中的Format的个数和名称后很大区别,
你们自己看看.
procedure TForm1.Button1Click(Sender: TObject);
const
{an array defining all of the predefined clipboard format names}
PredefinedClipboardNames: array[1..17] of string =
('CF_TEXT', 'CF_BITMAP','CF_METAFILEPICT', 'CF_SYLK',
'CF_DIF','CF_TIFF', 'CF_OEMTEXT', 'CF_DIB','CF_PALETTE',
'CF_PENDATA', 'CF_RIFF', 'CF_WAVE', 'CF_UNICODETEXT',
'CF_ENHMETAFILE', 'CF_HDROP', 'CF_LOCALE','CF_MAX');
var
FormatID: UINT; // holds a clipboard format ID
FormatName: array[0..255] of char; // holds a clipboard format name
Len: Integer; // the length of a clipboard format name
begin
{clear out the list box}
ListBox1.Items.Clear;
{display the number of formats on the clipboard}
Label1.Caption := 'Total Formats Available: '+
IntToStr(CountClipboardFormats);
{open the clipboard}
OpenClipboard(0);
{retrieve the first available clipboard format}
FormatID := EnumclipboardFormats(0);
{retrieve all clipboard formats}
while (FormatID <> 0 ) do
begin
{get the name of the clipboard format. note that this will only
return a format name if it is a registered format, not one
of the predefined formats}
Len := GetClipboardFormatName(FormatID,FormatName,255);
{if len is equal to zero then it's a predefined format}
if Len = 0 then
ListBox1.Items.Add(PredefinedClipboardNames[FormatID]+' (Predefined)'+' [' + IntToStr(FormatID)+ ']')
else
{otherwise it contains a registered format name}
ListBox1.Items.Add(FormatName+' [' + IntToStr(FormatID)+ ']');
{retrieve the next available clipboard format}
FormatID:=EnumclipboardFormats(FormatID);
end;
{we are done with the enumeration, so close the clipboard}
CloseClipboard;
end;