Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy Files To Windows Explorer
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00894173
Message ID:
00894375
Views:
6
>I have a list of files on a VFP form. I want to right click and choose
>'Copy', then use windows explorer and paste them into a folder.
>
>Anyone know how to do this?

Yes,
#define CF_FILES 15
#define GMEM_MOVEABLE 2
#define GMEM_ZEROINIT 64

Declare Long GlobalAlloc in Win32API Long uFlags, Long dwBytes
Declare Long GlobalFree in Win32API Long hMem
Declare Long GlobalLock in Win32API Long hMem
Declare Long GlobalUnlock in Win32API Long hMem
Declare RtlMoveMemory in Win32API Long lpDest, String @ lpStr, Long lLen
Declare Long OpenClipboard in Win32API Long
Declare Long CloseClipboard in Win32API
Declare Long EmptyClipboard in Win32API
Declare Long SetClipboardData in Win32API Long uFormat, Long hMem
Declare Long GetLastError in Win32API

* _DROPFILES structure
s = Chr(20) + Replicate(Chr(0), 19)
s = s + "c:\autoexec.bat" + Chr(0)
s = s + "c:\config.sys" + Chr(0) + Chr(0)

h = GlobalAlloc(GMEM_MOVEABLE+GMEM_ZEROINIT, LEN(s))
ptr = GlobalLock(h)
RtlMoveMemory(ptr, s, LEN(s))
GlobalUnlock(h)
If OpenClipboard(0) != 0
	EmptyClipboard()
	SetClipboardData(CF_FILES, h)
	CloseClipboard()
else
	GlobalFree(h)
EndIf
Place this code into RightClick event and replace autoexec.bat and config.sys in this sample with list of your files.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform