Results 1 to 2 of 2

Thread: To DaveR... Forms within Forms

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125

    To DaveR... Forms within Forms

    For some reason, I could not reply to your original post, but hopefully you will see this.

    Use the SetParent API. I don't have VB at the moment, so I can't show you, but I know it works. You just have to provide the parent hWnd, and the child hWnd.
    <removed by admin>

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I had the exact same problem with that thread. Here is what I wanted to post.
    VB Code:
    1. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    2. Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    3.  
    4. 'Insert the following code to your first form (named Form1):
    5.  
    6. Private Sub Form_Load()
    7. Load Form2
    8. Form2.Show
    9.  
    10. Private Sub Form_Load()
    11. 'Replace the 'Form1' below with the name of the 'Parnt' Form
    12. Dim r As Long
    13. r = SetParent(Me.hWnd, Form1.hWnd)
    14. End Sub
    15.  
    16. 'To position the form once it has been made a part of the parent form, use this code:
    17. 'Replace '250, 250, 400, 400' with the form coordinates.
    18. Call MoveWindow(Me.hwnd, 250, 250, 400, 400, 1)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width