Solved

Disable Task Bar Right Click Close

Posted on 2011-09-13
6
428 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

726 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