Skip to content

Paltalk Bot Source Code VB .net 2010

Viewing 15 posts - 61 through 75 (of 77 total)
  • Author
    Posts
  • #186764
    Chike
    Member

    Sorry part of it is my fault, LVM_GETITEM call is a bit different, iItem need to be set.
    to gext both text and image

    myItem.mask = LVIF_IMAGE or LVIF_TEXT
    myItem.iItem = i
    myItem.iSubItem = 0
    ...
    myItem.pszText = pStrBufferMemory
    myItem.cchTextMax = StringBufferLength
    
    SendMessage(lstviewhwnd, LVM_GETITEM, 0, pMyItemMemory)

    To get the image only you don’t need pStrBufferMemory.

    Other things:
    According to documentantion VirtualAllocEx need to be called with MEM_COMMIT or MEM_RESERVE.
    You can save one call too VirtualAllocEx and one to VirtualFreeEx by allocation all tye memory needed at once

    pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem)+StringBufferLength, MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE)
    pStrBufferMemory = pMyItemMemory+Len(myItem)
    ...
    result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)
    #186763
    saaminathan
    Member

    Hi 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
    #186762
    saaminathan
    Member

    Hi Chike,

     

    I got it and have read the flags. Thank you very much.

    #186761
    Admin
    Administrator

    Lol you right Chike we both locos ehheh Hey you guys keep working on this I will be putting a timer on the bot thanks 🙂

    #186760
    Chike
    Member

    Hi Chike
    Below is the updated code. It returns an empty string. What might be wrong?

    A bit messy code eh?
    The WriteProcessMemory was missing, duplicate unneeded call to VirtualAllocEx, i is not needed either

    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
    	
    	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 item and string buffer
    	‘***********************************************************
    	Call GetWindowThreadProcessId(lstviewhwnd, ProcessID)
    	pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, ProcessID)
    	pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem) + StringBufferLength, MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE)
    	pStrBufferMemory = pMyItemMemory + Len(myItem)
    	‘************************************************************************************
    	‘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 = itemIndex
    	myItem.iSubItem = 0
    	myItem.pszText = pStrBufferMemory
    	myItem.cchTextMax = StringBufferLength
    	‘**********************************************************
    	‘write the structure into the remote process’s memory space
    	‘**********************************************************
    	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, 0, 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 = CloseHandle(pHandle)
    	If Len(tmpString) > 0 Then GetSLVSelectedImageItem = tmpString
    		Return tmpString
     End Function
    

     

    #186759
    saaminathan
    Member

    Hi 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 Sub

    #186758
    Chike
    Member

    NicArray must be Nothing, check mdlSysListView.GetAllSLVItems code.
    You have a debugger, use it.

    #186757
    saaminathan
    Member

    Hi Chike

    I checked the issue and resolved it.. Now everything working perfectly.

    #186756
    Chike
    Member

    BTW you can simply ListBox28.Items.AddRange(NicArray) instead of looping and probably get rid of the if too

    #186755
    saaminathan
    Member

    BTW 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

     

    #186754
    Chike
    Member

    There is no handle to lower hand. To lower hand or to reddot/unreddot etc. you need to select the nick send a WM_COMMAND, to the chat window I think. Bounce is more complicated because SendMessage is a blocking call and the bounce dialog need to be OKed, so PostMessage is used instead.
    See what command does it, the code for reddot should be there or you can search the forum.
    I once posted code(s) to find the commands at runtime

    How to find paltalk commands at runtime.

    #186753
    saaminathan
    Member

    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)

     

    #186752
    Chike
    Member

    @saamiyaar
    There is nothing wrong with that line, have you tried to set a breakpoint at that line?
    Do you still have the problem if the IM is already open?

    #186751
    Mytacism
    Member

    Can I ask for the updated source code that has a trivia TIMER on it? Because this version has no trivia timer. Thank you my friend LOCO!

    #199423
    attockonian
    Member

    For clarity this would work with the new paltalk (and not the classic one) since its Code VB vb 2010?

Viewing 15 posts - 61 through 75 (of 77 total)
  • You must be logged in to reply to this topic.