|
-
May 4th, 2010, 08:30 PM
#1
Thread Starter
Lively Member
Active
Hey please help i need to set the active window in vb.net
so please tell me how to do it??
-
May 4th, 2010, 08:48 PM
#2
Re: Active
Please provide a full and clear description. Do you mean a form within your app or a window outside your app?
-
May 4th, 2010, 08:49 PM
#3
Re: Active
If you need to set another application's active window u must use API.
Stuff like:
GetWindow
setForegroundWindow
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
May 5th, 2010, 01:41 AM
#4
Thread Starter
Lively Member
Re: Active
i want window outside my app
 Originally Posted by sapator
If you need to set another application's active window u must use API.
Stuff like:
GetWindow
setForegroundWindow
i found out on google but they are not working they are for vb6
and have many errors in vb.net
-
May 5th, 2010, 01:49 AM
#5
Re: Active
VB6 declarations are often OK as is except that you need to change any Long type to Integer. There may be other changes required to. If you go to PInvoke.net then you can find .NET declarations for many Windows APIs.
-
May 5th, 2010, 04:43 AM
#6
Thread Starter
Lively Member
Re: Active
Please Can you give me how can i set a window
i have working codes for finding it
Code:
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetClassName Lib "user32" _
Alias "GetClassNameA" _
(ByVal hWnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long
Public Sub GetClassNameFromTitle()
Dim sInput As String
Dim hWnd As Long
Dim lpClassName As String
Dim nMaxCount As Long
Dim lresult As Long
' pad the return buffer for GetClassName
nMaxCount = 256
lpClassName = Space(nMaxCount)
' Note: must be an exact match
sInput = InputBox("Enter the exact window title:")
' No validation is done as this is a debug window utility
hWnd = FindWindow(vbNullString, sInput)
' Get the class name of the window, again, no validation
lresult = GetClassName(hWnd, lpClassName, nMaxCount)
Debug.Print("Window: " & sInput)
Debug.Print("Class name: " & VB.Left(lpClassName, lresult))
End Sub
-
May 6th, 2010, 11:02 AM
#7
Thread Starter
Lively Member
-
May 6th, 2010, 05:59 PM
#8
Re: Active
Did you ready my post?
SetForegroundWindow
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
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
|