By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

Prevent Task Manager From Shutting Database

P: n/a
I have some users that continuously end task on my database when a search
takes to long. In turn corrupting the application. Is there any way to
prevent this? The Microsoft KB for Methods That Can Be Used to Prevent
Corruption suggests not allowing Task Manager to shut down the application
but gives no way to prevent this. Any suggestions would help.
Thanks in advance,
Mark
Dec 29 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"NEWSGROUPS" wrote
I have some users that continuously end task on
my database when a search takes to long. In turn
corrupting the application. Is there any way to
prevent this? The Microsoft KB for Methods That
Can Be Used to Prevent Corruption suggests not
allowing Task Manager to shut down the application
but gives no way to prevent this. Any suggestions
would help.
Is it within your scope, or can you convince management, to declare that not
shutting down the database with task manager, nor by powering down the
computer, is a "condition of continued employment"? I have heard that has
had very beneficial effects on reducing corruption in some organizations
where it was declared as policy.

Larry Linson
Microsoft Access MVP
Dec 29 '06 #2

P: n/a
On Thu, 28 Dec 2006 22:06:01 -0500, "NEWSGROUPS"
<ma***********@comcast.netwrote:

I'm not sure how to prevent someone from using TM, other than using
Group Policies, which is a big step.
There are other ways to make it unattractive for people to End Task.
First off, you can optimize your app to make sure you're doing
everything possible to make these slow parts as fast as possible. This
may include hiring a professional to get another pair of eyes looking
at the problem. It may also include not allowing certain operations.
For example running an Aging Report over a 10 year date interval may
take 15 minutes to generate, whereas restricting users to 1 year may
be perfectly acceptable.
You can detect the use of End Task by every minute writing "I'm still
running at <datetime>" to the registry (e.g. using SaveSetting). Then
when the app shuts down gracefully one of the last things you do is
clear that registry key. Upon startup you read the key, and if it is
not clear, you know within 1 minute when the user closed ungracefully.
You then go into this lengthy spiel of explaining why that's a bad
idea, that the department manager has been notified of this event,
that a lengthy security check is now needed to recover the database
(you have some animation going on for a minute or two), etc. Use your
imagination.

-Tom.

>I have some users that continuously end task on my database when a search
takes to long. In turn corrupting the application. Is there any way to
prevent this? The Microsoft KB for Methods That Can Be Used to Prevent
Corruption suggests not allowing Task Manager to shut down the application
but gives no way to prevent this. Any suggestions would help.
Thanks in advance,
Mark
Dec 29 '06 #3

P: n/a
"NEWSGROUPS" <ma***********@comcast.netwrote in
news:34******************************@comcast.com:
I have some users that continuously end task on my database when a
search takes to long. In turn corrupting the application. Is there any
way to prevent this? The Microsoft KB for Methods That Can Be Used to
Prevent Corruption suggests not allowing Task Manager to shut down
the application but gives no way to prevent this. Any suggestions
would help.

Thanks in advance,
Mark
This disables the Task Manager here in Canada.
You could run it on open with an AutoExec Macro or a start-up form in your
application.
I cannot guarantee that it will do no harm to your computer, although I see
no way that it can. If you decide to try it, please, only do so if you are
willing to accept any results that happen.
I have used it and many other similar snippets without any trouble
whatever. But, who knows? Perhaps my computers and I live charmed lives.

Public Sub DisableTaskMgr()
Dim Buffer As String
Dim PathTxt As String
Dim PathReg As String
Dim FileNumber As Integer

On Error GoTo DisableTaskMgrErr

' Don't move this to the end of the procedure
' as it will erase the file
' before regedit gets to import the settings.
Kill "DisableTaskMgr*.*"

PathTxt = "DisableTaskMgr" & Format(Now(), "dddmmmddyyyyhhnnss\.\t\x\t")
PathReg = Replace(PathTxt, "txt", "reg")

Shell "RegEdit /E " & PathTxt _
& " HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Policies
\System\", _
vbHide

Buffer = String(FileLen(PathTxt), vbNullChar)
FileNumber = FreeFile
Open PathTxt For Binary As #FileNumber
Get #FileNumber, , Buffer
Close #FileNumber

Buffer = StrConv(Buffer, vbFromUnicode)
Buffer = Replace(Buffer, _
"DisableTaskMgr" & Chr$(34) & "=dword:00000000", _
"DisableTaskMgr" & Chr$(34) & "=dword:00000001")
Buffer = StrConv(Buffer, vbUnicode)

FileNumber = FreeFile
Open PathReg For Binary As #FileNumber
Put #FileNumber, , Buffer
Close #FileNumber

Shell "RegEdit /S " & PathReg, vbHide

DisableTaskMgrExit:
Close
Exit Sub

DisableTaskMgrErr:
With Err
If .Number = 53 Then
Resume Next
Else
MsgBox Err.Description, vbExclamation, "Error :" & Err.Number
Resume DisableTaskMgrExit
End If
End With
End Sub

Of course, the knowledgeable user could fire up regedit and reverse this.
Then again, probably knowledgable users will not end an application with
the Task Manager, except in emergencies.

Nothing at all can prevent pulling out the plug, TTBOMK.

So ... have you considered trying to speed up your searches?

--
Lyle Fairfield
Dec 29 '06 #4

P: n/a

Lyle Fairfield wrote:
Public Sub DisableTaskMgr()
Of course, if one wants to run code from a Macro or a Menu one may have
to use:

Public Function DisableTaskMgr()

and not

Public Sub DisableTaskMgr()

Dec 29 '06 #5

P: n/a
NEWSGROUPS wrote:
I have some users that continuously end task on my database when a search
takes to long. In turn corrupting the application. Is there any way to
prevent this?
Hi Mark,

I'd be very leery about this. I think I would prefer to revise my
search mechanisms in the app to force users to pick very restrictive
criteria that creates an SQL statement to retrieve results. You could
also write code such that a search looks for results from one table only.

Make sure too that you have your application properly indexed; for large
numbers of records, proper indexing can reduce search times by orders of
magnitude.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Dec 29 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.