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

Status
Not open for further replies.
Hi DBG
I did indeed & have been working on it for the past hour or so.

Thanks to daolix's prompt intervention, I've been able to fix the bugs mentioned in post #19.
I had to make quite a few other tweaks to fix the interaction between the different parts of the application and daolix's code which was added to fix the issue where clicking the taskbar icon restored the application window.
AFAIK all features are now working again with no nasty surprises.

Updated version 3.44 attached - no new features but hopefully now bug free once again.
Feedback particularly welcomed from anyone running 64-bit

For info, I did some testing of the rather complex (to me) code line originally suggested by daolix and used in v3.4 onwards
Code:
 SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW

I tried splitting the final argument into two parts:

Omitting the 'GetWindowLong(Me.hWnd, GWL_EXSTYLE)' part SEEMS to have no effect on its function that I noticed - can anyone explain what it does? MS documentation says GWL_EXSTYLE sets a new extended windows style

Omitting the 'Or WS_EX_APPWINDOW' part hides the taskbar icon completely.
For most people that would seem to be undesirable BUT I remember someone wanted that exact feature with the app window hidden a couple of years ago.
I've no idea who it was now but what I do remember is that they never explained why they wanted it!
If he/she is reading this now...here is your solution ;)
 

Attachments

Last edited:
Here are two more variations on a theme requested by various forum members but which may be useful to others. Each should work in both 32-bit & 64-bit Access

1. Title Bar Only (requested by UA member tina_t via a PM)
The OP wanted the application window to be retained but with the title bar only - no nav pane or ribbons:

i) This approach works best with overlapping windows.
ii) The form MUST be a popup

2. Remove Title Bar Buttons ( requested by AWF member joeyd11ph in Shutdown PC through Access button

The OP wanted all buttons removed from the title bar in order to control Access closedown via code only.

i) This approach only works with overlapping windows.
ii) The form MUST be a popup with NO control box, close, max/min buttons
iii) To remove the title bar as well, set form border style to None

In addition, he wanted to know how to other actions such as log off or shut down the PC completely using code for which I supplied the following code. Place in a standard module

Code:
Option Compare Database
Option Explicit

'NOTE switches used below
/s = shutdown
/r = reboot
/l = logoff
/f = force apps to close without warning
/t xxx = time delay of xxx seconds e.g. /t 2

' ‘*******************SHUT DOWN*********************
Public Function TurnOff()
    
    Shell "shutdown /s /t 2", vbHide
    Application.Quit
End Function
 
' ‘*********************REBOOT***********************
Public Function Reboot()
    Shell "shutdown /r /t 2", vbHide
    Application.Quit
End Function
 
' ‘*********************LOG OFF***********************
Public Function LogOff()
    'omit /t switch or it doesn't work
    Shell "shutdown /l", vbHide
    Application.Quit
End Function
 
 '‘**********************FORCE************************
Public Function ForceReboot()
    Shell "shutdown /r /f /t 3", vbHide
    Application.Quit
End Function

NOTE:
With any code of this type, I suggest adding a warning message so user has to confirm action before it runs. Once implemented, the process cannot be interrupted! For that reason, I also advise users that all work should be saved first

====================================
As this thread is closed, if you have any comments or questions, please send me a PM or start a new thread linking back to this one.
 

Attachments

Last edited:
I've done various modifications to this example app over the past two years so thought I'd post an updated version (v3.55).
New items include:
  • additional methods of displaying reports when the application window is hidden (including report as subform)
  • added message box with app window hidden ... so it is 'floating on the desktop'
  • added adjustable rounded corners and form fade features (no need for Windows 11!)
  • added code to run navigation form with app window hidden
  • created new function HideAppWindow to tidy up code. Instead of 3 code lines, now just use HideAppWindow Me
All code is fully 64-bit compatible
 

Attachments

I've done several more updates over the past 9 months and the latest version (v3.62) is attached.

Changes include:
  • Added view code buttons for all items
  • Fixed API errors in modNavPaneTaskbar & modDatabaseWindow
  • Added splash form
  • Fixed issue when user clicked Close Window on taskbar icon (thanks to @Babycat for alerting me)

SplashForm.png


MainForm.png


NOTE:
The latest version of this app is ALWAYS available on my website:

Please send me a private message or email me if you have any questions or to report any issues
Many thanks
 

Attachments

Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom