Skip to content
Home > Programming > my paltalk list

my paltalk list

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #187424
    honey_34
    Member

    hey guys am na able to get my paltalk list into list box . 🙁

    #187440
    Chike
    Member

    @honey_34 wrote:

    hey guys am na able to get my paltalk list into list box . 🙁

    Pitty.

    Try to be more specific and explain what you are trying to do and what is the problem.

    #187439
    honey_34
    Member

    i want to display my paltalk nickname list including offline nicknames into a vb list box .

    #187438
    String
    Member

    @honey_34 wrote:

    hey guys am na able to get my paltalk list into list box

    Post what you have tried so far.

    #187437
    Chike
    Member

    This is an update to the code I have posted in this C++ example.
    It uses messages instead of the macros (that are commented out.)

    #include
    #include
    #include
    #include
    
    void GetTVItem(HWND hwnd, HTREEITEM htvitem, char *buff, int buff_len);
    
    int main(int argc, char *argv[])
    {
    HWND seinfeldsuperman, wtlsplitterwindow, atla, gradienttreeviewclass;
    
    seinfeldsuperman = FindWindow("seinfeld_superman", NULL);
    wtlsplitterwindow = FindWindowEx(seinfeldsuperman, 0, "wtl_splitterwindow", NULL);
    // Paltalk 9.5
    atla = FindWindowEx(wtlsplitterwindow, 0, "ATL:0080DAA8", NULL);
    if (atla == NULL) // Paltalk 9.1
    atla = FindWindowEx(wtlsplitterwindow, 0, "atl:006d06d0", NULL);
    if (atla == NULL) /// Paltalk Scene
    atla = FindWindowEx(wtlsplitterwindow, 0, "ATL:006FBF78", NULL);
    if (atla == NULL) // Paltalk 8.5
    atla = FindWindowEx(wtlsplitterwindow, 0, "ATL:00547638", NULL);
    gradienttreeviewclass = FindWindowEx(atla, 0, "gradienttreeviewclass", NULL);
    /// get root item (Pals, Offline, and custome groups)
    HTREEITEM htvitem = (HTREEITEM) //TreeView_GetRoot(gradienttreeviewclass);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM, TVGN_ROOT, NULL);
    char text[256];
    while (htvitem) {
    GetTVItem(gradienttreeviewclass, htvitem, text, 256);
    // un-comment the '|| true' to see onffine too
    if (_strnicmp("offline", text, 7) /*|| true*/) {
    printf("%sn", text);
    // get 1st buddy in this group
    HTREEITEM htvsubitem = (HTREEITEM) //TreeView_GetChild(gradienttreeviewclass, htvitem);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM,
    TVGN_CHILD, PtrToLong(htvitem));
    while (htvsubitem) {
    GetTVItem(gradienttreeviewclass, htvsubitem, text, 256);
    printf(" %sn", text);
    // get next buddy
    htvsubitem = (HTREEITEM) //TreeView_GetNextSibling(gradienttreeviewclass, htvitem1);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM,
    TVGN_NEXT, PtrToLong(htvsubitem));
    }
    }
    // get next group
    htvitem = (HTREEITEM)//TreeView_GetNextSibling (gradienttreeviewclass, htvitem);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM,
    TVGN_NEXT, PtrToLong(htvitem));
    }
    system("PAUSE");
    return EXIT_SUCCESS;
    }
    void GetTVItem(HWND hwnd, HTREEITEM htvitem, char *buff, int buff_len)
    {
    DWORD lProcID;
    // Get the process ID in which the TreeView is running
    GetWindowThreadProcessId(hwnd, &lProcID);
    if (lProcID != 0) {
    // make sure we have read write permissions in the process space
    HANDLE hProc = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, lProcID);
    if (hProc != 0) {
    // Grab enough memory in the other procedure's space to hold our TVITEM and the return text buffer
    void *xtvitem = VirtualAllocEx(hProc, 0, sizeof(TVITEM)+buff_len, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
    
    // Set up our local TVITEM
    TVITEM tv_item;
    
    tv_item.mask = TVIF_TEXT;
    tv_item.hItem = htvitem;
    tv_item.pszText = static_cast(xtvitem)+sizeof(TVITEM);
    tv_item.cchTextMax = buff_len;
    
    // Copy the local TVITEM into the space we reserved in the foreign process
    WriteProcessMemory(hProc, xtvitem, &tv_item, sizeof(TVITEM), NULL);
    
    // Now send the message, but pass the address of the copy of our TVITEM that now exists in the foreign process instead of our local versiony
    BOOL res = (BOOL) //TreeView_GetItem(hwnd, xtvitem);
    SendMessage(hwnd, TVM_GETITEM, 0, PtrToLong(xtvitem));
    if (res) {
    // the return text buffer (address) may have changed so we need to copy it back
    ReadProcessMemory(hProc, xtvitem, &tv_item, sizeof(TVITEM), NULL);
    // Since we have no clue about it's length we have to copy it all
    ReadProcessMemory(hProc, tv_item.pszText, buff, buff_len, NULL);
    // Note: last line is a bit risky if buffer was actually changed
    // Because we could cross page boundary and hit a non-alloocated
    // page.
    } else {
    *buff = '';
    }
    // Clean up
    VirtualFreeEx(hProc, xtvitem, 0, MEM_RELEASE);
    CloseHandle(hProc);
    }
    }
    }

     

    #187436
    honey_34
    Member

    This is my code :

    Dim SuperM As Long, Wsplt As Long, Atla, GradViewClass As Long
    SuperM = FindWindow("seinfeld_superman", vbNullString)
    Wsplt = FindWindowEx(SuperM, 0&, "wtl_splitterwindow", vbNullString)
    Atla = FindWindowEx(Wsplt 0&, "atl:0080daa8", vbNullString)
    GradViewClass = FindWindowEx(Atla, 0&, "gradienttreeviewclass", vbNullString)

    ' Then pass GradViewClass to the GetListViewItem

    Call GetListviewItem(GradViewClass)
    #187435
    Chike
    Member

    So what’s the problem?

    #187434
    String
    Member

    Yeah, what is the problem?
    What is GetListviewItem returning?

    #187433
    Chike
    Member

    More important what does it do?
    Don’t show us partial code, the less important part, and expect us to be able to help you.

    #187432
    honey_34
    Member

    Sorry guys i expected the getlistviewitem will return my paltalk nicknames when i call GetMyPalList Function.

    Function GetMyPalList()
    Dim SuperM As Long, Wsplt As Long, Atla, GradViewClass As Long
    SuperM = FindWindow("seinfeld_superman", vbNullString)
    Wsplt = FindWindowEx(SuperM, 0&, "wtl_splitterwindow", vbNullString)
    Atla = FindWindowEx(Wsplt 0&, "atl:0080daa8", vbNullString)
    GradViewClass = FindWindowEx(Atla, 0&, "gradienttreeviewclass", vbNullString)

    ' Then pass GradViewClass to the GetListViewItem

    Call GetListviewItem(GradViewClass)
    End Function

    This is GetListviewItem code posted by chike i guess.

    Public Function GetListviewItem(ByVal lstviewhwnd As Long) As String
    Dim result As Long
    Dim myItem As LV_ITEMA
    Dim pHandle As Long
    Dim pStrBufferMemory As Long
    Dim pMyItemMemory As Long
    Dim strBuffer() As Byte
    Dim Index As Long
    Dim tmpString, tmp2 As String
    Dim strLength As Long
    Dim ProcessID As Long
    Dim ItemCount, i As Long

    '**********************
    'init the string buffer
    '**********************
    ReDim strBuffer(MAX_LVMSTRING)

    '***********************************************************
    '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, MAX_LVMSTRING, 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_TEXT
    myItem.iSubItem = 2
    myItem.pszText = pStrBufferMemory
    myItem.cchTextMax = MAX_LVMSTRING

    '**********************************************************
    'write the structure into the remote process's memory space
    '**********************************************************
    pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem), MEM_COMMIT, PAGE_READWRITE)
    ItemCount = SendMessage(lstviewhwnd, LVM_GETITEMCOUNT, 0&, 0&)

    For i = 0 To ItemCount - 1
    result = WriteProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0)

    '*************************************************************
    'send the get the item message and write back the memory space
    '*************************************************************
    result = SendMessage(lstviewhwnd, LVM_GETITEMTEXT, i, ByVal pMyItemMemory)
    result = ReadProcessMemory(pHandle, pStrBufferMemory, strBuffer(0), MAX_LVMSTRING, 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))
    tmp2 = tmp2 & Chr(strBuffer(Index))
    Next Index
    tmp2 = Replace(tmp2, "@", "")
    List3.AddItem tmp2
    tmp2 = ""

    Next
    '
    '**************************************************
    '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 GetListviewItem = tmpString
    End Function

    the original code was used to get the nicknames from the room by calling NickGet function. my problem is that i tried to get my own paltalk nicknames including offline nicknames using GetMyPalList function instead of NickGet but List3 return nothing .

    #187431
    Chike
    Member

    Well I suspected that. It is not listview It’s a treeview, so it won’t work.
    Look at my code, the first part in main is walking the tree (the while loops) and GetTVItem is retriving the text (quite the same as GetListviewItem does.)
    The difference from a list view is that the tree is not a flat list but has levels. Each level is a list and each item can have sub list.
    Combined with TVM_GETNEXTITEM, TVGN_ROOT gets the first item in the tree, TVGN_NEXT gets the next item in the same level, and TVGN_CHILD gets the first item in sub level.
    This tree only has 2 levels so I made it in 2 loops, but actually this better be done recursively.

    //edit

    Recursively the code would look like this:


    void WalkTreeView(HWND htv, HTREEITEM htvitem, int level)
    {
    while (htvitem) {
    char text[256];
    GetTVItem(htv, htvitem, text, 256);
    print_level(text, level);
    HTREEITEM htvsubitem = (HTREEITEM)
    SendMessage(htv, TVM_GETNEXTITEM, TVGN_CHILD, PtrToLong(htvitem));
    WalkTreeView(htv, htvsubitem, level+1);
    htvitem = (HTREEITEM)
    SendMessage(htv, TVM_GETNEXTITEM, TVGN_NEXT, PtrToLong(htvitem));
    }
    }

    Call WalkTreeView with the item you got with TVGN_ROOT and level 0.
    Replace print_level with whatever suits your needs.

    #187430
    Departure
    Member

    Im going to port this code from chike to delphi, I never played around with the buddy list before so this should be fun todo and also get to use the TreeView API’s which I have’nt really played around with before either 😉 .

    #187429
    Departure
    Member

    And delphi version of getting Treeview 🙂


    function TreeNodeGetNext(mHandle: THandle; mTreeItem: HTreeItem): HTreeItem;
    var
    vParentID: HTreeItem;
    begin
    Result := nil;
    if (mHandle 0) and (mTreeItem nil) then begin
    Result := TreeView_GetChild(mHandle, mTreeItem);
    if Result = nil then
    Result := TreeView_GetNextSibling(mHandle, mTreeItem);
    vParentID := mTreeItem;
    while (Result = nil) and (vParentID nil) do begin
    vParentID := TreeView_GetParent(mHandle, vParentID);
    Result := TreeView_GetNextSibling(mHandle, vParentID);
    end;
    end;
    end; { TreeNodeGetNext }


    function TreeNodeGetLevel(mHandle: THandle; mTreeItem: HTreeItem): Integer;
    var
    vParentID: HTreeItem;
    begin
    Result := -1;
    if (mHandle 0) and (mTreeItem nil) then begin
    vParentID := mTreeItem;
    repeat
    Inc(Result);
    vParentID := TreeView_GetParent(mHandle, vParentID);
    until vParentID = nil;
    end;
    end; { TreeNodeGetLevel }


    function GetTreeViewText(mHandle: THandle; mStrings: TStrings): Boolean;
    var
    vItemCount: Integer;
    vBuffer: array[0..255] of Char;
    vProcessId: DWORD;
    vProcess: THandle;
    vPointer: Pointer;
    vNumberOfBytesRead: Cardinal;
    I: Integer;
    vItem: TTVItem;
    vTreeItem: HTreeItem;
    begin
    Result := False;
    if not Assigned(mStrings) then Exit;
    GetWindowThreadProcessId(mHandle, @vProcessId);
    vProcess := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or
    PROCESS_VM_WRITE, False, vProcessId);
    vPointer := VirtualAllocEx(vProcess, nil, 4096, MEM_RESERVE or MEM_COMMIT,
    PAGE_READWRITE);
    mStrings.BeginUpdate;
    try
    mStrings.Clear;
    vItemCount := TreeView_GetCount(mHandle);
    vTreeItem := TreeView_GetRoot(mHandle);
    for I := 0 to vItemCount - 1 do begin
    with vItem do begin
    mask := TVIF_TEXT;
    cchTextMax := SizeOf(vBuffer);
    pszText := Pointer(Cardinal(vPointer) + SizeOf(vItem));
    hItem := vTreeItem;
    end;
    WriteProcessMemory(vProcess, vPointer, @vItem,
    SizeOf(vItem), vNumberOfBytesRead);
    SendMessage(mHandle, TVM_GETITEM, 0, lparam(vPointer));
    ReadProcessMemory(vProcess, Pointer(Cardinal(vPointer) + SizeOf(TLVItem)),
    @vBuffer[0], SizeOf(vBuffer), vNumberOfBytesRead);
    mStrings.Add(StringOfChar(#9, TreeNodeGetLevel(mHandle, vTreeItem)) + vBuffer);
    vTreeItem := TreeNodeGetNext(mHandle, vTreeItem);
    end;
    finally
    VirtualFreeEx(vProcess, vPointer, 0, MEM_RELEASE);
    CloseHandle(vProcess);
    mStrings.EndUpdate;
    end;
    Result := True;
    end; { GetTreeViewText }


    //Example
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    RegisterHotKey(Handle, 1, MOD_ALT, VK_F2);
    end;


    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    UnRegisterHotKey(Handle, 1);
    end;


    procedure TForm1.WMHOTKEY(var Msg: TWMHOTKEY);
    begin
    case Msg.HotKey of
    1:
    GetTreeViewText(
    WindowFromPoint(Point(Mouse.CursorPos.X, Mouse.CursorPos.Y)),
    MemoText.Lines);
    end;
    end;

    Add commctrl libary to your uses and add a new private procedure for hotkey 😉

    Place mouse over the buddy list and press and hold ALT key and F2

    #187428
    honey_34
    Member

    i tried to understand the code posted by chike and Departure , but i couldn’t am not familiar with C++ and delphi 🙁 .. so how can i convert it to vb6 ?

    #187427
    String
    Member

    Did you try searching the forum? look at this post.

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