Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.word.vba.general
|
|||
|
|||
![]()
Karl, I have limited experience with such matters, but I'll share my
observations and conclusions: Some months ago I was attempting to manage position of the Assistant Balloon in Access (2003). After many hours of digging around API information I came to the sad conclusion that with respect to Access, at any rate, I was pursuing a hopeless cause as to the best of my ability to discover, all internal Access position information was relative to the user area of the Access window, *not* the Windows display area (as is hWnd). I believe that it would be possible to develop routines that would be able to "travel between the two worlds" but for my purposes it was not worth the effort. I also understand that VBA UserForms and Access Forms are completely different, and properties and methods effectively have no correlation from one to the other. I have also observed that the Excel and Access Application Objects handle windows and screens very differently. Not much to offer, but perhaps of some use to you. -- Clif "Karl E. Peterson" wrote in message ... Hi Folks -- Is there any sort of agreed upon "best practice" for obtaining the hWnd of VBA UserForms? Something that'll pretty much work wherever VBA may be found? I seem to generally use some variation of this: Option Explicit Private Declare Function GetForegroundWindow Lib "user32" () As Long Private hWnd As Long Private Sub UserForm_Activate() hWnd = GetForegroundWindow() Debug.Print Hex$(hWnd) End Sub But I'm pretty much only working in either Word or Excel, and version 2003 at that. Any reason to think that wouldn't work in PowerPoint, Access, 2007, 2000, elsewhere, ...? Is there a better (more universal) way? Thanks... Karl -- .NET: It's About Trust! http://vfred.mvps.org -- Clif |
#2
![]()
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.word.vba.general
|
|||
|
|||
![]()
Hi Clif --
Well, okay, ya made me look. <g I just tried the code I suggested, in Access 2003, and it worked fine. (It appears Rick's FindWindow call would work, as well, given the classname for the Access UserForm is the same as Word or Excel.) Note, I'm not looking at the Access forms, but the VBA UserForms, here. Thanks... Karl Clif McIrvin wrote: Karl, I have limited experience with such matters, but I'll share my observations and conclusions: Some months ago I was attempting to manage position of the Assistant Balloon in Access (2003). After many hours of digging around API information I came to the sad conclusion that with respect to Access, at any rate, I was pursuing a hopeless cause as to the best of my ability to discover, all internal Access position information was relative to the user area of the Access window, *not* the Windows display area (as is hWnd). I believe that it would be possible to develop routines that would be able to "travel between the two worlds" but for my purposes it was not worth the effort. I also understand that VBA UserForms and Access Forms are completely different, and properties and methods effectively have no correlation from one to the other. I have also observed that the Excel and Access Application Objects handle windows and screens very differently. Not much to offer, but perhaps of some use to you. -- Clif "Karl E. Peterson" wrote in message ... Hi Folks -- Is there any sort of agreed upon "best practice" for obtaining the hWnd of VBA UserForms? Something that'll pretty much work wherever VBA may be found? I seem to generally use some variation of this: Option Explicit Private Declare Function GetForegroundWindow Lib "user32" () As Long Private hWnd As Long Private Sub UserForm_Activate() hWnd = GetForegroundWindow() Debug.Print Hex$(hWnd) End Sub But I'm pretty much only working in either Word or Excel, and version 2003 at that. Any reason to think that wouldn't work in PowerPoint, Access, 2007, 2000, elsewhere, ...? Is there a better (more universal) way? Thanks... Karl -- .NET: It's About Trust! http://vfred.mvps.org -- ..NET: It's About Trust! http://vfred.mvps.org |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 statusbar hWnd | Excel Programming | |||
HWND of Listbox in UserForm in Excel macro | Excel Programming | |||
Getting hWnd for API call or Color choosing dialog | Excel Programming | |||
hWnd of UserForm | Excel Programming | |||
how to get hwnd from application object? | Excel Programming |