Results 1 to 2 of 2

Thread: A ms-dos prompt related question

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    47

    Question 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

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    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:
    1. 'in a module
    2. 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
    3. Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpzString As String) As Long
    4.  
    5. 'to get the hWnd of a DOS prompt (this gets the first one it sees, if any)
    6. Dim hWndDOS As Long
    7. hWndDOS = FindWindowEx(0, 0, "tty", vbNullString)
    8. 'to set a new caption in that window
    9. 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
  •  



Click Here to Expand Forum to Full Width