how to programatically close outlook model pop up in vb6.0?



I found the solution.what I did, I programatically kill that pop up and then open my outlook window. below is my code:

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Const WM_CLOSE = &H10

Public Sub Kill_Program(ProgramName As String)
Dim WinWnd As Long
WinWnd = FindWindow(vbNullString, ProgramName)

If WinWnd <> 0 Then
MsgBox "Outlook E-mail Properties Popup will be closed."
PostMessage WinWnd, WM_CLOSE, 0&, 0&
' Else
' ' do nothing or
' MsgBox "No Popup of name " & ProgramName & " exists."
End If
End Sub

Ref Link:


hope it will help others also.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.