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

honey_34 wrote:hey guys am na able to get my paltalk list into list box .


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

#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <string.h>
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("%s\n", 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(" %s\n", 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<char*>(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 = '\0';
}
// Clean up
VirtualFreeEx(hProc, xtvitem, 0, MEM_RELEASE);
CloseHandle(hProc);
}
}
}

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)


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
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
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));
}
}


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;



Return to Visual Basic Programming
Users browsing this forum: No registered users and 0 guests