Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Apr 27, 1999

Hide the Automation Manager

If you haven't switched to DCOM yet, and still use Remote OLE Automation, you must launch the Automation Manager program on the server machine, in order to let the server respond to requests coming from client workstations.

The Automation Manager displays a visible window at launch time, which then minimize itself. However, a user can easily bring it on the foreground and accidentally close it, thus stopping the support for Remote OLE Automation on that machine. For this reason, it's advisable that production systems load the Automation Manager in hidden mode, which can be done using the /HIDDEN option on the command line:


C:\WINNT\SYSTE;32\AUTMGR32.EXE /HIDDEN
If the Automation Manager is loaded in this way, the only way to interactively stop it - short of a machine reboot - is to locate the Task Manager and end the program from there. Alternatively, you can use the following VB routine to close it programmatically:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
    lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
    hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long
Const WM_CLOSE = &H10

' Return True if the Automation Manager has been 
' successfully closed, False otherwise

Function CloseAutomationManager() As Function
    Dim handle As Long
    handle = FindWindow("MSAutMgr32", vbNullString)
    If handle Then
        ' Try to close the Automation Manager
        SendMessage handle, WM_CLOSE, 0, ByVal 0&
    End If
    ' Return True if the Automation Manager isn't running any longer
    CloseAutomationManager = (FindWindow("MSAutMgr32", vbNullString) = 0)
End Function
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date