Drew Wutka
DWUTKA at Marlow.com
Mon Sep 10 10:27:11 CDT 2007
http://www.marlow.com/AlwaysOnTop2000.zip I'll leave that there for a few days. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gmail Sent: Friday, September 07, 2007 3:44 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Transactions Drew, I am sorry to trouble you, but I am having some difficulty in getting this to work. If you have the time, I would really appreciate an example mdb with a form showing all this working. Openening and closing plus the bits inbetween. (max.wanadoo at gmail.com) Thanks in anticipation. Regards Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka Sent: Friday, September 07, 2007 3:40 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Transactions Nope, that's right. The code posted was two 'parts' though (and not really stand alone, they refered to other things in the systems they were in). First part hid (and unhid) Access and put the forms 'Always On Top'. The second part was some code to unhide all Access (main) windows on your machine. 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 9:09 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Transactions Hi Drew Yes, I did figure that out, though I used SW_SHOWNORMAL. This restores nicely the main window of Access. However, as I browsed the thread, the target was to unhide the Database window - or did I miss something? /gustav >>> DWUTKA at marlow.com 07-09-2007 15:59 >>> 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. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- 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.