C++ MFC

Moderators: Lundin
Number of threads: 3354
Number of posts: 9032

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Starting another Windows .exe with C++Code//Deleting a File Posted by Jun_Misugi on 5 Jul 2003 at 9:06 AM
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.
Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by stober on 5 Jul 2003 at 2:14 PM
: 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?
:
In the resource editor, just double-click the button. ClassWizzard will create a function for you.

: 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.
:
   remove("filename");


Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by tfkyle on 6 Jul 2003 at 4:06 AM
: : 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?
: :
: In the resource editor, just double-click the button. ClassWizzard will create a function for you.
:
: : 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.
: :
:
:    remove("filename");
: 

:
:

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

Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by Jun_Misugi on 6 Jul 2003 at 4:14 AM
This message was edited by Jun_Misugi at 2003-7-6 4:16:21

: In the resource editor, just double-click the button. ClassWizzard will create a function for you.
:
:    remove("filename");
: 

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.
void Admin::OnInsertMember() 
{
	//Starting "Login.exe" here
}

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.
Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by stober on 6 Jul 2003 at 5:36 AM
: 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.
:
: void Admin::OnInsertMember() 
: {
: 	//Starting "Login.exe" here
: }
: 

: And now I need some code to start this Login.exe.
:

use either CreateProcess() or WinExec() or system() functions.
Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by Jun_Misugi on 7 Jul 2003 at 3:43 AM
: use either CreateProcess() or WinExec() or system() functions.
:
Thats what I wanted. Thx.
Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by BitByBit_Thor on 18 Jul 2003 at 2:33 PM
: : use either CreateProcess() or WinExec() or system() functions.
: :
: Thats what I wanted. Thx.
:

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

Greets...
Richard

Report
Re: Starting another Windows .exe with C++Code//Deleting a File Posted by stober on 18 Jul 2003 at 3:49 PM
: : : use either CreateProcess() or WinExec() or system() functions.
: : :
: : 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.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.