Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


deleting files in C++
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 6:59 pm    Post subject: deleting files in C++ Reply with quote

lol i nvr learned, how do i delete files in C++?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing


Last edited by oib111 on Fri Sep 14, 2007 9:35 pm; edited 2 times in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Sep 14, 2007 7:11 pm    Post subject: Re: closing a program in C++ Reply with quote

oib111 wrote:
If I wanted to close a program for examploe lets say an untitled notepad, can i do it this way?
WM_QUIT isn't send to the window message queue.. WM_CLOSE is, but it only closes the window.
oib111 wrote:
Oh and is there anyway to send the WM_QUIT message to notepad, like all notepad files instead of only the untitled one.
Code:
HWND notepadHWND;
do {
   notepadHWND = ::FindWindow( TEXT("Notepad"), NULL );
   if(notepadHWND) {
      ::PostMessage(notepadHWND, WM_QUIT, 0, NULL);
      ::Sleep(10) // Give it some time to quit
   }
} while(notepadHWND!=NULL);


PS. It's almost 5 am, I hope I got it right :p
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Sep 14, 2007 7:14 pm    Post subject: Reply with quote

send the message WM_CLOSE and WM_DESTROY or maybe just WM_DESTROY because when you send close it sends destroy
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 7:16 pm    Post subject: Reply with quote

Ok, well, now I really need to know how to close a process.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Sep 14, 2007 7:18 pm    Post subject: Reply with quote

oib111 wrote:
Ok, well, now I really need to know how to close a process.
WM_QUIT I believe. If you want to terminate it, use ::TerminateProcess.

My example is working btw (w/ notepad at least)...
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 7:51 pm    Post subject: Reply with quote

hidden process, such as idk, lets take something from task manager. Ah, like if I watned to close nvsvc32.exe, how?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Sep 14, 2007 7:54 pm    Post subject: Reply with quote

going by the name "nvsvc32.exe" I'm guessing it's a service. To stop that you would go through the service control manager (ControlService with SERVICE_CONTROL_STOP)
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 8:08 pm    Post subject: Reply with quote

how about if i just made a program and made it a hidden process and made it not have a window, what would i do to close it from another program? Btw, is there anyway to take a program and make it a child window to your program so you can access its info + close it?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Sep 14, 2007 8:27 pm    Post subject: Reply with quote

yes, set up pipes for communication and when you want it to close you can send it a message that the program will interpret as close.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 9:36 pm    Post subject: Reply with quote

ok, but how i delete files in C++?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Sep 14, 2007 9:37 pm    Post subject: Reply with quote

with the aptly named DeleteFile function.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 9:38 pm    Post subject: Reply with quote

ooo fast responder , lol , thx

edit:

Code:

DeleteFile("bla.txt");


or

Code:

DeleteFile("C:\Documents and Settings\OIB\Desktop\bla.txt");


I mean I know it says filename, but what if you have more than one file with the same name? Wouldn't you need file path?

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Sep 14, 2007 9:44 pm    Post subject: Reply with quote

You can't have two files with the same name in the same directory. Use the full path.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 14, 2007 9:48 pm    Post subject: Reply with quote

I know, but what if you had two files named the same thing but in different directories, would it delete both?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Sep 14, 2007 9:51 pm    Post subject: Reply with quote

oib111 wrote:
I know, but what if you had two files named the same thing but in different directories, would it delete both?


No, of course not.

How the hell would: DeleteFile("C:\\path\\path\\path\\file.txt");
delete "C:\file.txt"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites