- This topic has 11 replies, 6 voices, and was last updated 15 years ago by ThE DJ GaNgStER.
-
AuthorPosts
-
February 10, 2007 at 9:38 pm #191257BattleStar-GalacticaMember
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 😆
February 10, 2007 at 10:44 pm #191268ThE DJ GaNgStERMember🙂 😀 Good job 🙂 😀 BattleStar-Galactica 8)
September 24, 2008 at 8:39 am #191267AhFoxMemberVB6 or VB.NET version do as follow:
Set up our local LV_ITEM to change the selected item = 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
hope this helps.
April 11, 2009 at 8:41 pm #191266methodMembernvye can you tell me how to declare these variables ?
LVITEM.mask = LVIF_STATE LVITEM.state = LVIS_CHECKED LVITEM.stateMask = LVIS_STATEIMAGEMASK
April 11, 2009 at 9:42 pm #191265ChikeMember@method wrote:
nvye can you tell me how to declare these variables ?
LVITEM.mask = LVIF_STATE LVITEM.state = LVIS_CHECKED LVITEM.stateMask = LVIS_STATEIMAGEMASK
You can find everything here:
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.April 12, 2009 at 8:07 pm #191264methodMemberchike thanks for reply. But i was asking about vb6 way to declare them ! could you show me how they should be declared in vb6?
April 12, 2009 at 11:46 pm #191263ChikeMemberGood heavens method, it’s all there. Those are hexdecimal integer constants, just replace 0x with &H
April 13, 2009 at 1:44 am #191262DepartureMember@Chike wrote:
Good heavens method
Lol
Anyway good find Chike very useful…
Oh and for method please read this to help you understand
April 23, 2009 at 10:22 am #191261methodMemberThanks 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 ?
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
April 23, 2009 at 11:39 am #191260ChikeMemberLV must be copied to paltalk process address space (VirtualAllocEx).
April 24, 2009 at 12:05 am #191259methodMember@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!
April 24, 2009 at 12:57 am #191258ChikeMemberThere are many examples in the forums using this.
First find pal process id:GetWindowThreadProcessId(palWnd, palProcId)
The open a handle for pal process:
hPalProc = OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE, 0, palProcId)
Allocate memory in pal process adress space:
palMem = VirtualAllocEx(hPalProc, 0, Len(LV), MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE)
Copy LV structure to pal memory:
WriteProcessMemory(hPalProc , palMem, LV, Len(LV), 0)
Make your call with palMem instead of LV.
Release pal memory:
VirtualFreeEx(hPalProc , palMem , 0, MEM_RELEASE)
Close pal process handle
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. -
AuthorPosts
Related
- You must be logged in to reply to this topic.