Batch File and CreateProcess "Check"

Hello,
For months now I've been trying to open and run a Dos program using Builder C++ and CreateProcess. The only way I can get the Com ports to work properly with the Dos program in Windows95\98 is with a Batch file and CreateProcess. I have pieced together a CreateProcess and batch file, which I would like someone to check before I add this into the final program. I'm not 100% sure if what I have is needed or not, or am I missing something. One Problem to note is that once I close the Dos program the Com port stays open. This is another issue.

Thanks
Clinton

//Batch File

@echo off
cls
C:
CD  "\Hi-Tech Software\JCM\CBA\CBATOOL"
CBATOOL.exe


//CreateProcess


void __fastcall TFormMain::ButtonCBAToolClick(TObject *Sender)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;

 memset (&pi, 0, sizeof(pi));
 memset (&si, 0, sizeof(si));

 si.cb = sizeof(si);
 si.dwFlags |=STARTF_USESHOWWINDOW;
 si.wShowWindow|=SW_SHOWNORMAL;


 if ( !CreateProcess (
            NULL,
            //"command.com /c \"C:\\Hi-Tech Software\\JCM\\WBA\\Adj\\adj10.bat\"",
            "command.com /c \"C:\\Hi-Tech Software\\JCM\\CBA\\CBATOOL\\CBATOOL.BAT\"",
            //"C:\\Hi-Tech Software\\JCM\\CBA\\CBATOOL\\CBATOOL.EXE",
            NULL,
            NULL,
            false,
            CREATE_NEW_CONSOLE,
            NULL,
            NULL,
            &si,
            &pi))
            {
          MessageBox(0, "Could not execte program \n Please contact software author.", "Error", MB_ICONSTOP);
            }
    {
    CloseHandle(&pi.hProcess);
    CloseHandle(&pi.hThread);
    }

}




Clinton112299Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Matthew85HCommented:
easy folks, use the system() command, in (I think) stdlib.h

example:

system("win");

it works just like a batch.

http://fly.to/sflare
0
Clinton112299Author Commented:
Matthew,
I don't understand what you mean with System("Win")?


Clinton
0
Matthew85HCommented:
In DOS you type "win" to goto windows right? you type dir to browse through folders right? same thing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.