Hi all,
I am using the following article code to minimize the access container window when my application starts because it looks really professional without the grey background being there.
However I have found my shortcut menu's no longer work. I have tried even executing code such as: - CommandBars("mymenu").showpopup
This fails with an error saying method popup of command bar failed (runtime error).
Is there another method which can be used to hide the access window so only my popup form shows cleanly? or some form of shortcut way to get past this issue.
I have also found this method also stops the default menu popups working also.
6 5941
Could you post the specific code for hiding the Access DB window you are referring to? You mention it but have not posted it.
Thanks
Stewart
In my splash screens on load even I call a routine as follows: - Private Sub Form_Open(Cancel As Integer)
-
'Start open ended error handler
-
On Error GoTo tagError
-
-
Call AccessMinimize
-
-
DoCmd.OpenForm "frmHidden", acNormal, , , , acHidden
-
-
'End of successful code
-
ExitMe:
-
Exit Sub
-
-
'Handle the error type code
-
tagError:
-
MsgBox Err.Description
-
Resume ExitMe
-
End Sub
This is then running the following code: -
Option Explicit
-
-
Declare Function apiGetActiveWindow Lib "user32" Alias _
-
"GetActiveWindow" () As Long
-
Declare Function apiGetParent Lib "user32" Alias "GetParent" _
-
(ByVal hwnd As Long) As Long
-
Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
-
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
-
Declare Function apiIsIconic Lib "user32" Alias "IsIconic" (ByVal _
-
hwnd As Long) As Long
-
Declare Function apiIsZoomed Lib "user32" Alias "IsZoomed" (ByVal _
-
hwnd As Long) As Long
-
-
Global Const SW_MAXIMIZE = 3
-
Global Const SW_SHOWNORMAL = 1
-
Global Const SW_SHOWMINIMIZED = 2
-
-
Function GetAccesshWnd()
-
Dim hwnd As Long
-
Dim hWndAccess As Long
-
-
' Get the handle to the currently active window.
-
hwnd = apiGetActiveWindow()
-
hWndAccess = hwnd
-
-
' Find the top window without a parent window.
-
While hwnd <> 0
-
hWndAccess = hwnd
-
hwnd = apiGetParent(hwnd)
-
Wend
-
-
GetAccesshWnd = hWndAccess
-
-
End Function
-
-
Function AccessMinimize()
-
AccessMinimize = apiShowWindow(GetAccesshWnd(), SW_SHOWMINIMIZED)
-
End Function
-
-
Function AccessMaximize()
-
AccessMaximize = apiShowWindow(GetAccesshWnd(), SW_MAXIMIZE)
-
End Function
-
-
Function AccessRestore()
-
AccessRestore = apiShowWindow(GetAccesshWnd(), SW_SHOWNORMAL)
-
End Function
-
-
-
-
Function IsAccessMaximized()
-
If apiIsZoomed(GetAccesshWnd()) = 0 Then
-
IsAccessMaximized = False
-
Else
-
IsAccessMaximized = True
-
End If
-
End Function
-
-
Function IsAccessMinimized()
-
If apiIsIconic(GetAccesshWnd()) = 0 Then
-
IsAccessMinimized = False
-
Else
-
IsAccessMinimized = True
-
End If
-
End Function
-
-
Function IsAccessRestored()
-
If IsAccessMaximized() = False And IsAccessMinimized() = False Then
-
IsAccessRestored = True
-
Else
-
IsAccessRestored = False
-
End If
-
End Function
-
-
-
I suspect the problem is that the application is not hidden at all; it's window is minimised, in which case Access itself is no longer the active window as far as Windows is concerned. In my tests (in Access 2007 rather than 2003) with a dummy popup switchboard the switchboard functions, but as the results are minimised within the application window they are not visible unless the application is restored manually.
If you wish the splash screen to be visible without the normal Access background you can use the minimise function as at present to keep the splash screen visible with the application minimised, then (say) call the restore function from the splash screen form's On Close event to allow the other forms to behave normally.
-Stewart
Scott
that is how I run one of my databases. minimise on load and restore when I work with reports. But for my new database I wanted the same professional look but needed custom short cut menus. Looks like I will have to deal with the ugly background being there. I'm also wondering if the access windows opacity could be changed so it isnt minimised but its invisible.... More research to be done into that though
Also forgot to add you need to use popup forms for this code to work correctly. Access minimises but the forms stay visible. You can see your desktop and the form floating on top. Hence the professional look
I've managed to crack this using some apis.
I have dropped the minimisation of the application window because to be honest it is full of drawbacks.
I have mixed a couple of apis together to produce code which firstly grabs the current screen resolution. Divides this by half to get the theoretical centre of the screen. The access window is then resized to be at a minimum footprint of 0 by 0.
I then position this to the centre of my screen with all of my forms within access being set to popups.
I execute the code via my autoexec macro by calling the function "SizeAccess" - Option Compare Database
-
Option Explicit
-
-
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
-
Declare Sub SetWindowPos Lib "user32" (ByVal hwnd&, ByVal hWndInsertAfter&, ByVal x&, ByVal y&, ByVal cx&, ByVal cy&, ByVal wFlags&)
-
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
-
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
-
-
'PUBLIC Constants
-
Public Const SM_CXSCREEN = 0
-
Public Const SM_CYSCREEN = 1
-
-
'Moves MS Access window to top of Z-order.
-
Global Const HWND_TOP = 0
-
'Creates a window with a maximize box
-
Global Const WS_MINIMIZEBOX = &H20000
-
'Creates a window with a minimize box
-
Global Const WS_MAXIMIZEBOX = &H10000
-
Global Const GWL_STYLE = (-16)
-
'Values for wFlags.
-
Global Const SWP_NOZORDER = &H4 'Ignores the hWndInsertAfter.
-
-
Function SizeAccess()
-
Dim cx As Long
-
Dim cy As Long
-
Dim h As Long
-
Dim L As Long
-
Dim cHeight As Long
-
Dim cWidth As Long
-
-
'Size to set app window height/width
-
cHeight = 0
-
cWidth = 0
-
-
'Get handle to Microsoft Access.
-
h = Application.hWndAccessApp
-
-
'Set the position for the app to be centred to (50 and 100 refer to offsetting due to application titlebar size)
-
cx = (GetSystemMetrics(SM_CXSCREEN) / 2) - 50
-
cy = (GetSystemMetrics(SM_CYSCREEN) / 2) - 100
-
-
'Position the access window
-
SetWindowPos h, HWND_TOP, cx, cy, cWidth, cHeight, SWP_NOZORDER
-
-
'Get the current style.
-
L = GetWindowLong(h, GWL_STYLE)
-
-
'Get rid of the Minimize Button
-
L = L And Not (WS_MINIMIZEBOX)
-
-
'Get rid of the maximise button
-
L = L And Not (WS_MAXIMIZEBOX)
-
-
L = SetWindowLong(h, GWL_STYLE, L)
-
-
End Function
The reason this works is basically by ensuring my application window is always small and "hidden" behind my popup forms. The application will continue to have focus so now shortcut menus will work correctly.
Could you post a screenshot of your application (or parts of it)? Im a bit curious about the "professional" look you get from using such code.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dfg |
last post by:
Hi...Just a quick question about popup menus. I have a menu popup using
the code below:
Private Sub fraAccBal_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
If Button...
|
by: Aaron |
last post by:
Is it possible to create popup menus without using absolute positioning
that take up no space in the flow of the document and appear with an
onMouseOver() ?
Thanks,
Aaron
|
by: MEM |
last post by:
Hello,
I'd like to refresh the main or top most browser window from a child
window. Specifically, child popup A is opened by a main browser window
then child popup B is opened from within child...
|
by: Lauren Quantrell |
last post by:
Ok, here's a strange one...
I'm using a lot of Followhyperlink code in my MS Access2000
application to launch various websites. All my forms are popup, so
they run outside the MS Access window...
|
by: Mark |
last post by:
Hi All,
I am trying to use the function found on the MVP site
http://www.mvps.org/access/api/api0019.htm to hide the Access window. I must
be missing something as I keep getting an error message:...
|
by: Lauren Quantrell |
last post by:
Is there a way in code to freeze the size of the MS Access window or to
prevent it from being sized?
Thanks.
lq
|
by: Roger Withnell |
last post by:
My navbar is in a frame down the left hand side of the window.
The frame is 150px wide and the navbar buttons are 100px wide.
Hovering over the buttons displays popup menus to the right of the...
|
by: Rich Churcher |
last post by:
Is there a way using any of the Python UI toolkits to generate popup
menus outside the context of an application? For example,
middle-clicking on the desktop shows a list of shortcuts to choose...
|
by: BA |
last post by:
Hi there
I am trying to write an "application" in Access 2000, that displays a front
end and allows the user to interact with the database without seeing Access
loaded, in the background, nor on...
|
by: clincoln |
last post by:
I have run into the problem of MS seemingly dropping support for custom popup menus in Access 2007. My app heavily uses popup menus and suddenly I can not even change a typeo in a popup menu or add...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |