copy to clipboard
-
my application consists of a treecontrol in which i have displayed system files and folders in a tree control similar to the left hand side of Windows Explorer. i am able to copy the folder from the treecontrol and paste it on the explorer where ever we need.Also copy and paste operations are occuring with in the tree control.Now i have added unicode support to my application.The copy to clipboard function is failing.when i copy the folder from explorer i am able to paste it in the treecontrol.But when i tried viceversa i am getting an error message like "the file name you specified is not valid or too long.specify a different file name".how can i make the folder copy from the treecontrol.The code i used is , CDropFiles DropFiles; if(!PrepareFileBuff(DropFiles)) { return; } if (OpenClipboard()) { BeginWaitCursor(); ::EmptyClipboard(); HGLOBAL hMem = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, DropFiles.GetBuffSize()); memcpy( (LPTSTR)::GlobalLock(hMem), DropFiles.GetBuffer() ,DropFiles.GetBuffSize() ); ::SetClipboardData (CF_HDROP, hMem ); ::CloseClipboard(); EndWaitCursor(); }
-
my application consists of a treecontrol in which i have displayed system files and folders in a tree control similar to the left hand side of Windows Explorer. i am able to copy the folder from the treecontrol and paste it on the explorer where ever we need.Also copy and paste operations are occuring with in the tree control.Now i have added unicode support to my application.The copy to clipboard function is failing.when i copy the folder from explorer i am able to paste it in the treecontrol.But when i tried viceversa i am getting an error message like "the file name you specified is not valid or too long.specify a different file name".how can i make the folder copy from the treecontrol.The code i used is , CDropFiles DropFiles; if(!PrepareFileBuff(DropFiles)) { return; } if (OpenClipboard()) { BeginWaitCursor(); ::EmptyClipboard(); HGLOBAL hMem = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, DropFiles.GetBuffSize()); memcpy( (LPTSTR)::GlobalLock(hMem), DropFiles.GetBuffer() ,DropFiles.GetBuffSize() ); ::SetClipboardData (CF_HDROP, hMem ); ::CloseClipboard(); EndWaitCursor(); }
radhika28 wrote:
memcpy( (LPTSTR)::GlobalLock(hMem), DropFiles.GetBuffer() ,DropFiles.GetBuffSize() );
Try using
wmemcpy
instead.
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா