Функции API не помогают:
- Код: Выделить всё
1. hWndParent = GetParent(UserControl.hWnd) и
2. hWndParent = GetAncestor(UserControl.hwnd, GA_ROOT)
3.
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type GUITHREADINFO
cbSize As Long
flags As Long
hwndActive As Long
hwndFocus As Long
hwndCapture As Long
hwndMenuOwner As Long
hwndMoveSize As Long
hwndCaret As Long
rcCaret As RECT
End Type
Private Declare Function GetGUIThreadInfo Lib "user32" (ByVal dwthreadid As Long, lpguithreadinfo As GUITHREADINFO) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Dim RetInfo As GUITHREADINFO
RetInfo.cbSize = LenB(RetInfo)
If GetGUIThreadInfo(GetCurrentThreadId, RetInfo) <> 0 Then
m_hWndParent = RetInfo.hwndActive
End If
End Sub
Выдают чужие дескрипторы.
Может как нибудь через другие алгоритмы API можно извлечь дескриптор будующего пользовательского окна