I'm trying to learn the basics of WinAPI by writing a frontend for a console program in C.
However, I'm not sure what is the function to call my command-line program. After some research, I found WinExec, CreateProcess and ShellExecute, but I'm not sure what I should use.
My program consists basically of a combobox with some values and a Open File dialog. What I want it to do is run "myconsole.exe input_file combox_argument", and myconsole.exe is supposed to be in the same folder as the frontend.
Using WinExec, I got my program to open in a console window, but if I choose a input_file outside of the myconsole.exe directory, winExec can't run it, I guess that's because he is trying to run from the last directory (the one where input_file was). A few questions:
1 - How can I save the current directory (when you open the program) in a variable so I can have a string with the app_link (ie, C:\current_path\my_console.exe) ?
2 - What function should I use?
3 - Can I read return values from the console application (to know if the operation was sucessfull) ?
Any source code examples from a front-end would also be nice.
Thanks in advance