Results 1 to 7 of 7

Thread: Killing Dos window

  1. #1

    Thread Starter
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    Try:
    ..........................
    AppActivate apptitle
    SendKeys "%{F4}"
    .........................
    I am just aman.

  2. #2
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512

    Killing Dos window

    Does anybody know how to FORCE a Dos window to close?
    I have the code to find the window handle and kill it but it only works properly in Windows2000. In Windows 98 I get the box that says 'Windows cannot shut down this program automatically......". I dont know why it works in Win2k but gives me different results in 98 but i wondered if anyone knew a way to FORCE it to die. Its founf the window OK and has attempted to kill it but because the program i running in the DOS window, Windows is warning me about losing information which i dont care about anyway.

    The following code is what I use:

    VB Code:
    1. Private Sub KillDosWindow()
    2.     Dim WHwnd As Long
    3.     Const NILL = 0&
    4.     Const WM_SYSCOMMAND = &H112
    5.     Const SC_CLOSE = &HF060&
    6.    
    7.     WHwnd = FindWindow(vbNullString, App.Path & "\CDDA32\CDDA32.EXE")
    8.     If WHwnd = 0 Then
    9.         WHwnd = FindWindow(vbNullString, "CDDA32.EXE")
    10.         If WHwnd = 0 Then
    11.             WHwnd = FindWindow(vbNullString, "CDDA32")
    12.         End If
    13.     End If
    14.    
    15.     If WHwnd <> 0 Then
    16.         Handle = SendMessage(WHwnd, WM_SYSCOMMAND, SC_CLOSE, NILL)
    17.     End If
    18. End Sub

    Any help would be top
    Thanks in advance
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  3. #3
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512

    Dongaman

    Im using Appactivate "CDDA32"

    As CDDA32 is the name of my DOSBOX window title. It closes my whole app and leaves the Dosbox open!! It says something about 'You cant use SendKeys to close an app not designed to run in Microsoft Windows' in the MSDN on the microsoft website.
    I assume they mean CDDA as its a Dos application. I would have assumed that it would have killed the DOS window though!
    Any other suggestions?
    Last edited by Blobby; Nov 27th, 2001 at 04:09 AM.
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  4. #4

    Thread Starter
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    I do not know more about of CDDA32.But it is a 16bit app because it run in DOSBOX.The short key "ALT+F4" can end almost
    all 32bit app.
    I am just aman.

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    but will not work for DOS programs...

  6. #6

    Thread Starter
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    but will not work for DOS programs...
    I have not use win98 for a long time.
    I am just aman.

  7. #7
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512

    Peeps

    OK peeps, thanks for your help. At least I know now its not me doing something stupid or not doing something I should.

    Thanks
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

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