Forum Replies Created
-
AuthorPosts
-
December 11, 2014 at 10:01 am #186753saaminathanMember
Hi Chike
I have successfully opened a IM window but having difficulty in sending a auto IM message. Below is the code i have generated but ts doesnt send the IM. Please assist. Thank you
In below code, i select a list of names as playername and then open an IM window for their name .
playername = ListBox30.Items(ListBox30.SelectedIndex)
HighlightNic(playername)
PostMessage(FindWindow(mdlPalInfo.ChatRoomClass, CtrlRoomSelector1.RoomName), WM_COMMAND, mdlPalInfo.IMfromRoomCommand, 0)ChatRTB1.Text = gamemsg
imsentchat = GetChild(mdlPalInfo.ChatRoomClass, playername, mdlPalInfo.SendTextUD) <—–[[ The issue is here. The command doesnt get the IM window handle with the playername]]
SendPalTxt(imsentchat, ChatRTB1.Rtf)December 1, 2014 at 6:52 am #186755saaminathanMemberBTW you can simply ListBox28.Items.AddRange(NicArray) instead of looping and probably get rid of the if too
Hi Chike
Thank you for the tip. I have another query. How do i lower hand and how do i get the handle for lowerhand ?
Thank you
November 30, 2014 at 5:49 pm #186757saaminathanMemberHi Chike
I checked the issue and resolved it.. Now everything working perfectly.
November 30, 2014 at 12:35 pm #186759saaminathanMemberHi Chike and Loco
Thank you for all the assistance. I have completed the code to get the mic status. But I get the following exception and nothing resolves it. Please assist.
An unhandled exception of type ‘System.NullReferenceException’ occurred in Paltalk Bot.exe
Additional information: Object reference not set to an instance of an object.
Private Sub GetAllUserList()
Dim i As Integer
Dim NicArray() As String
‘Empty the listbox
ListBox28.Items.Clear()
‘Add nics to a listbox
Dim iHnd As IntPtr = mdlHnd.GetChild(ChatRoomClass, Me.CtrlRoomSelector1.RoomName, NicListID)
If iHnd <> IntPtr.Zero Then
NicArray = mdlSysListView.GetAllSLVItems(iHnd)
If NicArray.Length > 0 Then <————- This is the line with the exception
For i = 0 To NicArray.Length – 1
ListBox28.Items.Add(NicArray(i))
Next
End If
End If
End SubNovember 29, 2014 at 12:58 pm #186762saaminathanMemberHi Chike,
I got it and have read the flags. Thank you very much.
November 29, 2014 at 9:13 am #186763saaminathanMemberHi Chike
Below is the updated code. It returns an empty string. What might be wrong?
Public Function GetSLVSelectedImageItem(ByVal lstviewhwnd As IntPtr) As String Dim result As Integer Dim myItem As LV_ITEMA Dim pHandle As Integer Dim pStrBufferMemory As Integer Dim pMyItemMemory As Integer Dim strBuffer() As Byte Dim index As Integer Dim tmpString As String = String.Empty Dim ProcessID As Integer Dim usernum, itemIndex As Integer Dim i As Short itemIndex = SendMessage(lstviewhwnd, LVM_GETNEXTITEM, -1, LVNI_SELECTED) usernum = SendMessage(lstviewhwnd, LVM_GETITEMCOUNT, 0, 0) '********************** 'init the string buffer '********************** ReDim strBuffer(StringBufferLength) '*********************************************************** 'open a handle to the process and allocate the string buffer '*********************************************************** Call GetWindowThreadProcessId(lstviewhwnd, ProcessID) pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, ProcessID) pStrBufferMemory = VirtualAllocEx(pHandle, 0, StringBufferLength, MEM_COMMIT, PAGE_READWRITE) '************************************************************************************ '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_TEXT myItem.iItem = i myItem.iSubItem = 0 '********************************************************** 'write the structure into the remote process's memory space '********************************************************** pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem) + StringBufferLength, MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE) pStrBufferMemory = pMyItemMemory + Len(myItem) '************************************************************* '************************************************************* '************************************************************* ' i = itemIndex '************************************************************* 'send the get the item message and write back the memory space '************************************************************* myItem.pszText = pStrBufferMemory myItem.cchTextMax = StringBufferLength result = SendMessage(lstviewhwnd, LVM_GETITEM, 0, pMyItemMemory) ' result = SendMessage(lstviewhwnd, LVM_GETITEM, i, pMyItemMemory) result = ReadProcessMemory(pHandle, pStrBufferMemory, strBuffer(0), StringBufferLength, 0) result = ReadProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0) '************************************************** 'turn the byte array into a string and send it back '************************************************** For index = LBound(strBuffer) To UBound(strBuffer) If Chr(strBuffer(index)) = vbNullChar Then Exit For tmpString = tmpString & Chr(strBuffer(index)) Next index tmpString = Trim(tmpString) MsgBox(tmpString) '************************************************** 'deallocate the memory and close the process handle '************************************************** result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE) result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE) result = CloseHandle(pHandle) If Len(tmpString) > 0 Then GetSLVSelectedImageItem = tmpString Return tmpString End Function
November 29, 2014 at 6:04 am #186765saaminathanMemberHi Chike
I have changed the code as per your suggestion but then the string returned by the function is empty. what did i do wrong here? Thank you in advance.
My code below :
Public Function GetSLVSelectedImageItem(ByVal lstviewhwnd As IntPtr) As String Dim result As Integer Dim myItem As LV_ITEMA Dim pHandle As Integer Dim pStrBufferMemory As Integer Dim pMyItemMemory As Integer Dim strBuffer() As Byte Dim index As Integer Dim tmpString As String = String.Empty Dim ProcessID As Integer Dim usernum, itemIndex As Integer Dim i As Short itemIndex = SendMessage(lstviewhwnd, LVM_GETNEXTITEM, -1, LVNI_SELECTED) usernum = SendMessage(lstviewhwnd, LVM_GETITEMCOUNT, 0, 0) '********************** 'init the string buffer '********************** ReDim strBuffer(StringBufferLength) '*********************************************************** 'open a handle to the process and allocate the string buffer '*********************************************************** Call GetWindowThreadProcessId(lstviewhwnd, ProcessID) pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, ProcessID) pStrBufferMemory = VirtualAllocEx(pHandle, 0, StringBufferLength, MEM_COMMIT, PAGE_READWRITE) '************************************************************************************ '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 myItem.iSubItem = 0 myItem.pszText = pStrBufferMemory myItem.cchTextMax = StringBufferLength '********************************************************** '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) '************************************************************* '************************************************************* '************************************************************* i = itemIndex '************************************************************* 'send the get the item message and write back the memory space '************************************************************* result = SendMessage(lstviewhwnd, LVM_GETITEM, i, pMyItemMemory) result = ReadProcessMemory(pHandle, pStrBufferMemory, strBuffer(0), StringBufferLength, 0) result = ReadProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0) '************************************************** 'turn the byte array into a string and send it back '************************************************** For index = LBound(strBuffer) To UBound(strBuffer) If Chr(strBuffer(index)) = vbNullChar Then Exit For tmpString = tmpString & Chr(strBuffer(index)) Next index tmpString = Trim(tmpString) '************************************************** 'deallocate the memory and close the process handle '************************************************** result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE) result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE) result = CloseHandle(pHandle) If Len(tmpString) > 0 Then GetSLVSelectedImageItem = tmpString Return tmpString End Function End Module
November 26, 2014 at 9:38 am #186769saaminathanMemberOh my bad. Sorry Chike.
Thank you for the quick reply.
Will check and try now.
November 26, 2014 at 2:09 am #186771saaminathanMemberHi Loco
Thank you for the code snippet, how do I read the flags from the user list? Please advise or show some sample code.
November 25, 2014 at 3:44 pm #186773saaminathanMemberHi Loco
Thank you for the source code. are you still updating the code? I want to learn how to check who is on the mic and how many people have their hands raised. Any references or suggestions?
-
AuthorPosts