| View previous topic :: View next topic |
| Author |
Message |
cildor666 Advanced Cheater
Reputation: 0
Joined: 08 Mar 2008 Posts: 95
|
Posted: Tue Sep 23, 2008 12:45 pm Post subject: [Visual basic help needed 2]. |
|
|
| How do i make my program open up CMD hidden?
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Tue Sep 23, 2008 1:30 pm Post subject: |
|
|
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 |
|
 |
cildor666 Advanced Cheater
Reputation: 0
Joined: 08 Mar 2008 Posts: 95
|
Posted: Tue Sep 23, 2008 1:49 pm Post subject: |
|
|
Visual Basic 2008 Express
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Tue Sep 23, 2008 3:43 pm Post subject: |
|
|
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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Sep 23, 2008 4:44 pm Post subject: |
|
|
| Code: | | System.Diagnostics.Process.Start("C:\FAKE\WHAT.EXE") |
|
|
| Back to top |
|
 |
Polynomial Grandmaster Cheater
Reputation: 5
Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
|
Posted: Tue Sep 23, 2008 7:14 pm Post subject: |
|
|
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 |
|
 |
cildor666 Advanced Cheater
Reputation: 0
Joined: 08 Mar 2008 Posts: 95
|
Posted: Wed Sep 24, 2008 2:53 am Post subject: |
|
|
| 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 |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Wed Sep 24, 2008 3:35 pm Post subject: |
|
|
| 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 |
|
 |
|