- This topic has 9 replies, 5 voices, and was last updated 18 years ago by Admin.
-
AuthorPosts
-
October 22, 2005 at 11:02 pm #189251NewbieMember
How can we find a windows by partial caption in VB.NET ?
I read the exemple of Departure to do it in VB6, but i cannot convert it to VB.NET 🙁 need to FindWindow(“” – Voice Room”)October 23, 2005 at 3:09 pm #189260AdminAdministratorhave u chek this post I think there is a part of the code that can get the room name just using Group Voice 🙂
I think
October 23, 2005 at 4:38 pm #189259NewbieMemberNo
i dont find where did you see the findwindow Voice Group
October 23, 2005 at 7:31 pm #189258AhFoxMemberI believed he wants a code that … grab all the chatrooms opened ….
Such as string “Voice Group”
For examples:
If you are having 2 chatrooms opened… then a user selects one.
Is that right?
October 23, 2005 at 8:41 pm #189257NewbieMemberPm and Rooms have the same winclass
All i want to do is to find the room window and not the PM one
October 24, 2005 at 2:55 am #189256DepartureMemberhe wants the FindWindowWild Function converted over to VB.net, This way he will always get the correct room instead of the Pm, sorry i can’nt help you newbie with .net as i dont like to program with it and i dont want to learn it…
The findwildfunction i made years ago still works a treat even today :O)
October 24, 2005 at 12:26 pm #189255AhFoxMemberhahahaha … well this is easy …
STOP using vbNullString
FindWondow(“My class window”, then you put a string here … instead of vbNullString)
October 24, 2005 at 12:54 pm #189254DepartureMembernot that easy NVYE, yes you could just change VBnullstring to the window name… But that would miss the whole point of making a program to do it and you would be limited to the one room, and ytou say change FindWondow(“My class window”, then you put a string here … instead of vbNullString) well you first have to find the string and thats where the Findwindowwild function comes into play. like i said it works a treat
October 24, 2005 at 2:28 pm #189253AhFoxMemberwell … I think there is a lot of API out there … allows you to grab … all the windows ….
Then instr them … Voice Group or IM Chat or something like that I forgot … and it returns only that …
returns to a list then let a user select it …
or you can do … Auto Linker …. get the active application title .. and recorded the latest one.
Maiek sure you instr too … for voice is instr(“Voice Group”) … IM is something I forgot ….
hope this helps.
February 17, 2006 at 5:24 am #189252BattleStar-GalacticaMembertry this one:
‘ public declaration in your form1
Private Declare Function GetWindowText Lib “user32” Alias “GetWindowTextA” (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Private Declare Function GetWindowTextLength Lib “user32” Alias “GetWindowTextLengthA” (ByVal hwnd As Integer) As IntegerPublic Delegate Function MyDelegateCallBack(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean
Declare Function EnumWindows Lib “user32” (ByVal x As MyDelegateCallBack, ByVal y As Integer) As Integer
Dim wndtitle As String
‘function to evaluate the output of enumwindows
Public Function EnumOutput(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean
Dim length As Integer = GetWindowTextLength(hwnd)
Dim sb As String = Space(length)
GetWindowText(hwnd, sb, length + 25)
If sb.Length < 1 Then
Return True
End If
Dim title As String = sb.ToString()
If title “” Then
If title.IndexOf(“Voice Room”) > -1 Thenwndtitle = title
MessageBox.Show(title)
Return False ‘stop find next window
End If
End IfReturn True
End Function
‘and call the api function in the button click
EnumWindows(AddressOf EnumOutput, 0)
‘ the result will store in a variable wndtitle -
AuthorPosts
Related
- You must be logged in to reply to this topic.