Results 1 to 3 of 3

Thread: How to kill Dialog Box from another app

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    1

    Talking

    I have developed an application in VB 5.0. This app is user unattened app. In this app a dialog box with a specified title appears at any time. Due to this dialog box the app suspends. Thus i want to kill this dialog box from an another app. The only thing i know about this dialog box is its title.

    Note : According to my logic the solution is to create an another app, which will keep an eye on the current active dialog box, and if the dialog box's title matches with the desired one, then kill it.

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Ah this i a pershapes a bit too late in coming.
    Could you not avoid showing the dialog box from teh app?

    Cheers!
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    4. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    5.  
    6. Private Const WM_CLOSE = &H10
    7.  
    8. Private Sub Timer1_Timer()
    9. Dim lngHWND     As Long
    10. Dim strCaption  As String
    11.     strCaption = "The caption of the MsgBox that the app pops up..." 'Change this )
    12.     lngHWND = FindWindow(vbNullString, strCaption)
    13.     If lngHWND <> 0 Then
    14.         PostMessage lngHWND, WM_CLOSE, 0&, 0&
    15.     End If
    16. End Sub
    This code will destroy a window as long as your know it's title...

    Woka

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