Im trying to position a window with MoveWindow() API but it just keeps hiding the window and it has to be maximised to be able to see it.

The code im using is

Public 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

        Dim p As System.Diagnostics.Process

        For Each p In System.Diagnostics.Process.GetProcesses()

            If p.MainWindowTitle = "MyProcess" Then
                  GetWindowRect(p.MainWindowHandle, r)
                MsgBox("Left" & r.Left & vbNewLine & _
                 "Top" & r.Top & vbNewLine & _
                 "Bottom" & r.Bottom & vbNewLine & _
                 "Right" & r.Right)

                Call MoveWindow(p.MainWindowHandle, 110, 59, 1270, 957,False)

            End If


i have tried with all different co-orindates and sixes and its always the same.

any help is appreciated

Here is some code I use for dual monitors. This may help but is really intended for a user to be able to set their default screen (1 or 2) in a setting and have the form open to the center of the preferred screen.

Dim myScreens() As Screen = Screen.AllScreens

    If (myScreens.Length > 1) Then 'More than one screen        
        Dim PREF_SCREEN As Integer = My.Settings.SCREEN_PREF

        Dim SWIDTH As Integer = myScreens(PREF_SCREEN).WorkingArea.Width
        Dim SHEIGHT As Integer = myScreens(PREF_SCREEN).WorkingArea.Height

        Me.Left = myScreens(PREF_SCREEN).WorkingArea.Left + ((SWIDTH / 2) - Me.Width / 2)
        Me.Top = myScreens(PREF_SCREEN).WorkingArea.Top + ((SHEIGHT / 2) - Me.Height / 2)
    End If