CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2009
    Posts
    2

    Question Can System XCopy source paths from textboxes?

    Hi, can someone help?

    A Typical xcopy:

    System("xcopy /y /s /e /f source path destination path").

    Is it possible for the xcopy to locate the source path and destination path from
    a text box within the same form?

    The form has two folderbrowserdialogs which paste the paths selected into
    two textboxes. source being textBox1 and destination being textBox2.

    I thought it would be a simple case of naming the textboxes in place of source
    and destination.

    For example:

    System("xcopy /y /s /e /f textBox1 textBox2");

    I also tried:

    System("xcopy /y /s /e /f textBox1.Text textBox2.Text");

    However, they don't work, but don't report any errors either.

    can someone suggest something?
    I can't seem to find the answer browsing the internet.

    Thanks

    OMEGA

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Can System XCopy source paths from textboxes?

    In the case of MFC:
    Code:
    CString strSystem;
    CString strSource;
    CString strDestination;
    textBox1.GetWindowText(strSource);
    textBox2.GetWindowText(strDestination);
    strSystem.Format(_T("xcopy /y /s /e /f %s %s"), strSource, strDestination);
    System(strSystem);
    Victor Nijegorodov

  3. #3
    Join Date
    May 2009
    Posts
    2

    Re: Can System XCopy source paths from textboxes?

    Thanks for the reply VictorN,

    That looked perfect for the job.
    Unfortunately i'm using the free edition of visual c++ 2008 express.
    The Microsoft Foundation Class library isn't included.

    do you know of an alternative?

    Thanks

    OMEGA

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Can System XCopy source paths from textboxes?

    Use TCHAR[MAX_PATH] character arrays to get texts from controls and _stprintf to format the System string.
    Victor Nijegorodov

Tags for this Thread

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