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 


[Visual basic help needed 2].

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
cildor666
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2008
Posts: 95

PostPosted: Tue Sep 23, 2008 12:45 pm    Post subject: [Visual basic help needed 2]. Reply with quote

How do i make my program open up CMD hidden?
Back to top
View user's profile Send private message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Tue Sep 23, 2008 1:30 pm    Post subject: Reply with quote

In VB6 or C++?

C++
Code:
ShellExecute( NULL, "open", "C:\\WINDOWS\\system32\\cmd.exe",NULL, NULL, SW_MINIMIZE);


VB6
Code:
Private Const SW_MINIMIZE As Long = 2 'I think 2 is minimize
Shell "c:\test.exe", SW_MINIMIZE

_________________
What dosen't kill you, usually does the second time.
Back to top
View user's profile Send private message
cildor666
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2008
Posts: 95

PostPosted: Tue Sep 23, 2008 1:49 pm    Post subject: Reply with quote

Visual Basic 2008 Express Confused
Back to top
View user's profile Send private message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Tue Sep 23, 2008 3:43 pm    Post subject: Reply with quote

I think both VB6 code will still work in VB2008. Try it out first.
_________________
What dosen't kill you, usually does the second time.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Sep 23, 2008 4:44 pm    Post subject: Reply with quote

Code:
System.Diagnostics.Process.Start("C:\FAKE\WHAT.EXE")
Back to top
View user's profile Send private message
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Tue Sep 23, 2008 7:14 pm    Post subject: Reply with quote

None of these responses actually answer the question.

If you want to hide the window of the application, you can do it like this:

Code:
Imports System.Runtime.InteropServices

Public Class frmMain

    <DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, _
                      ByVal hWndInsertAfter As IntPtr, _
                      ByVal X As Integer, _
                      ByVal Y As Integer, _
                      ByVal cx As Integer, _
                      ByVal cy As Integer, _
                      ByVal uFlags As UInt32) As Boolean
    End Function

    Private Const SWP_NOSIZE As UInt32 = &H1
    Private Const SWP_NOMOVE As UInt32 = &H2
    Private Const SWP_NOZORDER As UInt32 = &H4
    Private Const SWP_HIDEWINDOW As UInt32 = &H80
    Private Const HIDEWINDOW_FLAGS As UInt32 = SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_HIDEWINDOW

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cmd As Process = Process.Start("cmd.exe", "/k echo This is a command sent to the hidden CMD window!")
        Dim hwnd As IntPtr = 0
        Threading.Thread.Sleep(15)
        hwnd = cmd.MainWindowHandle
        SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
    End Sub

End Class
Back to top
View user's profile Send private message
cildor666
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2008
Posts: 95

PostPosted: Wed Sep 24, 2008 2:53 am    Post subject: Reply with quote

Burningmace wrote:
None of these responses actually answer the question.

If you want to hide the window of the application, you can do it like this:

Code:
Imports System.Runtime.InteropServices

Public Class frmMain

    <DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, _
                      ByVal hWndInsertAfter As IntPtr, _
                      ByVal X As Integer, _
                      ByVal Y As Integer, _
                      ByVal cx As Integer, _
                      ByVal cy As Integer, _
                      ByVal uFlags As UInt32) As Boolean
    End Function

    Private Const SWP_NOSIZE As UInt32 = &H1
    Private Const SWP_NOMOVE As UInt32 = &H2
    Private Const SWP_NOZORDER As UInt32 = &H4
    Private Const SWP_HIDEWINDOW As UInt32 = &H80
    Private Const HIDEWINDOW_FLAGS As UInt32 = SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_HIDEWINDOW

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cmd As Process = Process.Start("cmd.exe", "/k echo This is a command sent to the hidden CMD window!")
        Dim hwnd As IntPtr = 0
        Threading.Thread.Sleep(15)
        hwnd = cmd.MainWindowHandle
        SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
    End Sub

End Class



Thanks, where abouts do i put this code in my project?
Back to top
View user's profile Send private message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Wed Sep 24, 2008 3:35 pm    Post subject: Reply with quote

cildor666 wrote:
...


Thanks, where abouts do i put this code in my project?


I have no idea in VB, but in C++ I would probably put it in a header. So in VB you would probably put it in a Module.

_________________
What dosen't kill you, usually does the second time.
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