invite all budlist in c++

Here you can talk about C++ And C# And Other languages programming.

invite all budlist in c++

Postby BattleStar-Galactica » Sat Feb 10, 2007 4:38 pm


Code: Select all
HWND hParent =::FindWindow("#32770","Invite to Room");
            HWND hList = ::FindWindowEx(hParent, 0, "SysListView32", NULL);
            bool bCheck=true;
            int count=(int)::SendMessage(hList, LVM_GETITEMCOUNT, 0, 0);
            LV_ITEM     lvi;
            lvi.state=UINT((int(bCheck) + 1) << 12);
            lvi.stateMask=LVIS_STATEIMAGEMASK;
         
            for(int i=0; i<count; i++)
            {
               WPARAM ItemIndex=(WPARAM)i;
               
               ::SendMessage(hList,LVM_SETITEMSTATE,ItemIndex,(LPARAM)&lvi);
               
            }
            HWND button = ::FindWindowEx(hParent, 0, "button", "Invite");
               ::SendMessage((HWND)button,WM_LBUTTONDOWN,1,1);
              ::SendMessage((HWND)button,WM_LBUTTONUP,1,1);


why I posted the code in c++ and not in vb6 becuz I dont want to make life easy to vb6 newbie :lol:
Big math problem
2 - 1 = 0 = without you I'm nothing
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby ThE DJ GaNgStER » Sat Feb 10, 2007 5:44 pm

:) :D Good job :) :D BattleStar-Galactica 8)
ThE DJ GaNgStER
BANNED
BANNED
 
Posts: 380
Joined: Mon Dec 27, 2004 11:34 pm

Re: invite all budlist in c++

Postby NVYE » Wed Sep 24, 2008 3:39 am

VB6 or VB.NET version do as follow:

' Set up our local LV_ITEM to change the selected item
LVITEM.mask = LVIF_STATE
LVITEM.state = LVIS_CHECKED
LVITEM.stateMask = LVIS_STATEIMAGEMASK

The rest you know what to do

where i is totalPals
for i as integer = 0 to totalPals - 1
SendMessage(hwnd, LVM_SETITEMSTATE, i, LVI)
next i

Image

hope this helps.
Add-on Bots for educational and amusement purposes:
http://www.vipbots.com

Website:
http://www.asktechguy.com
User avatar
NVYE
imFiles Senior
imFiles Senior
 
Posts: 230
Joined: Fri Jun 10, 2005 11:29 pm

Re: invite all budlist in c++

Postby method » Sat Apr 11, 2009 3:41 pm

nvye can you tell me how to declare these variables ?

Code: Select all
LVITEM.mask = LVIF_STATE
LVITEM.state = LVIS_CHECKED
LVITEM.stateMask = LVIS_STATEIMAGEMASK
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: invite all budlist in c++

Postby Chike » Sat Apr 11, 2009 4:42 pm

method wrote:nvye can you tell me how to declare these variables ?

Code: Select all
LVITEM.mask = LVIF_STATE
LVITEM.state = LVIS_CHECKED
LVITEM.stateMask = LVIS_STATEIMAGEMASK

You can find everything here: http://source.winehq.org/source/include/commctrl.h
As for LVIS_CHECKED, there is no such thing. Image state is one-based image-index that is application dependent value that is represented by bits 12-15. That is (index shift left 12)
As you can see in BattleStar-Galactica's code it's 2 << 12 = 8192 decimal or 2000 hex.
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: invite all budlist in c++

Postby method » Sun Apr 12, 2009 3:07 pm

chike thanks for reply. But i was asking about vb6 way to declare them ! could you show me how they should be declared in vb6?
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: invite all budlist in c++

Postby Chike » Sun Apr 12, 2009 6:46 pm

Good heavens method, it's all there. Those are hexdecimal integer constants, just replace 0x with &H
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: invite all budlist in c++

Postby Departure » Sun Apr 12, 2009 8:44 pm

Chike wrote:Good heavens method

Lol

Anyway good find Chike very useful...

Oh and for method please read this to help you understand
http://www.vbthunder.com/articles/readcpp.php
User avatar
Departure
Global Moderator
Global Moderator
 
Posts: 996
Joined: Thu Mar 17, 2005 11:26 am
Location: Australia

Re: invite all budlist in c++

Postby method » Thu Apr 23, 2009 5:22 am

Thanks guys i tried the following code but paltalk keep closing when i click the button. Could you you guys tell what i am doing wrong and how to fix it ?



Code: Select all
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long


Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
              '  ByVal hwnd As Long, _
              '  ByVal wMsg As Long, _
               ' ByVal wParam As Long, _
               ' ByVal lParam As Long) As Long
  Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
             
               
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
 Const WM_COMMAND = &H111
 Private Const WM_CLOSE As Long = &H10
 Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
 Private Const VK_SPACE = &H20
 '
Private Const LVIS_STATEIMAGEMASK As Long = &HF000
Private Const LVIS_UNCHECKED = &H1000
Private Const LVIS_CHECKED = &H2000
Private Const LVIF_STATE = &H8
Private Const LVM_FIRST = &H1000
Private Const LVM_SETITEMSTATE = (LVM_FIRST + 43)

Private Type LV_ITEM
  Mask As Long
  iItem As Long
  iSubItem As Long
  state As Long
  stateMask As Long
  pszText As String
  cchTextMax As Long
  iImage As Long
  lParam As Long
  iIndent As Long
End Type



Private Sub Command1_Click()
Dim x As Long, editx As Long
Dim button As Long

 Dim LV As LV_ITEM
 Dim Sel As Boolean
 'Set up our local LV_ITEM to change the selected item
 With LV
.Mask = LVIF_STATE
'.state = LVIS_SELECTED
.state = IIf(Sel, LVIS_CHECKED, LVIS_UNCHECKED)
.stateMask = LVIS_STATEIMAGEMASK
End With

 x = FindWindow("#32770", "Invite to room")
 If x Then
 'MsgBox "found"
 
 'button = FindWindowEx(x, 0&, "button", vbNullString)
'button = FindWindowEx(x, button, "button", vbNullString)
'button = FindWindowEx(x, button, "button", vbNullString)
 
  button = FindWindowEx(x, 0&, "SysListView32", vbNullString)
 SendMessage button, LVM_SETITEMSTATE, 1, LV

 End If
End Sub
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: invite all budlist in c++

Postby Chike » Thu Apr 23, 2009 6:39 am

LV must be copied to paltalk process address space (VirtualAllocEx).
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: invite all budlist in c++

Postby method » Thu Apr 23, 2009 7:05 pm

Chike wrote:LV must be copied to paltalk process address space (VirtualAllocEx).

Can yo show me how ? i don't know exactly what you mean!
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: invite all budlist in c++

Postby Chike » Thu Apr 23, 2009 7:57 pm

There are many examples in the forums using this.
First find pal process id:
Code: Select all
GetWindowThreadProcessId(palWnd, palProcId)

The open a handle for pal process:
Code: Select all
hPalProc = OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ  or PROCESS_VM_WRITE, 0, palProcId)

Allocate memory in pal process adress space:
Code: Select all
palMem = VirtualAllocEx(hPalProc, 0, Len(LV), MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE)

Copy LV structure to pal memory:
Code: Select all
WriteProcessMemory(hPalProc , palMem, LV, Len(LV), 0)

Make your call with palMem instead of LV.

Release pal memory:
Code: Select all
VirtualFreeEx(hPalProc , palMem , 0, MEM_RELEASE)

Close pal process handle
Code: Select all
CloseHandle(hPalProc)


I am not going to declare the functions for you you gotta know how to do this yourself by now, nor the values or type for each varuable/constant.
Use MSDN Library for reference, and the link departure posted, anything else google or search the forums.
If you are going to program you must learn to find things by yourself or you're just waisting time.
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm


Return to C++, C# And Others Programming

Who is online

Users browsing this forum: No registered users and 0 guests