Solved

Disable Task Bar Right Click Close

Posted on 2011-09-13
6
424 Views
Last Modified: 2012-05-12
I need VBA code for a MS Access 2003 database to disable the ability to right click and close the database. We have code in place that disables the [x] close button (upper right hand corner) for the application but need the code to disable the ability to right click and close the database/application on the task bar. I need this to work for the following OS's: XP, Win7 and Server 2008. But at least XP and Win7. Thanks.
0
Comment
Question by:kpurchase
  • 3
  • 2
6 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 36529324

 Use a hidden startup form.  make sure it's the first to open.  In it's close event, check for the presence of a flag (I use a check box control on the form itself and check it when a use clicks EXIT from the login form).

 If the flag is not set, set CANCEL = True, which will prevent Access from shutting down.

Jim.
0
 

Author Comment

by:kpurchase
ID: 36529385
This does not close the application in Win7 (sweet!)... However when right clicking and selection close on the taskbar it removes it from the taskbar.. Any thoughts on how to not make it leave the taskbar and/or re-add it to the taskbar?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36529592
If I am understanding your request, ...If this is possible, (and I don't know that it is) I don't think it will work in all versions of Windows you are specifying...

<Any thoughts on how to not make it leave the taskbar and/or re-add it to the taskbar?>
This is now a new requirement...
...While you can start an application from the task manager, it is anyone guess how you would automate this.

What I am saying is that at whenever level you may be able to do this, it won't be what you would call "Easy".
(a couple of lines of code in VBA).

There is but so much you can do from stopping a user form doing what ever they want...

Finally it is rare for a user to use the task manager (Ctrl-Alt-Del) to simply "Close" a program.
The common reason this happens is if the app locks up.
So perhaps you should go back and evaluate the interface of your app and make sure that it is designed so restrictively as to NOT let a user exit normally, if they have to.

In other words, it is very rare that a application would need something this extreme. (task manager control over a specific application)

JeffCoachman
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 57
ID: 36529858
<<This does not close the application in Win7 (sweet!)... However when right clicking and selection close on the taskbar it removes it from the taskbar.. Any thoughts on how to not make it leave the taskbar and/or re-add it to the taskbar? >>

 I don't have Win 7 to test, but that should not allow a close.  I didn't think a right click on the task bar was any different then a close of the main window.

 Of course killing it through task manager is a different thing entirely and Win 7 may be doing something different.

 Are you sure it's actually shutting down with the right click from the task bar and not just removing it?

Jim.
0
 

Author Comment

by:kpurchase
ID: 36530672
Hi Jim,
Sorry you are right it appears it works appropriately I think I had multiple projects open at once (one of which did not have the changes). I just now have to figure out my flagging issues. Thanks!
0
 

Author Closing Comment

by:kpurchase
ID: 36530675
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now