Move Files Via Clipboard

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I currently have a Win32 application written that will allow me to place files on the explorer global clipboard from the command line. Now Im looking to create an enhancement to allow this application to move files not just copy them.
I dont think this is the correct place to post this question but I could not determine a better location.
Thank you

This is a snipit of my current code

<pre class="prettyprint DROPFILES dobj = { 20, { 1, 1 }, 0, 0 };
int nGblLen = sizeof(dobj) + bufferSize;
HGLOBAL hGbl = GlobalAlloc (GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, nGblLen);
char* sData = (char*)GlobalLock(hGbl);
memset(sData,, nGblLen);
memcpy( sData, &dobj, sizeof(dobj) );
char* sWStr = sData + sizeof(dobj);

for (int i = 0; i < bufferSize; ++i) {
if (buffer == |){
buffer = 0;
}
}
appendBuffer(sWStr,buffer,bufferSize);
sData[sizeof(dobj) + bufferSize -1] = 0;
GlobalUnlock(hGbl);
//this can be 0 or GetActiveWindow() according to the docs
//0 or null will make SetClipboardData fail but it doesnt
if( OpenClipboard(GetDesktopWindow()) ){
EmptyClipboard();
SetClipboardData( CF_HDROP, hGbl );
CloseClipboard();
} else {
printf("Unable to open clipboard");
}[/code]
<br/>

<span style="font-size:small <span style="font-size:small

<span style="font-size:small <span style="font-size:small

<br/>

View the full article
 
Back
Top