Show/hide application window, navigation pane, ribbon, taskbar (1 Viewer)

Status
Not open for further replies.

isladogs

CID Moderator
Staff member
Local time
Today, 14:22
Joined
Jan 14, 2017
Messages
13,151
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:

isladogs

CID Moderator
Staff member
Local time
Today, 14:22
Joined
Jan 14, 2017
Messages
13,151
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:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom