Gmail
max.wanadoo at gmail.com
Thu Sep 6 16:39:39 CDT 2007
Hi Drew, Can I have your permission to use this in place of my current code? Thanks Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka Sent: Thursday, September 06, 2007 10:15 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Transactions 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 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gmail Sent: Thursday, September 06, 2007 3:20 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Transactions Hi Drew, Some code from Dev Ashish (below) might do the trick. Regards Max 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. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com