Hey please help i need to set the active window in vb.net
so please tell me how to do it??
Printable View
Hey please help i need to set the active window in vb.net
so please tell me how to do it??
Please provide a full and clear description. Do you mean a form within your app or a window outside your app?
If you need to set another application's active window u must use API.
Stuff like:
GetWindow
setForegroundWindow
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.
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
Anyone???
Please
Did you ready my post?
SetForegroundWindow