Results 1 to 2 of 2

Thread: need help positioning my form

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    5

    Question

    im having the same problem as steve.

    i can get the coordinates of the window i want with GetWindowRect, and then i can easily put my form to where i want it to be on the window by using SetWindowPos.

    BUT

    when i make that window be my form's parent by using SetParent, it just wont go where i want it to go!!

    Any ideas???

  2. #2
    Guest
    I believe this is what you want.

    Use FindWindow and SetParent apis to find another Window and put it in your form.

    Code:
    Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal
    hWndNewParent As Long) As Long
    Declare Function findwindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal
    hWndNewParent As Long) As Long
    
    'Open up the calculator and try this:
    'This will put the calculator in your form
    
    Dim x
    x = FindWindow(vbNullString, "Calculator")
    If x = 0 Then
    MsgBox "Window was not found!", 16
    Else
    SetParent x, Me.hWnd
    End If

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