#! perl -slw use strict; use Win32::API::Prototype; { ## Read the apis from DATA and import them. local $/ = ''; ## Para mode while( ) { my( $dll, $proto, $api ) = m[(\w+)\n(\w+\s+(\w+)\(.*)$]s; # print "$dll:[$api]\n'$proto'"; ApiLink( $dll, $proto ) or die "$api : $^E"; } close DATA; } OpenClipboard( 0 ); my $fmts = CountClipboardFormats( 0 ); print "Formats currently available on clipboard: $fmts"; my $formatID = 0; ## To get the first for( 0 .. $fmts ) { my $formatID = EnumClipboardFormats( $formatID ) or die $^E; last unless $formatID; my $fmtName = ' ' x 254; my $length = 254; GetClipboardFormatName( $formatID, $fmtName, $length ) or warn "Format $formatID is pre-defined and does not have an name.\n" and next; print "Format $formatID is called: $fmtName"; } __DATA__ user32 BOOL OpenClipboard( HWND hWndNewOwner ) user32 int CountClipboardFormats( VOID ) user32 UINT EnumClipboardFormats( UINT format ) user32 int GetClipboardFormatName( UINT format, LPTSTR lpszFormatName, int cchMaxCount ) user32 BOOL CloseClipboard( VOID )