Results 1 to 3 of 3

Thread: Moving a program that is not urs

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Moving a program that is not urs

    Let's say if i appactivated a program and the title bar was something like "Guard" if i wanted to move that program into the center of the screen, or anywhere else. How would I go about doing that?
    -RaY
    VB .Net 2010 (Ultimate)

  2. #2
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    Use the SetWindowPos API

  3. #3
    Tygur
    Guest
    While SetWindowPos works, MoveWindow is easier.

    I suggest that you use FindWindow to get the handle to the window and then MoveWindow to move it.

    VB Code:
    1. Dim lHwnd As Long
    2. lHwnd = FindWindow(vbNullString, "Guard")
    3. MoveWindow lHwnd, NewXPosition, NewYPosition, NewWidth, NewHeight, 1


    Here are the declares:
    VB Code:
    1. Private Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (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
    2. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

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