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 


Executing DOS commands in VB6

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kosstr12
Master Cheater
Reputation: -1

Joined: 12 Jul 2008
Posts: 339

PostPosted: Tue Jan 13, 2009 7:09 pm    Post subject: Executing DOS commands in VB6 Reply with quote

Is there an easy way to do it without running a batch file? I would rather just have it run the command without having to open up the command line.

Thanks.
Back to top
View user's profile Send private message
Stonehenge
Master Cheater
Reputation: 0

Joined: 03 Oct 2008
Posts: 280
Location: Unknown Jumphole

PostPosted: Wed Jan 14, 2009 4:18 pm    Post subject: Reply with quote

Taken from http://www.codeguru.com/forum/showthread.php?s=&threadid=26939&highlight=dos
Code:

'This code will create "abcd" directory in current Path.
'You cannot debug normally: to work this need the dos
'window to have focus
'If you want to see dos window, comment the
'last commands that close that window
option Explicit

private Sub Command1_Click()

Dim strCommand as string
Dim retPointer as Long

'
'if winNt
retPointer = Shell("cmd.exe", vbMaximizedFocus)

'if win98/95/me, the following:
'retPointer = Shell("command.exe", vbMaximizedFocus)
'
'launch a command:
'activate the dos window
AppActivate retPointer
'put the command in string variable -start with a space!-
strCommand = " mkdir abcde"
'write it to the dos window:
SendKeys strCommand, true
'you've just typed something. Need to press enter?
SendKeys "{ENTER}", true

'close dos windows:
SendKeys "Exit", true
SendKeys "{ENTER}", true
End Sub


It was the very first result in Google...

_________________
Back to top
View user's profile Send private message
Tyggo
Expert Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 186

PostPosted: Wed Jan 14, 2009 4:28 pm    Post subject: Reply with quote

I don't see that working very well but how I did it in VB9 (Visual Basic 2008) was

Code:
dim command as string
command = "ping google.com"
Shell ("cmd.exe /k" & ping, AppWinStyle.NormalFocus)


Replace the command string with whatever command you want to execute.


Oh, nevermind, I didn't see that you said without command prompt, that would be impossible... :/


Last edited by Tyggo on Wed Jan 14, 2009 4:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Wed Jan 14, 2009 4:28 pm    Post subject: Reply with quote

How about GetStdHandle and WriteFile?
Back to top
View user's profile Send private message MSN Messenger
kosstr12
Master Cheater
Reputation: -1

Joined: 12 Jul 2008
Posts: 339

PostPosted: Wed Jan 14, 2009 5:20 pm    Post subject: Reply with quote

Obidos wrote:
Taken from http://www.codeguru.com/forum/showthread.php?s=&threadid=26939&highlight=dos
Code:

'This code will create "abcd" directory in current Path.
'You cannot debug normally: to work this need the dos
'window to have focus
'If you want to see dos window, comment the
'last commands that close that window
option Explicit

private Sub Command1_Click()

Dim strCommand as string
Dim retPointer as Long

'
'if winNt
retPointer = Shell("cmd.exe", vbMaximizedFocus)

'if win98/95/me, the following:
'retPointer = Shell("command.exe", vbMaximizedFocus)
'
'launch a command:
'activate the dos window
AppActivate retPointer
'put the command in string variable -start with a space!-
strCommand = " mkdir abcde"
'write it to the dos window:
SendKeys strCommand, true
'you've just typed something. Need to press enter?
SendKeys "{ENTER}", true

'close dos windows:
SendKeys "Exit", true
SendKeys "{ENTER}", true
End Sub


It was the very first result in Google...


I've seen that. It didn't work.

@Tyggo: Okay, well I guess I'll find some other way, thanks.
Back to top
View user's profile Send private message
pkyourface
Master Cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 252

PostPosted: Wed Jan 14, 2009 6:11 pm    Post subject: Reply with quote

This should be what your looking for, can be used locally or remotely.


The Extension 'zip' was deactivated by an board admin, therefore this Attachment is not displayed.

Back to top
View user's profile Send private message
Tyggo
Expert Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 186

PostPosted: Thu Jan 15, 2009 8:18 pm    Post subject: Reply with quote

kosstr12 wrote:
Obidos wrote:
Taken from http://www.codeguru.com/forum/showthread.php?s=&threadid=26939&highlight=dos
Code:

'This code will create "abcd" directory in current Path.
'You cannot debug normally: to work this need the dos
'window to have focus
'If you want to see dos window, comment the
'last commands that close that window
option Explicit

private Sub Command1_Click()

Dim strCommand as string
Dim retPointer as Long

'
'if winNt
retPointer = Shell("cmd.exe", vbMaximizedFocus)

'if win98/95/me, the following:
'retPointer = Shell("command.exe", vbMaximizedFocus)
'
'launch a command:
'activate the dos window
AppActivate retPointer
'put the command in string variable -start with a space!-
strCommand = " mkdir abcde"
'write it to the dos window:
SendKeys strCommand, true
'you've just typed something. Need to press enter?
SendKeys "{ENTER}", true

'close dos windows:
SendKeys "Exit", true
SendKeys "{ENTER}", true
End Sub


It was the very first result in Google...


I've seen that. It didn't work.

@Tyggo: Okay, well I guess I'll find some other way, thanks.


Well, to execute CMD commands you we need to have it open...
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
Page 1 of 1

 
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