|
-
Oct 19th, 2000, 08:38 AM
#1
Thread Starter
Member
let say i do a shell command,
example:
a=shell("format a:",VBHIDE)
and when i push a command button,
i want to put the a=shell("format a:,VBHIDE)
in VBNORMAL, so the process of dos pops in the user's face
is there a way to do that
thanxs
-
Oct 19th, 2000, 08:56 AM
#2
Frenzied Member
Hey, how are you doing?
use this code 
Code:
Private Sub Form_Load()
a=shell("format a:",VBNORMAL)
ShowHideWindow("MYCLASSNAME", "ORMYCAPTION", False)
End Sub
Private Sub Command1_Click()
ShowHideWindow("MYCLASSNAME", "ORMYCAPTION", True)
End Sub
'[begin of code]
'Author: Jop
'Origin: Inspired by some post on this forum (can't remember who)
'Purpose: Show or hide a window without unloading it.
'Version: VB5+
'Api calls
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Dim Myhwnd As Long, showme As Integer
Private Sub ShowHideWindow(Classname As String, WindowCaption As String, Show As Boolean)
If Classname = "" Then Classname = vbNullString
If WindowCaption = "" Then WindowCaption = vbNullString
'Find the window by either his classname or caption
Myhwnd = FindWindow(Classname, WindowCaption)
'if found
If Myhwnd <> 0 Then
If Show = True Then
showme = 5
Else
showme = 0
End If
'Show or hide the window
ShowWindow Myhwnd, showme
End If
End Sub
'Usage:
'ShowHideWindow "MYHANDLE", "MYCAPTION", True/False
'[end of code]
Have fun with it man
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 19th, 2000, 09:32 AM
#3
Thread Starter
Member
hide-normal focus
hey man what's up,little problem
do u just write "MYCLASSNAME","ORMYCAPTION" in the parameter sent to the ShowHideWindow
-
Oct 19th, 2000, 09:47 AM
#4
Frenzied Member
The ORMYCAPTION = the caption of the window, the MYCLASSNAME is the classname of the window, so just choose between the 2, if the window you opened has an classname like Calculator then use
ShowHideWindow("","Calculator",false)
to hide the Calculator.
I believe the shelled Format a: has a classname called WinOldApp, so you could do:
ShowHideWindow("WinOldApp","",True)
to show the Format Dialog.
Have fun
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 19th, 2000, 09:56 AM
#5
Thread Starter
Member
final one
what if my shell include batch files
example shell("c:\test.bat")
is there a class for that
thanxs for your time
-
Oct 19th, 2000, 10:07 AM
#6
Frenzied Member
That's probably the same as the caption name (Ended: test.bat or something )
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|