- Aug
- 2,016
- 81
Visit http://jpsoft.com/forums/threads/detecting-clipboard-format.5225/ for a message thread about clipboard formats, and also for a link to a plugin that does the same thing.
Joe
Joe
Code:
::-------------------------------------------------------
:: CLIPFMT.BTM
:: Shows how many different formats are on the clipboard,
:: then lists the clipboard formats.
::
:: 2013/10/15
:: Joe Caverly
::
::TCC 15.01.52 Windows Vista [Version 6.0.6002]
::TCC Build 52 Windows Vista Build 6002 Service Pack 2
::--------------------------------------------------------
@setlocal
@echo off
set rc=%@winapi[user32.dll,OpenClipboard,0]
iff %rc gt 0 then
echo Clipboard Open
set ln=%@winapi[user32.dll,CountClipboardFormats]
echo There are %ln clipboard formats.
set ln=%@dec[ln]
set uFormat=%@winapi[user32.dll,EnumClipboardFormats,0]
echos %@format[5,%uFormat]` - `
gosub ClipboardGetFormatName
do kount=1 to %ln
set uFormat=%@winapi[user32.dll,EnumClipboardFormats,%uFormat]
echos %@format[5,%uFormat]` - `
gosub ClipboardGetFormatName
enddo
set rc=%@winapi[user32.dll,CloseClipboard]
if %rc gt 0 echo Clipboard Closed
else
echo Could not open Clipboard
endiff
endlocal
quit
:ClipboardGetFormatName
switch %uFormat
case 1
echo CF_TEXT
case 2
echo CF_BITMAP
case 3
echo CF_METAFILEPICT
case 4
echo CF_SYLK
case 5
echo CF_DIF
case 6
echo CF_TIFF
case 7
echo CF_OEMTEXT
case 8
echo CF_DIB
case 9
echo CF_PALETTE
case 10
echo CF_PENDATA
case 11
echo CF_RIFF
case 12
echo CF_WAVE
case 13
echo CF_UNICODETEXT
case 14
echo CF_ENHMETAFILE
case 15
echo CF_HDROP
case 16
echo CF_LOCALE
case 17
echo CF_DIBV5
case 18
echo CF_MAX
case %@convert[16,10,0080]
echo CF_OWNERDISPLAY
case %@convert[16,10,0081]
echo CF_DSPTEXT
case %@convert[16,10,0082]
echo CF_DSPBITMAP
case %@convert[16,10,0083]
echo CF_DSPMETAFILEPICT
case %@convert[16,10,008E]
echo CF_DSPENHMETAFILE
case %@convert[16,10,0200]
echo CF_PRIVATEFIRST
case %@convert[16,10,02FF]
echo CF_PRIVATELAST
case %@convert[16,10,0300]
echo CF_GDIOBJFIRST
case %@convert[16,10,03FF]
echo CF_GDIOBJLAST
case 49158
echo FileName
case 49159
echo FileNameW
case 49161
echo DATAOBJECT
case 49171
echo Ole Private Data
case 49380
echo Shell Object Offsets
case 49382
echo FileContents
case 49383
echo FileGroupDescriptor
case 49389
echo Preferred DropEffect
case 49268
echo Shell IDList Array
case 49619
echo RenPrivateFileAttachments
default
echo UNKNOWN
endswitch
return
Last edited: