I have this module to hide the close buttons in the access application to force the user to use my command button on the main form to close the database.
It has the PtrSafe added in to make it work with 64 bit systems but I have one user out of all users that is still on a 32 bit system.
Is anyone willing to modify the below code to work with both systems?
I tried using the IF and Else for the private declarations but it didn't work.
It has the PtrSafe added in to make it work with 64 bit systems but I have one user out of all users that is still on a 32 bit system.
Is anyone willing to modify the below code to work with both systems?
Code:
Private Const GWL_EXSTYLE = (-20)
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_SYSMENU = &H80000
Private Const HWND_TOP = 0
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Private Declare PtrSafe Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) _
As Long
Private Declare PtrSafe Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
Sub HideAccessCloseButton()
Dim lngStyle As Long
lngStyle = GetWindowLong(hWndAccessApp, GWL_STYLE)
lngStyle = lngStyle And Not WS_SYSMENU
Call SetWindowLong(hWndAccessApp, GWL_STYLE, lngStyle)
Call SetWindowPos(hWndAccessApp, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_DRAWFRAME)
End Sub
I tried using the IF and Else for the private declarations but it didn't work.