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