Prev: lettre de motivation
Next: idioma espanol.
From: Glint on 25 Nov 2009 16:19 Hi Guys, Everything has been working fine since I got the solution to how to disable the CLOSE button of Access through this forum. Now however, I found that I get the error message: INVALID PROCEDURE CALL OR ARGUMENT when I run the application on Access 2007. The code on the module of the application goes thus: Option Compare Database Option Explicit Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, _ ByVal bRevert As Long) As Long Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As _ Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long Const MF_GRAYED = &H1& Const MF_BYCOMMAND = &H0& Const SC_CLOSE = &HF060& Public Function SetEnabledState(blnState As Boolean) Call CloseButtonState(blnState) Call ExitMenuState(blnState) End Function 'Disable the Menu Option Sub ExitMenuState(blnExitState As Boolean) Application.CommandBars("File").Controls("Exit").Enabled = blnExitState End Sub 'Disable the Close Button Option Sub CloseButtonState(boolClose As Boolean) Dim hWnd As Long Dim wFlags As Long Dim hMenu As Long Dim result As Long hWnd = Application.hWndAccessApp hMenu = GetSystemMenu(hWnd, 0) If Not boolClose Then wFlags = MF_BYCOMMAND Or MF_GRAYED Else wFlags = MF_BYCOMMAND And Not MF_GRAYED End If result = EnableMenuItem(hMenu, SC_CLOSE, wFlags) End Sub On the opening form of the application, I make a call: Call SetEnabledState(False) On Access 2007, the code stops at this point and returns the error message while it works well with my Access 2003. How can I solve this problem? -- Glint "Glint" wrote: > Hi All, > How can I hide Windows close (X) button so that a user is forced to use the > coded buttons I provide instead? > -- > Glint
|
Pages: 1 Prev: lettre de motivation Next: idioma espanol. |