udfClipGetFormatName
str udfClipGetFormatName (int)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfClipGetFormatName (intFormatID)
IntControl (73, 2, 0, 0, 0) ; GoSub WBERRORHANDLER.
strCFName = ""
GoSub CFID_%intFormatID%
; If there is no predefined format found in our list, then we ask the Clipboard for the registered name.
If strCFName == ""
   intBBSize = 256
   hdlBB = BinaryAlloc (intBBSize)
   BinaryEodSet (hdlBB, intBBSize)
   intResult = DllCall ("USER32.DLL", long:"GetClipboardFormatNameA", long:intFormatID, lpbinary:hdlBB, long:intBBSize)
   If !!intResult Then strCFName = BinaryPeekStr (hdlBB, 0, intResult)
   hdlBB = BinaryFree (hdlBB)
EndIf
Return strCFName
;..........................................................................................................................................
;PREDEFINED CLIPBOARD FORMATS
:CFID_1
strCFName = "CF_TEXT"            ; Text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. Use this format for ANSI text.
Return ; from GoSub
:CFID_2
strCFName = "CF_BITMAP"          ; A handle to a bitmap (HBITMAP).
Return ; from GoSub
:CFID_3
strCFName = "CF_METAFILEPICT"    ; Handle to a metafile picture format as defined by the METAFILEPICT structure.
Return ; from GoSub
:CFID_4
strCFName = "CF_SYLK"            ; Microsoft Symbolic Link (SYLK) format.
Return ; from GoSub
:CFID_5
strCFName = "CF_DIF"             ; Software Arts' Data Interchange Format.
Return ; from GoSub
:CFID_6
strCFName = "CF_TIFF"            ; Tagged-image file format.
Return ; from GoSub
:CFID_7
strCFName = "CF_OEMTEXT"         ; Text format containing characters in the OEM character set. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data.
Return ; from GoSub
:CFID_8
strCFName = "CF_DIB"             ; A memory object containing a BITMAPINFO structure followed by the bitmap bits.
Return ; from GoSub
:CFID_9
strCFName = "CF_PALETTE"         ; Handle to a color palette.
Return ; from GoSub
:CFID_10
strCFName = "CF_PENDATA"         ; Data for the pen extensions to the Microsoft Windows for Pen Computing.
Return ; from GoSub
:CFID_11
strCFName = "CF_RIFF"            ; Represents audio data more complex than can be represented in a CF_WAVE standard wave format.
Return ; from GoSub
:CFID_12
strCFName = "CF_WAVE"            ; Represents audio data in one of the standard wave formats, such as 11 kHz or 22 kHz Pulse Code Modulation (PCM).
Return ; from GoSub
:CFID_13
strCFName = "CF_UNICODETEXT"     ; Windows NT/2000/XP: Unicode text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data.
Return ; from GoSub
:CFID_14
strCFName = "CF_ENHMETAFILE"     ; A handle to an enhanced metafile (HENHMETAFILE).
Return ; from GoSub
:CFID_15
strCFName = "CF_HDROP"           ; A handle to type HDROP that identifies a list of files. An application can retrieve information about the files by passing the handle to the DragQueryFile functions.
Return ; from GoSub
:CFID_16
strCFName = "CF_LOCALE"          ; The data is a handle to the locale identifier associated with text in the clipboard.
Return ; from GoSub
:CFID_17
strCFName = "CF_DIBV5"           ; Windows 2000/XP: A memory object containing a BITMAPV5HEADER structure followed by the bitmap color space information and the bitmap bits.
Return ; from GoSub
:CFID_128
strCFName = "CF_OWNERDISPLAY"    ; Owner-display format.
Return ; from GoSub
:CFID_129
strCFName = "CF_DSPTEXT"         ; Text display format associated with a private format.
Return ; from GoSub
:CFID_130
strCFName = "CF_DSPBITMAP"       ; Bitmap display format associated with a private format.
Return ; from GoSub
:CFID_131
strCFName = "CF_DSPMETAFILEPICT" ; Metafile-picture display format associated with a private format.
Return ; from GoSub
:CFID_142
strCFName = "CF_DSPENHMETAFILE"  ; Enhanced metafile display format associated with a private format.
Return ; from GoSub
:WBERRORHANDLER
Return ; from GoSub
;..........................................................................................................................................
; Range of integer values for private clipboard formats.
; CF_PRIVATEFIRST  512
; CF_PRIVATELAST   767
;
; Range of integer values for application-defined Microsoft Windows Graphics Device Interface (GDI) object clipboard formats.
; CF_GDIOBJFIRST   768
; CF_GDIOBJLAST   1023
;
; Defined in OleStd.h
; CF_EMBEDSOURCE       TEXT("Embed Source")
; CF_EMBEDDEDOBJECT    TEXT("Embedded Object")
; CF_LINKSOURCE        TEXT("Link Source")
; CF_CUSTOMLINKSOURCE  TEXT("Custom Link Source")
; CF_OBJECTDESCRIPTOR  TEXT("Object Descriptor")
; CF_LINKSRCDESCRIPTOR TEXT("Link Source Descriptor")
; CF_OWNERLINK         TEXT("OwnerLink")
; CF_FILENAME          TEXT("FileName")
;..........................................................................................................................................
; Detlev Dalitz.20030119.20090429.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strFormatList = ""
intCount = 0
intResult = 0
hdlUser32 = DllLoad (StrCat (DirWindows (1), "USER32.DLL"))
If DllCall (hdlUser32, long:"OpenClipboard", long:DllHwnd (""))
   While @TRUE
      intResult = DllCall (hdlUser32, long:"EnumClipboardFormats", long:intResult)
      If !intResult Then Break
      intCount = intCount + 1
      strItem = StrCat (intCount, ":", @TAB, StrFixLeft (intResult, " ", 5), " = ", udfClipGetFormatName (intResult))
      strFormatList = ItemInsert (strItem, -1, strFormatList, @LF)
   EndWhile
EndIf
intResult = DllCall (hdlUser32, long:"CloseClipboard")
hdlUser32 = DllFree (hdlUser32)

IntControl (28, 1, 0, 0, 0) ; Select fixed pitch font in listboxes.
AskItemlist ("Current Clipboard Formats", strFormatList, @LF, @UNSORTED, @SINGLE)

:CANCEL
Exit
;..........................................................................................................................................
; If someone wants to know what the current data format type is on the clipboard,
; e.g. Bitmap or Rich Text or whatever else, then this script can help.
;
; This script shows how to determine all the formats currently available on the clipboard,
; including the customised formats.
;
; To see custom formats in the list, try copying something from
; Notepad, Word, Write or Internet Explorer before running this script.
;
; Example (from the Windows Explorer)
;    1:   52900 = DataObject
;    2:   51586 = Shell IDList Array
;    3:   54218 = Preferred DropEffect
;    4:   54154 = Shell Object Offsets
;    5:      15 = CF_HDROP
;    6:   50782 = FileName
;    7:   52918 = Ole Private Data
;
; Example (from the Internet Explorer)
;    1:   52813 = DataObject
;    2:       1 = CF_TEXT
;    3:      13 = CF_UNICODETEXT
;    4:   54320 = HTML Format
;    5:   52372 = Rich Text Format
;    6:   52851 = Ole Private Data
;    7:      16 = CF_LOCALE
;    8:       7 = CF_OEMTEXT
;
; Detlev Dalitz.20030119
;..........................................................................................................................................