basicly all i want to do is resize (height and width) of an external window, like IE or Freecell, and then move that window, with X Y pixel co-ordinates(top, left).

Thanks

Recommended Answers

All 4 Replies

API time... FindWindow to get the handle to the window, and SetWindowPos... If you search the web you should be able to find at least a few examples.

Good Luck

right, so i looked around and found some code but when i use it, it dosen't move/resize the window

Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE

Private Declare Function SetWindowPos Lib "user32" _
   (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
    ByVal x As Long, ByVal y As Long, _
    ByVal cx As Long, ByVal cy As Long, _
    ByVal wFlags As Long) As Long


Private Sub Command1_Click()
'typically called in the form load
   Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 1, 1, 500, 500, FLAGS)
End Sub

(no modules)

i have other code to get the hwnd of a window, but i thought i'd try it out with me.hwnd

Now, I want you to think about the FLAGS constant. I want you to look at how it is declared and then read the uFlags arguement in the help file for SetWindowPos...

Good Luck

Ah ha!! i guess i should have looked a bit closer at the code. Thanks!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.