|
-
May 29th, 2000, 04:27 AM
#1
I'd like to create a program that could force other programs to be "Always On Top" and later not "Always On Top".
The way I thought of doing it is after selecting a menu option in my program...it picks up on the next click of the mouse...it gets the handle of the program clicked on then...viola...makes that program float on top.
Any ideas how? I have seen it done in the past but got no idea how!
-
May 29th, 2000, 05:07 AM
#2
Use the SetForegroundWindow API.
Code for module.
Code:
Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Make a Form with 2 Command buttons and put the following code in them. Also create another Form called Form2.
Code:
Private Sub Command1_Click()
Form2.Show ' Show Form2
Me.SetFocus ' Give the Focus back to form1
End Sub
Private Sub Command2_Click()
' Make Form2 the Foreground Window.
MyVar = SetForegroundWindow(Form2.hwnd)
End Sub
-
May 29th, 2000, 05:19 AM
#3
Right, ok...
Now how do you get the handle of the window that has just been clicked on? (It's not a window of my program...it could be notepad or the 3dfx TV application...
-
May 29th, 2000, 05:21 AM
#4
Yes, I believe it can be any Window that is running.
-
May 29th, 2000, 05:24 AM
#5
Hmmm...ok then... 
How would you get the handle of the IE/Netscape window you're running now?
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
|