0

I hava a prooject that uses ShellExecuteInfo and it works fine as log as you don't want to change the name of the file.

SHELLEXECUTEINFO fei;
      fei.cbSize=sizeof(SHELLEXECUTEINFO);  
      fei.fMask=SEE_MASK_NOCLOSEPROCESS;
      fei.hwnd=GetDesktopWindow();
      fei.lpVerb="Open";
      fei.lpFile="C:\\Program Files\\WinZip\\wzzip.exe";
      fei.lpParameters="-a+ -r -P -whs -x@nobackup.txt C:\\Progra~1\\DIR\\DIR\\Data\\ful.zip @backup.txt";
      fei.lpDirectory="C:\\Program Files\\Patches\\GLB\0";
      fei.nShow=SW_HIDE;
      fei.hProcess;

I would like to be able to replace the "C:\\Progra~1\\DIR\\DIR\\Data\\ful.zip" with a variable newName that takes information from a user.

Thank you for any help
Nirliq

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Nirliq
0

How are you currently trying to change it? And, what exactly goes wrong when you do try to change it?

0

Hi thank you for answering.

Today I thought of going another route and letting the program run as usual then when the Shellexecute completes then rename the file and move on.

WaitForSingleObject(fei.hProcess, 1000000);
      //rename the file here
      AnsiString newName = MainForm->nbn; //get the new name from the mainform

      RenameFile( "C:\\Program Files\\Patches\\GLB\\Data\\ful.zip\0",
                  "C:\\Program Files\\Patches\\GLB\\Data\0" + newName);

I get the name from a user input form the sets it into a string variable called nbn I also have it going into a label on the main form.

If I use the following it works fine:

RenameFile( "C:\\Program Files\\Patches\\GLB\\Data\\ful.zip\0",
                  "C:\\Program Files\\Patches\\GLB\\Data\\MyNewName.zip\0")

Once agian
Thank you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.