473,793 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disable access application maximizebox



Private Declare Function GetSystemMenu Lib "user32.dll " (ByVal Hwnd As
Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32.dll " (ByVal hMenu As
Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Public Const SC_MAXIMIZE = &HF030
Public Const MF_BYCOMMAND = &H0&
Public Const SC_RESTORE = &HF120

Public Sub RemoveMaxMenu(H wnd As Long)
Dim hMenu As Long
hMenu = GetSystemMenu(H wnd, False)
DeleteMenu hMenu, SC_RESTORE, MF_BYCOMMAND
DeleteMenu hMenu, SC_MAXIMIZE, MF_BYCOMMAND
End Sub

Function InitApplication ()
DoCmd.RunComman d Access.acCmdApp Maximize
Call RemoveMaxMenu(A ccess.hWndAcces sApp)
End Function

this code not work.
i want to maximize the access window in runtime and then the
maximizebox(rig ht top of access window(system button)) is disabled.
*** Sent via Developersdex http://www.developersdex.com ***
Oct 8 '06 #1
3 3201
On 08 Oct 2006 23:12:56 GMT, x taol <to******@yahoo .comwrote:

I reviewed your code and found it to do what it promises: it maximized
the Access main window, and removes two menu items from its system
menu.
If (as it appears) you would want to remove the system buttons as
well, you need to go back to the Windows system documentation and find
out how to do this. I seem to remember Get/SetWindowLong but it's been
a few years since I wanted to mess up the average user's expectations
:-)

-Tom.

>

Private Declare Function GetSystemMenu Lib "user32.dll " (ByVal Hwnd As
Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32.dll " (ByVal hMenu As
Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Public Const SC_MAXIMIZE = &HF030
Public Const MF_BYCOMMAND = &H0&
Public Const SC_RESTORE = &HF120

Public Sub RemoveMaxMenu(H wnd As Long)
Dim hMenu As Long
hMenu = GetSystemMenu(H wnd, False)
DeleteMenu hMenu, SC_RESTORE, MF_BYCOMMAND
DeleteMenu hMenu, SC_MAXIMIZE, MF_BYCOMMAND
End Sub

Function InitApplication ()
DoCmd.RunComma nd Access.acCmdApp Maximize
Call RemoveMaxMenu(A ccess.hWndAcces sApp)
End Function

this code not work.
i want to maximize the access window in runtime and then the
maximizebox(ri ght top of access window(system button)) is disabled.
*** Sent via Developersdex http://www.developersdex.com ***
Oct 9 '06 #2


setclasslong is not work well.
applying that method and the access window is minimized and then if the
access window restore, end of the window enter down the taskbar, like
the window is fullscreen,

i want to do the other method using api.
*** Sent via Developersdex http://www.developersdex.com ***
Oct 9 '06 #3
On 08 Oct 2006 23:12:56 GMT, x taol <to******@yahoo .comwrote:
>

Private Declare Function GetSystemMenu Lib "user32.dll " (ByVal Hwnd As
Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32.dll " (ByVal hMenu As
Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Public Const SC_MAXIMIZE = &HF030
Public Const MF_BYCOMMAND = &H0&
Public Const SC_RESTORE = &HF120

Public Sub RemoveMaxMenu(H wnd As Long)
Dim hMenu As Long
hMenu = GetSystemMenu(H wnd, False)
DeleteMenu hMenu, SC_RESTORE, MF_BYCOMMAND
DeleteMenu hMenu, SC_MAXIMIZE, MF_BYCOMMAND
End Sub

Function InitApplication ()
DoCmd.RunComma nd Access.acCmdApp Maximize
Call RemoveMaxMenu(A ccess.hWndAcces sApp)
End Function

this code not work.
i want to maximize the access window in runtime and then the
maximizebox(ri ght top of access window(system button)) is disabled.
*** Sent via Developersdex http://www.developersdex.com ***
This works for me.
I don't know where I got this code and there is no copyright notice, so if
anyone wants to claim ownership feel free.

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 fActivateContro lBox(Enable As Boolean)
Dim CurStyle As Long
Dim hWnd As Long

hWnd = Access.hWndAcce ssApp

CurStyle = GetWindowLong(h Wnd, 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(h Wnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWn d)

End Function

Public Function fActivateCloseB ox(Enable As Boolean)
Dim hMenu As Long
Dim hWnd As Long

hWnd = Access.hWndAcce ssApp

If Enable Then
Call GetSystemMenu(h Wnd, True)
Else
hMenu = GetSystemMenu(h Wnd, False)
If hMenu Then
Call DeleteMenu(hMen u, SC_CLOSE, MF_BYCOMMAND)
End If
End If
Call DrawMenuBar(hWn d)

End Function

Public Function fActivateMaximi zeBox(Enable As Boolean)
Dim CurStyle As Long
Dim hWnd As Long

hWnd = Access.hWndAcce ssApp

CurStyle = GetWindowLong(h Wnd, 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(h Wnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWn d)

End Function

Public Function fActivateMinimi zeBox(Enable As Boolean)
Dim CurStyle As Long
Dim hWnd As Long

hWnd = Access.hWndAcce ssApp

CurStyle = GetWindowLong(h Wnd, 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(h Wnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWn d)

End Function

Wayne Gillespie
Gosford NSW Australia
Oct 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3743
by: PerryC | last post by:
I have search googles and there are hundreds of tips about AllowByPassKey... however, none works for me... well, perhaps I am too new to such high level functionality that it just does not make sense to me. So, anyone please help. I have no idea what is "CreateProperty" that Access help was trying to tell me to do. Can anyone please write me a step by step on how to accomplish this? (i.e. disable Shift on Startup.) I've seen many...
1
3832
by: Tim Bücker | last post by:
Hello. I have a form with some controls on it. One of these controls is a button that disables/ enables all the other controls. The form itself should also be "disabled/enabled", so I set this.FormBorderStyle = FormBorderStyle.Sizable; to "enable" and this.FormBorderStyle = FormBorderStyle.Fixed3D; to "disable" the form (no resize).
1
1791
by: Alleg | last post by:
hi everyone I am new to VC++.NET, however, I have to implement this project in vc++.net. Here is the trouble I am facing. I wanna disable the red close button at the right upper corner of a vc++.net form. How to do this? YOur help is greatly appreciated!
12
65492
by: Mika M | last post by:
Customer wants the Close (X)-button of the forms top right corner to be Disabled or removed from Windows Form-application, which is made using VB.NET, but leave MinimizeBox and MaximizeBox. I think this is not so clever to do like this way, but have to do like customer wants - so how to do this? It seems to be not just like changing property like with MinimizeBox and MaximizeBox. Any succestions? -- Thanks in advance!
3
5129
by: dbuchanan | last post by:
It's easy to disable the Minimizebox and Maximizebox because they are members of the form, but how do I disable the Closebox or whatever it is called??? (Why are some things so hard to find out?) Why isn't there a "See Also" topic for this. Why isn't there a named member for this? Thank you, dbuchanan
2
2538
by: PamelaDV | last post by:
I am wondering if there is a way to disable the "X" used to close the Access application window? I know how to disable it for individual forms, but I would like to disable it for the application in general and force users to use a button on the switchboard to close (because I run important code on the close of the database from that button). Any ideas are always appreciated. Thanks!
3
2468
by: x taol | last post by:
when the specific mdb file be opend, i want to open maximize the aceess db. and maximizebox is disabled. *** Sent via Developersdex http://www.developersdex.com ***
3
11663
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm very new to VBA,i tried to follow the instructions reported in the code,but i got no result,i still can use the shift key,can you explain in details how to use it correctly to enable/disable users from pressing shift key to view database windw?,the...
6
2424
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The connection string works fine and the tables are added to the project without a problem. When I create the tables they appear to bind and I am able to preview the data in the database in design mode; however, at runtime no data is displayed and the...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.