CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: copy files

  1. #1
    Join Date
    May 1999
    Posts
    6

    copy files

    Hello,
    Does anybody know how to implement Copy files in our application,
    and can be paste in Windows explorer ?
    I mean that after copying files in your application ,you can selete munu item "paste" in Windows Explorer to paste the files in selected directory.

    Thanks in advanced.
    Best Regards
    Gloria


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: copy files

    you can use the SHFileOperation function to copy files. Set the wFunc member of the SHFILEOPSTRUCT structure to FO_COPY.


  3. #3
    Join Date
    May 1999
    Posts
    6

    Re: copy files

    Thank you for your help.
    But in SHFILESTRUCT ,member pTo still need to
    identify the destination to copy files,but in
    Windows Explorer, unless user click paste menu
    item,we will have no idea where the destination
    will be.


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: copy files

    Ok, then, I thought it was a two-part question. One for copying files and the other...

    Well, if you want to copy the filenames to the clipboard so that explorer "knows" how to paste it, you have to do it via the Clipboard.
    You have to register a clipboard format using RegisterClipboardFormat and specify CFSTR_FILENAME as format identifier.
    Read the details on MSDN "Clipboard Formats for Shell Data Transfers"


  5. #5
    Join Date
    Jul 2004
    Posts
    7

    Question Re: copy files

    I had a similar problem, i try to copy a file in my application which support unicode.
    I registered o format
    UINT format = Registerclipboardformat(_T("FileName"))

    and then i used this format for setting the data on clipboard

    Setclipboarddata(format,hclipboarddata)

    but it doesnot paste the entire file path(E:\test.txt) on clipboard, instead it pastes only first drive letter for eg E.

    could you help me on this?

    Regards
    Vineet

  6. #6
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: copy files

    You can also use CopyFile.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  7. #7
    Join Date
    Jul 2004
    Posts
    7

    Re: copy files

    CopyFile is a scripting function...can it be used in c++??

    vineet

  8. #8
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: copy files

    Quote Originally Posted by er_vineetb
    CopyFile is a scripting function...can it be used in c++??

    vineet
    CopyFile would be a scripting function or not but there is one CopyFile also in Windows API.
    Of course you can use it in C++.
    Last edited by ovidiucucu; May 12th, 2005 at 06:28 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured