- This topic has 14 replies, 5 voices, and was last updated 10 years ago by autopilot.
-
AuthorPosts
-
November 30, 2012 at 5:44 am #186702autopilotMember
Add status together when multiple status’ are present.
- none = 0
- cam = 1
- red dot = 5
- holding mic = 10
- hand is raised = 20
- So cam and mic = 11
Public Function GetSLVUserStatus(ByVal lstviewhwnd As IntPtr, ByVal UserIndex As Integer) As Integer Dim Result, iReturn As Integer Dim myItem As LV_ITEMA Dim pHandle As Integer Dim pMyItemMemory As Integer Dim ProcessID As IntPtr '*********************************************************** 'open a handle to the process '*********************************************************** Call GetWindowThreadProcessId(lstviewhwnd, ProcessID) pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, ProcessID) '************************************************************************************ 'initialize the local LV_ITEM structure 'The myItem.iSubItem member is set to the index of the column that is being retrieved '************************************************************************************ myItem.mask = LVIF_IMAGE Or LVIF_STATE myItem.iItem = UserIndex myItem.iSubItem = 0 myItem.stateMask = &HFFFF '********************************************************** 'write the structure into the remote process's memory space '********************************************************** pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem), MEM_COMMIT, PAGE_READWRITE) Result = WriteProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0) '************************************************************* 'send the get the item message and write back the memory space '************************************************************* Result = SendMessage(lstviewhwnd, LVM_GETITEM, UserIndex, pMyItemMemory) Result = ReadProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0) '************************************************** 'Read Image Index to get user status 'cam = 1 'red dot = 5 'holding mic = 10 'hand is raised = 20 '************************************************** iReturn = myItem.iImage '************************************************** 'deallocate the memory and close the process handle '************************************************** Result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE) Result = CloseHandle(pHandle) '************************************************** 'Return the Status value '************************************************** Return iReturn End Function
Note: May need to run as administrator!
November 30, 2012 at 6:07 am #186716autopilotMemberfor those looking for an easy way to detect if user is red dotted, you can do something like this:
Private Function IsRedDotted(ByVal wHnd As IntPtr, ByVal iUserIndex As Integer) As Boolean Dim bReturn As Boolean = False Try Dim iStatus As Integer = mdlSysListView.GetSLVUserStatus(wHnd, iUserIndex) Select Case iStatus Case 5 'MsgBox("Red Dot only") bReturn = True Case 6 '1 + 5 'MsgBox("On Cam + Red Dot") bReturn = True Case 15 '5 + 10 'MsgBox("Red Dot + On Mic") bReturn = True Case 16 '1 + 5 + 10 'MsgBox("On Cam + Red Dot + On Mic") bReturn = True Case 25 '5 + 20 'MsgBox("Red Dot + Hand Raised") bReturn = True Case 26 '1 + 5 + 20 'MsgBox("On Cam + Red Dot + Hand Raised") bReturn = True '************************************ '* I dont think the rest are possible '************************************ Case 35 '5 + 10 + 20 'MsgBox("Red Dot + On Mic + Hand Raised") bReturn = True Case 36 '1 + 5 + 10 + 20 'MsgBox("On Cam + Red Dot + On Mic + Hand Raised") bReturn = True Case Else ' No RedDot present bReturn = False End Select Catch ex As Exception End Try Return bReturn End Function
November 30, 2012 at 4:13 pm #186715ChikeMemberI’d do something lie this:
typedef enum UserStatusType { none = 0, cam = 1, reddot = 2, holdingmic = 4, handraised = 8 }; UserStatusType GetUserStatus(/*user name or index*/) { int iStatus = // Get status from list UserStatus Type rStatus = none; if (iStatus >= 20) { rStatus |= handraised; iStatus -= 20; } if (iStatus >= 10) { rStatus |= holdingmic; iStatus -= 10; } if (iStatus >= 5) { rStatus |= reddot; iStatus -= 5; } if (iStatus == 1) { rStatus |= cam; } return rStatus; }
User can then check which ever status it is intersted in
UserStatusType userStatu = GetUserStatus(); if (userStatus & reddot) [ // undot }
However I am not sure all combinations are valid, e,g 15 should never be possible, and 25 is in question
January 3, 2013 at 7:53 pm #186714AhFoxMemberLooks good … thanks!
August 2, 2013 at 2:53 pm #186713Johnny5MemberUse enum and return it, just random coding i did not actually test the code.
Enum UserStatus RedDot = 5 OnCamRedDot = 6 RedDotHandRaised = 25 End Enum Function GetUserStatus(ByVal wHnd As IntPtr, ByVal iUserIndex As Integer) As UserStatus Dim mUserStatus As UserStatus Dim iStatus As Integer = mdlSysListView.GetSLVUserStatus(wHnd, iUserIndex) mUserStatus = CType(iStatus , UserStatus) return mUserStatus End Function
August 2, 2013 at 10:17 pm #186712ChikeMember@Johnny5 wrote:
Use enum and return it, just random coding i did not actually test the code.
Enum UserStatus
RedDot = 5
OnCamRedDot = 6
RedDotHandRaised = 25
End EnumFunction GetUserStatus(ByVal wHnd As IntPtr, ByVal iUserIndex As Integer) As UserStatus
Dim mUserStatus As UserStatus
Dim iStatus As Integer = mdlSysListView.GetSLVUserStatus(wHnd, iUserIndex)
mUserStatus = CType(iStatus , UserStatus)return mUserStatus
End FunctionWhat is exactly the point in converting integer to another form of integer that has the same values?
August 2, 2013 at 10:21 pm #186711AhFoxMember@Chike wrote:
What is exactly the point in converting integer to another form of integer that has the same values?
I believe using the ENUM … you have the Intelli-sense from Visual Studio … instead of using the numerical value.
August 2, 2013 at 11:56 pm #186710ChikeMemberAugust 5, 2013 at 4:23 pm #186709AhFoxMemberNo … doesn’t make it different … but it’s better to understand.
In order words, instead of getSelectedUserStatus() return 1,2,3, or 4 now you’re getting DOTTED, ON_MIC, etcs. I rather prefer to have ENUM than to see numerical value, because I have to look into the dictionary to find out what 1 = ?, and 2 = ? …
It’s the matter of choice … but ENUM definitely better choice.
August 5, 2013 at 5:52 pm #186708ChikeMemberYou don’t look at the code when it’s running and it makes mo sense to ask what you are looking for than all the possible combinations e.g. if dot or camdot, or, if cam or camdot or camhand, when it is only the dot or cam or mic you are looking for.
November 27, 2013 at 11:16 pm #186707ChikeMember@autopilot wrote:
Add status together when multiple status’ are present.
none = 0
cam = 1
red dot = 5holding mic = 10
hand is raised = 20So cam and mic = 11
2 more in v11.2
hq cam = 2
viewing cam = 4
Updateed codetypedef enum UserStatusType { none = 0, cam = 1, reddot = 2, holdingmic = 4, handraised = 8 hq = 16 viewing = 32 }; UserStatusType GetUserStatus(/*user name or index*/) { int iStatus = // Get status from list UserStatus Type rStatus = none; if (iStatus >= 20) { rStatus |= handraised; iStatus -= 20; } if (iStatus >= 10) { rStatus |= holdingmic; iStatus -= 10; } if (iStatus >= 5) { rStatus |= reddot; iStatus -= 5; } if (iStatus == 4) { rStatus |= cam | viewing; } else if (iStatus == 2) { rStatus |= cam | hq; } else if (iStatus == 1) { rStatus |= cam; } return rStatus; }
December 4, 2013 at 10:08 am #186706ChiNaAdministrator//Edited / Deleted Topic!
@AutoPilot, Thats Geniuse, So this is basicly getting the Mics/Hands by Images. Thank you Auto-Pilot. We really needed that function! But i never Thought of it that way lol! So Clever and Geniouse!
@Chike, I been using Visual Studio Lately 🙁 Feeling so lost sometimes. Thanks for the Presentation.
Pretty cool to get 2 new Options!@NYVE, I agree bro.. I prefer Enum as well.
@Johnny5, Your Method is pretty Awesome, I checked it and works… Thanks mate!//Edited , Problem Solved…
I had problems getting some of the Functions! But fixed.! The code below is what I am using now.
And if I could get an idea about how to get the Win Handle ID for each time I start Paltalk, it could be great.My Code (Using Highlight Nic Method):
The Win Handle and Index:
Public ReadOnly Property Status() As String Get Return 69282 'Win Handle End Get End Property Public ReadOnly Property StatusIndex() As String Get Return 1 'Win Index End Get End Property
Highlights Nickname First – Created a Sub for Nickname in the room as “User” in TextBox1
Private Sub CheckStatus(ByVal User As String) If HighlightNic(TextBox1.Text) Then IsReddDot(Status, StatusIndex) Else MsgBox("User not Found!") End If End Sub
And ofcourse for the Call I use:
CheckStatus(TextBox1.Text)
This is Johnny5’s Method can be used too, very Simple and works:
GetUserStatus(Status, StatusIndex)
Thanks a lot for the awesome work guys.. AutoPilot, Chike and Johhny5
December 4, 2013 at 6:53 pm #186705ChikeMember@ChiNa-Man wrote:
And if I could get an idea about how to get the Win Handle ID for each time I start Paltalk, it could be great.
I thought we’re done with controls handles long ago.
December 4, 2013 at 9:43 pm #186704AhFoxMembercool … thanks for the update.
December 5, 2013 at 3:01 pm #186703 -
AuthorPosts
Related
- You must be logged in to reply to this topic.