Retrieve List of Files from Clipboard
MSDN: Windows Clipboard API
$SAMPLECODE$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 * Load required Windows API functions =LoadApiDlls() * Open clipboard lnResult = OpenClipboard(_SCREEN.hWnd) * Get handle on file list structure ( Format type 15) lnHdrop = GetClipboardData (15) IF lnHdrop > 0 lcBuffer = SPACE(512) lnSize = LEN(lcBuffer) * Get number of files in the list lnFile = BITOR(0xFFFFFFFF,0) lnFileCount = DragQueryFile(lnHdrop, lnFile, @lcBuffer, lnSize ) * Get each file name FOR lnFile = 0 TO lnFileCount-1 * The name of the file in the lcBuffer including terminating CHR(0), length of the name in lnLen lnLen = DragQueryFile(lnHdrop, lnFile, @lcBuffer, lnSize ) * File name lcFileName = LEFT(lcBuffer, lnLen) ? lnFile+1, lcFileName ENDFOR ENDIF * Empty clipboard, if necessary *= EmptyClipboard() * Close clipboard = CloseClipboard() RETURN FUNCTION LoadApiDlls DECLARE Long OpenClipboard IN WIN32API Long hWndNewOwner DECLARE Long CloseClipboard IN WIN32API DECLARE Long EmptyClipboard IN WIN32API DECLARE Long GetClipboardData IN WIN32API Long lnFormat DECLARE Long DragQueryFile IN Shell32 Long hDrop, Long iFile, String @ lpszFile, Long cch RETURN
Comments