Howdy, Stranger!

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

Categories

Starting another Windows .exe with C++Code//Deleting a File

Jun_MisugiJun_Misugi Member Posts: 5
I use Visual C++ 6.0.
I've got two problems.
First I want to start an Exe File when klicking a Button in my Application. What do I have to write into the BnClicked Funktion?

Second I want to delete a Text file, which I have accessed with:

ifstream fin("info");
char str(80);
int i;
fin>>str>>i;
MessageBox(str+" "+i);
fin.close();

So after reading the Data out of the File, I want to delete it. What is the easiest way to do this.


PS.: Please keep it simple since I'm a Newbie in C++ programming and the programm mustn't be absolut professional.

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : I use Visual C++ 6.0.
    : I've got two problems.
    : First I want to start an Exe File when klicking a Button in my Application. What do I have to write into the BnClicked Funktion?
    :
    [blue]In the resource editor, just double-click the button. ClassWizzard will create a function for you.[/blue]

    : Second I want to delete a Text file, which I have accessed with:
    :
    : ifstream fin("info");
    : char str(80);
    : int i;
    : fin>>str>>i;
    : MessageBox(str+" "+i);
    : fin.close();
    :
    : So after reading the Data out of the File, I want to delete it. What is the easiest way to do this.
    :
    :
    : PS.: Please keep it simple since I'm a Newbie in C++ programming and the programm mustn't be absolut professional.
    :
    [code]
    remove("filename");
    [/code]

  • tfkyletfkyle Member Posts: 15
    : : I use Visual C++ 6.0.
    : : I've got two problems.
    : : First I want to start an Exe File when klicking a Button in my Application. What do I have to write into the BnClicked Funktion?
    : :
    : [blue]In the resource editor, just double-click the button. ClassWizzard will create a function for you.[/blue]
    :
    : : Second I want to delete a Text file, which I have accessed with:
    : :
    : : ifstream fin("info");
    : : char str(80);
    : : int i;
    : : fin>>str>>i;
    : : MessageBox(str+" "+i);
    : : fin.close();
    : :
    : : So after reading the Data out of the File, I want to delete it. What is the easiest way to do this.
    : :
    : :
    : : PS.: Please keep it simple since I'm a Newbie in C++ programming and the programm mustn't be absolut professional.
    : :
    : [code]
    : remove("filename");
    : [/code]
    :
    :

    also for the line
    char str(80);
    it should be restated to
    char str[80];
    or
    char *str = new char[80];
    seing that an arry is defined by [] brackets
    TFKyle

  • Jun_MisugiJun_Misugi Member Posts: 5
    [b][red]This message was edited by Jun_Misugi at 2003-7-6 4:16:21[/red][/b][hr]
    : [blue]In the resource editor, just double-click the button. ClassWizzard will create a function for you.[/blue]
    : [code]
    : remove("filename");
    : [/code]
    First: I think I made my self missunderstood. I actually have this function you described, but with this function I want to start another .Exe outside my Programm.
    [code]
    void Admin::OnInsertMember()
    {
    //Starting "Login.exe" here
    }
    [/code]
    And now I need some code to start this Login.exe.

    Second: Thanks, that's what I wanted.

    @TFKey: Thanks, typing error which I have already corrected in my code.
  • stoberstober Member Posts: 9,765 ✭✭✭
    : First: I think I made my self missunderstood. I actually have this function you described, but with this function I want to start another .Exe outside my Programm.
    : [code]
    : void Admin::OnInsertMember()
    : {
    : //Starting "Login.exe" here
    : }
    : [/code]
    : And now I need some code to start this Login.exe.
    :

    [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
  • Jun_MisugiJun_Misugi Member Posts: 5
    : [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
    :
    Thats what I wanted. Thx.
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : : [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
    : :
    : Thats what I wanted. Thx.
    :

    What about ShellExecute? Or is that just VB (Cause I am a VB programmer... learning C++ MFC!)

    Greets...
    Richard

  • stoberstober Member Posts: 9,765 ✭✭✭
    : : : [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
    : : :
    : : Thats what I wanted. Thx.
    : :
    :
    : What about ShellExecute? Or is that just VB (Cause I am a VB programmer... learning C++ MFC!)
    :
    : Greets...
    : Richard
    :
    :

    yup! look it up at www.msdn.microsoft.com to find out how to use it.

Sign In or Register to comment.