|
-
Jul 21st, 2001, 05:01 PM
#1
Thread Starter
Member
A ms-dos prompt related question
Hau!
A question about Visual Basic 6.0 SP5 in Windows ME:
Is there a way to run MS-Dos prompt in a VB-form? I mean that I would shell a exe and it should run in a window (created in vb) not in ms-dos prompt -window (as normally it would). Or if this is not possible how to run a program in a normal ms-dos prompt window but modify the title of window, e.g. "MS-Dos Prompt typhon.exe" to "MS-Dos Prompt typhon.exe - My app's name" or even better to "My app's name"?
Thanks a lot!!
BigL
-
Jul 21st, 2001, 05:29 PM
#2
Fanatic Member
If you really wanted a DOS prompt to appear inside a VB form, you could use SetParent on the hWnd of the DOS prompt to make it a child window of your form, but that isn't really very useful. It's still possible though. If you want to change the text that appears in the caption of the window, you'll need to use this.
VB Code:
'in a module
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal hWndChild As Long, ByVal lpzClassName As String, ByVal lpzCaption As String) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpzString As String) As Long
'to get the hWnd of a DOS prompt (this gets the first one it sees, if any)
Dim hWndDOS As Long
hWndDOS = FindWindowEx(0, 0, "tty", vbNullString)
'to set a new caption in that window
SetWindowText hWndDOS, "A new caption"
The class of a DOS prompt window is "tty" in Win98, so it should still be the same in ME. I don't know about any Win version that's higher though.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
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
|