|
-
Feb 6th, 2002, 07:58 AM
#1
Thread Starter
Lively Member
Windows, Captions and Getting Control
Can someone help me out with this please, TIA.
Let's say I have 2 windows programs, Prog1 and Prog2. Prog1 runs Prog2, everything's OK so far, Prog2 is ran so it's hidden, intentional, Prog2 pop's up a window with some information on it, again, that's fine. I've ended up with, I can see Prog1 and the Window generated from Prog2.
I would like to manipulate the Prog2 Window slightly, I want it to attached itself to the side of my Prog1 and this Prog2 Window I also want to get focus when my Prog1 does and the Prog2 window has no taskbar icon, I also want it to stick to my form so it moves with it.
I hope I've made it easy to understand my point.
I know I'll have to use things like FindWindow e.t.c. but get a bit stuff after that. The Window does always have the same text (form caption) displayed.
One last thing, I can't put anything into the code of Prog2, it's not a VB app.
Thanks
-
Feb 6th, 2002, 09:20 AM
#2
Thread Starter
Lively Member
I can get the handle of the window, works fine, using:
mWnd = FindWindow(vbNullString, "Prog2 Window")
And to test it:
BringWindowToTop mWnd
All works fine, it just the part concerning posistioning it. Basically I want the left of the Window to = Prog1 Form left+offset and top of the window to = top of Prog1 form.
I've been messing with the 'SetTopMostWindow' but just can't get it to posistion the window.
-
Feb 6th, 2002, 12:57 PM
#3
I think you want an API called GetClientRect.
Code:
Private Declare Function GetClientRect Lib "user32" Alias "GetClientRect" (ByVal hwnd As Long, lpRect As RECT) As Long
will give you the rectangle with the coordinates of the target
window.
If you add an offset to the child window, then you can then call
Code:
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
goto http://www.allapi.net/
They've got a downloadable API view that has examples, notes, parameters, etc.....
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|