|
-
Oct 1st, 2001, 07:44 AM
#1
Thread Starter
Lively Member
SetParent API Question
There's probably an easy answer to this question, but I haven't been able to find any information...
I'm using the SetParent API to parent forms in a frame object, like this:
Code:
SetParent frm.hwnd, Frame1.hwnd
frm.Show
I want to switch between viewing several different forms in this frame. Is there a way to query the frame to see what is the name of the child form that is showing?
Any info would be greatly appreciated!
TIA
-
Oct 1st, 2001, 08:40 AM
#2
PowerPoster
You can try this..it will get the caption of the form in the frame
VB Code:
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Dim ChildhWnd As Long
Private Sub Command1_Click()
Dim strCaption As String
strCaption = String(100, Chr$(0))
GetWindowText ChildhWnd, strCaption, 100
MsgBox strCaption
End Sub
Private Sub Form_Load()
Dim frm As Form
Set frm = Form2
SetParent frm.hwnd, Frame1.hwnd
frm.Show
ChildhWnd = frm.hwnd 'store for later
End Sub
-
Oct 1st, 2001, 09:54 AM
#3
Thread Starter
Lively Member
That does the trick!
Thanks, Chrisjk ... that was exactly what I needed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|