Drew Wutka
DWUTKA at Marlow.com
Fri Sep 7 08:59:38 CDT 2007
Good point, sorry, just grabbed the code out of a module, the form I had run that had the 'showaccesswindow' function. Just replace that line with: ShowWindow hwnd, SW_MAXIMIZE You'll need to copy the API declaration and SW_MAXMIZE constant from the first bit of code in the post. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Friday, September 07, 2007 8:31 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Transactions Hi Drew OK, it's probably from my cut and paste ... But your sub ShowAccessWindow seems to miss? I've found one from you dated 2002-05-10 but it takes another argument. /gustav >>> DWUTKA at marlow.com 07-09-2007 15:05 >>> No idea why that says listview, should be long. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Friday, September 07, 2007 4:44 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Transactions Hi Drew Nice. However, what is the ListView type? A2003 won't compile that: Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As ListView) As Long /gustav >>> DWUTKA at marlow.com 06-09-2007 23:15 >>> Yes, my code does the same, and a little more: Option Compare Database Option Explicit Private Declare 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 Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _ ByVal nCmdShow As Long) As Long Const SW_HIDE = 0 Const SW_MAXIMIZE = 3 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 Private Const HWND_TOPMOST = -1 Private Const HWND_BOTTOM = 1 Private Sub cmdAlwaysOnTop_Click() If IsWindowVisible(Application.hWndAccessApp) Then ShowWindow Application.hWndAccessApp, SW_HIDE SetWindowPos Application.hWndAccessApp, HWND_TOPMOST, 0, 0, 0, 0, _ SWP_NOMOVE Or SWP_NOSIZE Else ShowWindow Application.hWndAccessApp, SW_MAXIMIZE SetWindowPos Application.hWndAccessApp, HWND_BOTTOM, 0, 0, 0, 0, _ SWP_NOMOVE Or SWP_NOSIZE End If End Sub Private Sub Form_Unload(Cancel As Integer) If IsWindowVisible(Application.hWndAccessApp) = False Then ShowWindow Application.hWndAccessApp, SW_MAXIMIZE SetWindowPos Application.hWndAccessApp, HWND_BOTTOM, 0, 0, 0, 0, _ SWP_NOMOVE Or SWP_NOSIZE End If End Sub The code above hides the access window and actually puts popup forms as 'always on top' of all other windows. However, this code: Option Explicit Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long Public intWindowsShown As Long Function FindAndShowWindows() Dim dwReturn As Long dwReturn = EnumWindows(AddressOf EnumWindowsProc, 0) End Function Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As ListView) As Long Dim strClass As String Dim dwReturn As Long strClass = Space(50) dwReturn = GetClassName(hwnd, strClass, 50) strClass = Left(strClass, dwReturn) If strClass = "OMain" And Not IsWindowVisible(hwnd) Then ShowAccessWindow hwnd intWindowsShown = intWindowsShown + 1 End If EnumWindowsProc = 1 End Function Will unhide every Access window on your machine. Drew -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI BusinessSensitve material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.