הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Monday, August 20, 2012 9:22 PM
I want my application to show and focus between the applications in the taskbar, how can I?
i'm using vb.net on visual studio 2010.
All replies (4)
Monday, August 20, 2012 11:54 PM ✅Answered | 1 vote
try this. it uses notepad, but it'll work for any windows app:
Public Class Form1
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As Integer
Private Const SW_SHOWNORMAL As Integer = 1
Private Const SW_SHOWMINIMIZED As Integer = 2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iHwnd As IntPtr = FindWindow("notepad", vbNullString)
ShowWindow(iHwnd, SW_SHOWMINIMIZED)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim iHwnd As IntPtr = FindWindow("notepad", vbNullString)
ShowWindow(iHwnd, SW_SHOWNORMAL)
End Sub
End Class
thanks for any help
Wednesday, August 22, 2012 7:02 PM ✅Answered
thank you mr.Mr. Monkeyboy for your time
thank you mr. paul, that is my answer, but i have one more question please
ByVal lpClassName As String
how can I know the lpClassName for the window that I want to find???
any ideas will be very aprecciated :)
try this instead:
Dim iHwnd As IntPtr = FindWindow(vbNullString, "window title text here")
thanks for any help
Monday, August 20, 2012 11:25 PM | 1 vote
This is the closest I could find but it's not what you're looking for
http://www.thescarms.com/vbasic/ShowWindow.aspx
You've taught me everything I know but not everything you know.
Wednesday, August 22, 2012 6:22 PM
thank you mr.Mr. Monkeyboy for your time
thank you mr. paul, that is my answer, but i have one more question please
ByVal lpClassName As String
how can I know the lpClassName for the window that I want to find???
any ideas will be very aprecciated :)