« first day (1 day earlier)  last day (15 days later) » 

5:29 PM
Hey there, I thought that I would invite you back to chat because I still have some questions based off of the question that you answered for me
 
 
1 hour later…
6:46 PM
sure
email me at jos.trem@gmail.com if you like
 
Would you rather do that than talk here?
 
here is fine. didn't know if you were online
 
I am =)
So anyway, the goal of opening this exe is to load a file into it to produce another file
 
OK
 
and I am translating from c++
So now that I can open the exe, I need to figure out how to replicate all of the parameters from the c++ code
and I get confused because I don't understand all of the C++ code, and am unsure on what I need to do
 
6:55 PM
which params are you having trouble with?
or what behavior do you need to be different?
 
Well if we start from the top with:
  STARTUPINFO si;         // Startup information structure
  PROCESS_INFORMATION pi; // Process information structure

  memset(&si, 0, sizeof(STARTUPINFO)); // Initializes STARTUPINFO to 0
  si.cb = sizeof(STARTUPINFO); // Set the size of STARTUPINFO struct
Do I need to declare STARTUPINFO and PROCESS_INFORMATION?
 
not sure why you are approaching it like this.
I'd be primarily concerned with how the C# is behaving.
 
What do you mean?
 
but...
 
Right now the C# just runs the exe, but doesn't do all of the manual operations that the C++ does
 
6:57 PM
what do I mean? well, is the exe spawning, running, producing the desired output, is it's window visible or invisible as desired?
what do you mean by "manual operations"?
in the C# are you passing in the same cmdln params? (". -a")
 
The exe is spawning. It flashes onto the screen and then goes away. And no I'm not
Sorry if I appear a little clueless. I've been given a project that is a little over my head. I'm an intern.
 
no problem.
take a look at the documentation for ProcessStartInfo
the first item is a string property called Arguments
set startInfo.Arguments = ". -a" before calling Process.Start(startInfo)
 
Okay, so it obviously goes through a cmd line command when starting the exe
 
what you are saying doesn't make sense "goes through a cmd line"
it is providing parameters to an exe
 
So those parameters are going to the exe that I spawn?
 
7:04 PM
"cmd line" is just lingo for a shell
yes
so it is not running cmd.exe and then running your program with arguments
 
So what is it doing?
 
starting a new process
 
Okay, so after I start my process I need to pass it those params?
 
in your case it is no different than setting up a shortcut on the desktop and double-clicking it
 
So you're saying that the process is that simple?
 
7:07 PM
set startInfo.Arguments = ". -a" before calling Process.Start(startInfo)
 
Okay, I just did that, but what about the other params?
"Configuration","CRTVSM","CRTVSM.EXE"
CRTVSM.EXE is my exe
 
right
 
So now I have:
 
the other param "CRTVSM" is the name of your process too, the windows api to launch a process always takes the exe name twice. kinda goofy. Process.Start hides that from you.
 
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CRTVSM.EXE");
            ProcessStartInfo startInfo = new ProcessStartInfo(path);

            startInfo.Arguments = ".-a";

            Process.Start(startInfo);
 
7:10 PM
that looks good to me. how is it working?
 
I still does the same thing, flashes and goes away. This is okay as long as there were no changes to the file. However, it doesn't create the file that it is supposed to yet. I'm guessing that we're not done.
 
oh, and the Config->ReadString("Configuration" ... is something I'm not familiar with. Possibly reading from a config file?
can you run the C++ and put a breakpoint in it to see exactly what the CmdLine var holds?
 
Yeah, it's actually an .INI file, I guess I'll just add it to the same location as the exe
With that being said, where do I add the Config->ReadString("Configuration" ...?
 
that is just providing you with the parameters to run the exe. Forget about it for the moment. Get to where you can hardcode the proper values into startInfo (the exe path and the parameters) so that the things runs correctly.
take a look at this:
 
Is this part what you are referring to?:
                  rtncod = (short)CreateProcess(
                  NULL,   // pointer to name of executable module
                  CmdLine.c_str(), // pointer to command line string
                  NULL,   // pointer to process security attributes
                  NULL,   // pointer to thread security attributes
                  FALSE,   // handle inheritance flag
                  CREATE_NEW_CONSOLE, // creation flags
                  NULL,   // pointer to new environment block
                  NULL,   // pointer to current directory name
 
7:21 PM
??
 
You said that I have to hardcode the proper values into startInfo
What did you mean by that? Like where does that happen in the c++ code, and where would I put it in the c# code?
 
I was saying concentrate on getting Process.Start to run in C# by configuring a ProcessStartInfo object and passing
what I'm saying is work on getting this to work:
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CRTVSM.EXE");
ProcessStartInfo startInfo = new ProcessStartInfo(path);

startInfo.Arguments = ".-a";

Process.Start(startInfo);
 
It does
 
but it doesn't if the program isn't running as expected.
are the Arguments correct?
can you run the crtvsm.exe at the command prompt, provide it with arguments, and watch it run correctly?
once you can do that, then you should be able to write the c# Process.Start easily
 
Oh, you mean that I need to pass the correct arguments to the exe
Isn't that this line?: AnsiString CmdLine = Config->ReadString("Configuration","CRTVSM","CRTVSM.EXE . -a");
in the c++
 
7:26 PM
and my question to you earlier : what is the value of CmdLine after that line is executed in C++?
and I have to go now. sorry.
 
That's okay. I have to locate a few things before we can proceed anyway
thank you for your help, I will talk to you another time =)
 

« first day (1 day earlier)  last day (15 days later) »