One of my new apps is used as a sort of 'dedicated' thing.
Users see an empty desktop with *only* two buttons. They only click a button to start the app.
(They have two apps they need to work with)
When they minimise the app (and some do this accidently...) the app is NOT visible anymore in a taskbar or so.
In fact there is NO taskbar...
I can check for the app not to be started two times (they do !!)
I am preventing them to kill the app other than by clicking on the 'close' button.
They ask me now: "Can you prevent the minimise ..."
Thanks,
Arno R
I'm not sure where I got this code, so if anyone wants to claim ownership be my guest.
Option Compare Database
Private Declare Function GetWindowLong Lib "User32" _
Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "User32" _
Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetSystemMenu _
Lib "User32" _
(ByVal hWnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function DrawMenuBar _
Lib "User32" _
(ByVal hWnd As Long) As Long
Private Declare Function DeleteMenu _
Lib "User32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Const MF_BYCOMMAND = &H0&
Private Const SC_CLOSE = &HF060
Private Const WS_SYSMENU = &H80000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const GWL_STYLE = (-16)
Public Function fActivateControlBox(Enable As Boolean)
Dim CurStyle As Long
Dim hWnd As Long
hWnd = Access.hWndAccessApp
CurStyle = GetWindowLong(hWnd, GWL_STYLE)
If Enable Then
If Not (CurStyle And WS_SYSMENU) Then
CurStyle = CurStyle Or WS_SYSMENU
End If
Else
If (CurStyle And WS_SYSMENU) = WS_SYSMENU Then
CurStyle = CurStyle - WS_SYSMENU
End If
End If
Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWnd)
End Function
Public Function fActivateCloseBox(Enable As Boolean)
Dim hMenu As Long
Dim hWnd As Long
hWnd = Access.hWndAccessApp
If Enable Then
Call GetSystemMenu(hWnd, True)
Else
hMenu = GetSystemMenu(hWnd, False)
If hMenu Then
Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
End If
End If
Call DrawMenuBar(hWnd)
End Function
Public Function fActivateMaximizeBox(Enable As Boolean)
Dim CurStyle As Long
Dim hWnd As Long
hWnd = Access.hWndAccessApp
CurStyle = GetWindowLong(hWnd, GWL_STYLE)
If Enable Then
If Not (CurStyle And WS_MAXIMIZEBOX) Then
CurStyle = CurStyle Or WS_MAXIMIZEBOX
End If
Else
If (CurStyle And WS_MAXIMIZEBOX) = WS_MAXIMIZEBOX Then
CurStyle = CurStyle - WS_MAXIMIZEBOX
End If
End If
Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWnd)
End Function
Public Function fActivateMinimizeBox(Enable As Boolean)
Dim CurStyle As Long
Dim hWnd As Long
hWnd = Access.hWndAccessApp
CurStyle = GetWindowLong(hWnd, GWL_STYLE)
If Enable Then
If Not (CurStyle And WS_MINIMIZEBOX) Then
CurStyle = CurStyle Or WS_MINIMIZEBOX
End If
Else
If (CurStyle And WS_MINIMIZEBOX) = WS_MINIMIZEBOX Then
CurStyle = CurStyle - WS_MINIMIZEBOX
End If
End If
Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWnd)
End Function
but... I simply don't see (yet) how exactly to use this code.
I would like to do one of the following:
-- Hide the minimise option
-- Prevent users to minimise the app (similar like I prevent them to shut down) or
-- Maximise the app again when it is minimised.
Anybody cares to give some specific info on this ?
Arno R
"Wayne Gillespie" <bes...@NOhotmailSPAM.com.au> schreef in bericht news:m93vo1tbpfna5ihel...@4ax.com...
Did not find what I am looking for yet, but the website is 'to be reminded'.
Arno R
<pietl...@hotmail.com> schreef in bericht news:1133491028....@g43g2000cwa.googlegroups.com...
Paste all the code into a standard module.
Calling fActivateMinimizeBox(False) will disable the minimize button of the Access MDI window title bar.
Calling fActivateMaximizeBox(False) will disable the maximise button of the Access MDI window title bar.
Calling fActivateCloseBox(False) will disable the close button of the Access MDI window title bar.
Calling fActivateControlBox(False) will remove the control box AND all buttons from the Access MDI window title bar.
Use a startup routine to call whichever options you want.
The settings apply only to the current database and do not persist between sessions.
You can use the immediate window to test each function by typing (eg) ? fActivateMinimizeBox(False)
> The settings apply only to the current database and do not persist between sessions.
Slight correction here:
The settings seem to apply to the Access-session.
If I switch to another database the settings are the same. No problem! Still exactly what I needed!
Thanks a lot Wayne.
Arno R
"Wayne Gillespie" <bes...@NOhotmailSPAM.com.au> schreef in bericht news:l6r0p1l3fj80b70gv...@4ax.com...
>> The settings apply only to the current database and do not persist between sessions.
>Slight correction here:
>The settings seem to apply to the Access-session.
>If I switch to another database the settings are the same. No problem! Still exactly what I needed!
You are correct. That is actually what I meant to type ;)
The minimise button stays on the window but doesn't do anything.
Option Explicit
Private Const MF_BYPOSITION = &H400
Private Const MF_REMOVE = &H1000
Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Sub RemoveMinimise()
Dim hMenu As Long
Dim menuItemCount As Long
'Obtain the handle to the form's system menu
hMenu = GetSystemMenu(hWndAccessApp, 0)
If hMenu Then
Call RemoveMenu(hMenu, 3, _
MF_REMOVE Or MF_BYPOSITION)
Call DrawMenuBar(hWndAccessApp)
End If
End Sub
--
Terry Kreft
"Arno R" <arraNO...@tiscali.nl> wrote in message
news:43904c3c$0$2337$ba62...@text.nova.planet.nl...