- This topic has 4 replies, 3 voices, and was last updated 16 years ago by AhFox.
-
AuthorPosts
-
November 12, 2008 at 8:14 pm #187477TWiZAMember
Hi
Private Delegate Function EnumWin(ByVal HwD As Integer, ByVal lparam As Integer) As Boolean Private Declare Function EnumWindows Lib "user32.dll" Alias "EnumWindows" (ByVal FuncCall As EnumWin, ByVal lParam As Integer) As Boolean Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Integer, ByVal FuncCall As EnumWin, ByVal lParam As Integer) As Boolean Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal HwnD As Integer, ByVal lpClassName As String, ByVal nMaxCount As Integer) As Integer Private Function FindRooms(ByVal HwD As Integer, ByVal lparam As Integer) As Boolean Dim sClass As String = Space(255) Dim nC As Integer = GetClassName(HwD, sClass, 255) Dim WinTxt As String sClass = Left(sClass, nC) If sClass = "DlgGroupChat Window Class" Then WinTxt = sGetText(HwD) If WinTxt.Contains(" Voice Room") Then End If End If Return True End Function Private Function FindHwndCTL(ByVal HwD As Integer, ByVal lparam As Integer) As Boolean Dim sClass As String = Space(255) Dim nC As Integer = GetClassName(HwD, sClass, 255) Static i As UShort sClass = Left(sClass, nC) If sClass = "SysListView32" Then _listHWD = HwD If sClass = "RichEdit20A" Then i += 1 If i = 3 Then _sendHWD = HwD If i = 4 Then _textHWD = HwD : i = 0 : Return False : Exit Function End If Return True End Function EnumWindows(New EnumWin(AddressOf FindRooms), 0) EnumChildWindows(HwD, New EnumWin(AddressOf FindHwndCTL), 0)
November 15, 2008 at 8:50 pm #187481AhFoxMemberthis is very nice bro !!! :vexxler:
November 15, 2008 at 10:16 pm #187480ChikeMemberHowever there are several flows in the code.
First, the callback by no means reaturns “Boolean” which its size is machine implementation dependent. It is a 32 bit integer.
Second, lParam should be the size of pointer, for 32bit integer works, for 64bit it won’t, beter make it ByRef.
Also, the purpose of lParam is to enable passing a user defined data to the callback (normaly ByRef) which is the right way to implement it and more relieble as the static UShort that is used in FindHwndCTL may be left in a bad state, and sure is prefered over using global variables.November 15, 2008 at 11:25 pm #187479TWiZAMemberRemarks tooken in consideration, Thanks
I will edit later, anyway the code works good on win xpNovember 17, 2008 at 11:08 pm #187478AhFoxMemberYou guys are great !!! Cool …
I’m trying to get used to C# … because C# is more like JAVA. (JAVA style is great).
-
AuthorPosts
Related
- You must be logged in to reply to this topic.