-
I need help with the code to execute a dos program. The only code I can find for shell commands is Shell "c:\*\program.exe" (with the optional window format). This format gives me all sorts of errors. If you know how to do this, please help me out. Thanks!
-
This will launch a dos window.
Code:
Shell "C:\Dosprogram.exe", VbNormalFocus
You can also shell a program and use its paremeters.
Code:
Shell ("command.com /c dir /b c:\ > c:\cListing.txt"), vbHide
[Edited by Matthew Gates on 08-02-2000 at 11:17 PM]
-
This works much better you can even send it anything you can type at the run prompt including web pages. Someone asked the other day about it because the standard shell was crashing their win98 computer. This solved their problem
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal HwndInsertAfter As Long, ByVal X As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOACTIVATE = &H10
Public Enum WindowPos
vbtopmost = -1&
vbNotTopMost = -2&
End Enum
Public Sub SetFormPosition(hWnd As Long, Position As WindowPos)
Const wFlags As Long = SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW Or SWP_NOACTIVATE
If Position = vbtopmost Or Position = vbNotTopMost Then
SetWindowPos hWnd, Position, 0, 0, 0, 0, wFlags
End If
End Sub
' call the procedure as follows
'
' call alwaysontop.normal(me.hwnd)
' or
' OnTop (Me.hWnd)
Public Sub OnTop(hWnd As Long)
SetFormPosition hWnd, vbtopmost
End Sub
Public Sub Normal(hWnd As Long)
SetFormPosition hWnd, vbNotTopMost
End Sub