?
Solved

Disable Task Bar Right Click Close

Posted on 2011-09-13
6
Medium Priority
?
447 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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 58
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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unable to change the program that handles the scan event from a network attached Canon/Brother printer/scanner. This means you'll always have to choose which program handles this action, e.g. ControlCenter4 (in the case of a Brother).
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

809 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