Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

running C code under C++

gilmour81gilmour81 Member Posts: 3
Hi, i am a beginner in this C++ programming but i try to make it simple:
I wrote a GUI using VS c++( edit boxes and buttons )using MFC, in c++ which gets some parameters from edit box and store it in variables .... now i need to use these parameters in order to run an algorithm for audio processing which is written in C and uses specific libraries ..
I would like to know:
-how do i run the C program (in console mode) from within my c++ GUI
-is this the right way to do it or should i create the GUI in C as well
-what is the best way to write a GUI in C?( win API 32 or any open source tools ?)

thank you I am really stuck in this issue..

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    how to execute and already compiled exe program is not relevant to how you wrote your gui program. Just call win32 api function CreateProcess() from within your MFC application (there are other less useful functions too).
  • gilmour81gilmour81 Member Posts: 3
    : how to execute and already compiled exe program is not relevant to how you wrote your gui program. Just call win32 api function CreateProcess() from within your MFC application (there are other less useful functions too).
    :
    thx for your help so far..
    I am still in trouble...I am actually able now to open up the Console but it closes imeedietaly after a millisecond ... basically i would like to open the console and launch my C file ( displaypar or whatver ) and be able to see my results before it closes...here i show some piece of my code

    GUI stuff .....
    .....
    void CPassingbyDlg::OnOK() // member function of CPassingbyDlg
    {
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    DWORD dwCode = 0;
    ZeroMemory ( &si, sizeof ( STARTUPINFO));

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

    CreateProcess( NULL,"c:\documents and ettings\marco\documents\displaypar 7 8",NULL,NULL,0,CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi);
    CDialog::OnOK();
    }

    is there a way to keep the console open and wait for a key to be pressed?

    thx


Sign In or Register to comment.