Show/hide application window, navigation pane, ribbon, taskbar

Status
Not open for further replies.

isladogs

MVP / VIP
Local time
Today, 03:16
Joined
Jan 14, 2017
Messages
18,548
I have created an example database to show how the Access application interface can be controlled in various ways.
Some of these methods can be used to make a database more secure.

It is intended to demonstrate that all of this is easy to do safely and without any issues arising

This item links to various posts in the thread:
https://www.access-programmers.co.uk/forums/showthread.php?t=284248

The database is opened with form frmStart 'floating independently' on the desktop i.e. with the access application window hidden

attachment.php


Buttons on the form can be used to:
- show / hide entire Access application window
- show / hide navigation pane
- show / hide ribbon
- show / hide taskbar
- maximise the form to fill the entire screen (no title bar & no taskbar) - this only works for a popup form
- open another form with a related report. This shows how the print preview ribbon can be displayed whilst the report is open & hidden when it is closed
- open / close the VBE

Although it is highly unlikely that any single application would need to use all of these features, this is designed to show that all items can be toggled on / off independently without problems.

All code has been fully tested in Access 2010 & 2016.
In addition, each section of the code has been widely used in various production databases for several years.

The code used can be found in the modules:
- modDatabaseWindow / modNavPaneTaskbar / modRibbon

Some of the code is widely known e.g. hide navigation pane / ribbon.
Other parts are written by myself or other authors.
Where this is the case, those authors have been acknowledged.

This example database also includes:
- code to resize forms for any screen size & resolution (modResize module)
- additional functions in module modDesignFeatures

If you wish to use any of the code in your own projects, just copy the relevant module code including all author information as supplied

The VBA reference Visual Basic for Extensibility is required for certain additional functions listed in the module modDesignFeatures
e.g. CloseAllVBEWindows and for getting the procedure names in error handling code.
It can be omitted if you don't wish to use either of these

I hope this is useful to others
Do contact me if you have any questions or problems with the attached code

NOTE The attached file only runs in 32-bit Access.
See posts 3 & 6 for updated versions that work in both 32-bit and 64-bit Access
 

Attachments

  • SetWindows.accdb
    SetWindows.accdb
    1.7 MB · Views: 5,847
  • SetWindowsApp.gif
    SetWindowsApp.gif
    46.2 KB · Views: 22,669
Last edited:
@ridders I created an account just because it was imperative for me to thank you for this post. I've been researching & experimenting for a week, trying to get some control over the Access window and such, and you have so much good stuff summed up in one place!

(I know not all the code is yours but you're the one that compiled, and made it find-able, and that's what counts!)

Thanks a bunch!
 
Just had some feedback that this didn't run in 64-bit Access

I've updated the Windows API calls so that it will now also run in 64-bit Access for those of you that use it
 

Attachments

Does anyone have any issues with using SW_HIDE to hide the application window but also having access not displayed on the task bar also?

I'm wondering if there is a way for the form to be displayed on the task bar.

Thank you in advance.
 
Post 4 has just been 'discovered' and belatedly approved.

Does anyone have any issues with using SW_HIDE to hide the application window but also having access not displayed on the task bar also?
That's how its meant to behave
Use SetAccessWindow (SW_SHOWMINIMIZED) to hide the application window but show a taskbar icon
 
Attached is an updated version with a couple of new items added to the main form.
One of these shows a way of viewing query results when the application window is hidden.
It should still work in both 32-bit & 64-bit Access.

If anyone has suggestions for other items to cover in this example, please send me a PM or email me.
 

Attachments

Minor update to v3.0
Added code to show how reports can be viewed when the application interface is hidden
 

Attachments

Minor update to v3.0
Added code to show how reports can be viewed when the application interface is hidden

great that you keep updating this just one quick question, which probably doesn't have a quick answer

could you(as in general speaking and not you, you) take the button click event and put in the form load so it doesn't show the window ?
 
I'm a bit confused by your question.
The app already opens with the application window hidden.
Perhaps you can explain in another way...send me a PM.
 
In response to clarification via PM from murray83, I've just added two new functions to the module modDatabaseWindow:

Code:
Function RestoreNormalWindow()

    SetAccessWindow (SW_SHOWNORMAL)
End Function

Function MinimizeWindow()

    SetAccessWindow (SW_SHOWMINIMIZED)
End Function

To remove the application window, you can, if preferred, just use MinimizeWindow in the Form_Load event of your startup form ...OR use that in an Autoexec macro to run when your app loads
 

Attachments

sorry, but still doesn't work on a2016 x64.
it just minimized the access window.
 
Hi arnel
Thanks for letting me know. Thought I'd fixed the API conversion a long time ago.:o

I've updated it to version 3.2 & have now checked that it works correctly in both 32-bit & 64-bit Access.
 

Attachments

Further update to version 3.3.

This includes code that allows you to drag a borderless form to a new position whilst holding down the left mouse button over selected places on the form.

Many thanks to Micron for alerting me to this code
 

Attachments

Last edited:
Updated once again to v3.4
The new version fixes a long standing issue that has been requested several times.
It has been tested in both 32-bit and 64-bit Access
Previously if the app was open but another window had focus, clicking the taskbar icon would restore the application window
That no longer occurs. It has been fixed with a clever API call that I only partly understand:

Code:
Me.Painting = False
    SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
    ShowWindow Application.hWndAccessApp, SW_HIDE
    ShowWindow Me.hWnd, SW_SHOW

The 2nd line is the clever bit that does the hard work here. That was kindly provided by UA member daolix who pops up occasionally with some obscure code that does exactly what is required

EDIT: I've just made a minor change in cmdViewErrors_Click event to fix a different issue caused by the new code. Updated version 3.41 now attached
 

Attachments

Last edited:
Hello everybody, this is my first post here.

I saw the great coding with hide/show ribbon, taskbar etc etc.

I used the lastest project v3.41, trying to make a startup form,
maximised + taskbar.
I used the code behind the buttons, to make this happen, BUT...

the form does maximise, but the taskbar just will not appear, using VBA.

(the buttons work very nice)

What am I doing wrong???

(After 2 days of trying and thinking, I ran out of options)

THANKS !!!!!!!
 
Hi reinier
I'm a little confused here.
The default situation is that the application window, taskbar etc are visible.
The example app is designed to prevent all of that.

If you use my code to 'maximise the form', you can also hide the taskbar and fill that space with your form...but that is optional. If you don't want that behaviour, don't use it.

BTW I've deleted your duplicate posts which were also moderated.
 
Hello everybody, this is my first post here.

I saw the great coding with hide/show ribbon, taskbar etc etc.

I used the lastest project v3.41, trying to make a startup form,
maximised + taskbar.
I used the code behind the buttons, to make this happen, BUT...

the form does maximise, but the taskbar just will not appear, using VBA.

(the buttons work very nice)

What am I doing wrong???

(After 2 days of trying and thinking, I ran out of options)

THANKS !!!!!!!
Hi. Welcome to AWF! Not sure we can tell you what you did wrong if we can't see what it was exactly that you did. Are you able to post a copy of your db?
 
If you want to post a copy of your db, please do so to a new thread as this is a moderated area
 
I've discovered a couple of bugs in v3.41
The new code suggested by daolix (see post #14) is preventing the ribbon code working and that also means the form properties sheet isn't visible in design view

I'm hoping daolix will see this post and assist as at the moment I don't have a solution.
However the rest of the example app appears to still work perfectly
 
I've discovered a couple of bugs in v3.41
The new code suggested by daolix (see post #14) is preventing the ribbon code working and that also means the form properties sheet isn't visible in design view

I'm hoping daolix will see this post and assist as at the moment I don't have a solution.
However the rest of the example app appears to still work perfectly
Hi Colin. Did you see daolix's reply in this thread?
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom