?
Solved

Disable Task Bar Right Click Close

Posted on 2011-09-13
6
Medium Priority
?
441 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 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

771 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