Keep a program running

Is there any way to keep a program running even if someone tries to close it. I have a workstation running XP Pro that loads Outlook 2003 on startup. Outlook needs to remain running at all times. Several people use this workstation during the day, some of whom are not very computer literate and Outlook has been closed several times. How can I avoid this? Can the users rights be changed so that they can not close Outlook?
comteksoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LazarusCommented:
Install Public Outlook as a Service

To installl Public Outlook on a Windows 2000 or Windows XP system, you must installl POL as a service. It does not work as "program".
To install POL as Service:

Quit the client and the server Outlook.
Quit Public Outlook on the server and make shure it did terminate via taskmanager -pol32.exe should be not listed.

On the server point to start -> run and enter including hypens:

"c:\\program files\Public Outlook\Server\pol32.exe" /service

Please adjust the path, "program files" will be on your Windows substitute.
After hitting ok you will get no feedback.

Now point to start -> run and enter "dcomcnfg" (without hyphens)
Click on OK. In the new configuration window expand the left tree to the see the DCOM settings of your computer. You will find all "DCOM-aware" applications. Point to "Public Outlook" and open the properties.

Change to the tab "identity" and choose the option "this user". Enter here the user, you did use to configure Outlook and did run Public Outlook server. This user must have the windows rights to start a service.

Close the dialogs with ok and change to the windows "services manager". Now Public Outlook will be listed here. Change the start behaviour from "manual" to "automatic" and start the service.

You can still change settings of the server via the administration interface, but the interface does not start or stop the server now.

If you want to revert the settings from service to application please run:

"c:\\program files\Public Outlook\Server\pol32.exe" /regserver

Also if it is necessary to deinstall Public Outlook, please remind to run this command before starting the deinstaller.
LazarusCommented:
Skip the above. It's not right for you... Sorry
R_RajeshCommented:
Open outlook, Go to tools-macros-security and set the security level to medium (or low if you dont want to enable macros each time you start to application)
hit alt+f11, this opens the vbe window. In the project explorer (left side. ctrl+r if not visible) double click ThisOutlookSession and paste the following code:

Private Sub Application_Startup()
Dim a, c As CommandBarButton
For Each a In Application.ActiveExplorer.CommandBars("Standard").Controls
If a.TooltipText = "Enable/Disable closing" Then a.Delete
Next a
With Application.ActiveExplorer.CommandBars("Standard").Controls.Add(Type:=msoControlButton)
.FaceId = 2950: .Style = msoButtonIcon
.TooltipText = "Enable/Disable closing"
.OnAction = "edClose": .Visible = True
.Width = .Width + 1: .Execute
End With
End Sub


from the insert munu select module and paste the following code:

Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As _
Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Sub edClose()
Static bState As Boolean
Dim wFlags As Long
bState = Not bState
Application.ActiveExplorer.CommandBars("File").Controls("Exit").Enabled = Not bState
If bState Then
wFlags = &H0& Or &H1&
Else
wFlags = &H0& And Not &H1&
End If
EnableMenuItem GetSystemMenu(FindWindow("rctrl_renwnd32", vbNullString), 0), &HF060&, wFlags
End Sub

close the vbe window and outlook. select yes if prompted to save. The next time you start the application, outlook will prompt you to enable the macros, select yes. The code will create a command button in the standard commandbar. Clicking this button will toggle the state of file-exit & X close button of the application. This doesn't protect you form alt+f4 combination
though.

Rajesh

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

R_RajeshCommented:
there are programs available that lets you restart a closed application automatically (havent tried any of these...)

http://www.kwakkelflap.com/watchdog.html
http://downloads-zdnet.com.com/3000-2086-10297409.html
comteksoAuthor Commented:
I have a macro that runs when Outlook starts that automatically replies to incoming messages, will the additional macro interfere?
R_RajeshCommented:
it shouldn't. the code in the Application_Startup routine just adds a command button to the commandbar. just add this code before your existing code
comteksoAuthor Commented:
Thanks it seems to be working great now.
R_RajeshCommented:
thanks for the grade. make a post if you run into trouble

Rajesh
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.