Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 18:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Source code to send clicks (Minimized)

Discussion on Source code to send clicks (Minimized) within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2008
Posts: 7
Received Thanks: 1
Source code to send clicks (Minimized)

Well let an example of some functions in VB6 to send clicks and pfs to the screen.
They work with the client miniminized or in background.

It is a way that I have not seen used in the examples in the forum but I think it is the most effective.

Unfortunately not comment on the code but the idea is this:

Send messages BUTTONDOWN / BUTTONUP directly to the window handle control that contains the display or which contains buttons pf. not to the window pricipal Co

GetHandleControl search recursively controlid in the windows daughters hwnd parameter and returns the handle of it.

You can find the controlid with WinSpy or similar and/or traveling checks at the function GetHandleControl modified to get extra info on the controls.

This work for spanish client. I suppose the identifiers of objects will be the same in different clients languages....

sry for my bad (or null) English

Code:
'w. api
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public 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
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Const GW_CHILD = 5
Public Const GW_HWNDNEXT = 2
Public Const WM_LBUTTONDOWN As Long = &H201
Public Const WM_LBUTTONUP As Long = &H202
Public Const WM_LBUTTONDBLCLK As Long = &H203
Public Const WM_RBUTTONDOWN As Long = &H204
Public Const WM_RBUTTONUP As Long = &H205
Public Const WM_RBUTTONDBLCLK As Long = &H206
 
'Publics variables
Public d_hWndScreen As Long
Public d_hWndPFs As Long
 
'put in load event or initzialize funcion
'hwnd is co window
d_hWndPFs = GetHandleControl(hwnd, &H3FD)
d_hWndScreen = GetHandleParentControl(hwnd, &H3E8)
 
'Funcions to use
Public Sub SendClick(nX As Integer, nY As Integer, Optional nBoton As Integer = vbLeftButton)
Dim lTarget As Long 
If nX < 0 Or nX > 1024 Or nY < 0 Or nY > 768 Then Exit Sub
lTarget = MakeDWord(nX, nY) 
Select Case nBoton
Case vbLeftButton:
SendMessage d_hWndScreen, WM_LBUTTONDOWN, 1&, ByVal lTarget
SendMessage d_hWndScreen, WM_LBUTTONUP, 1&, ByVal lTarget
Case vbRightButton:
SendMessage d_hWndScreen, WM_RBUTTONDOWN, 1&, ByVal lTarget
SendMessage d_hWndScreen, WM_RBUTTONUP, 1&, ByVal lTarget
End Select
End Sub
 
Public Sub SendPF(Optional sPF As String = "PF1")
Dim lTarget As Long
Dim nPF As Integer 
If Len(sPF) < 3 Then Exit Sub
nPF = CInt(Right(sPF, Len(sPF) - 2))
If nPF = 0 Then Exit Sub 
lTarget = MakeDWord(20 + ((nPF - 1) * 40), 20)
SendMessage d_hWndPFs, WM_RBUTTONDOWN, 1&, ByVal lTarget
SendMessage d_hWndPFs, WM_RBUTTONUP, 1&, ByVal lTarget
End Sub
 
'Functions to internal work 
Private Function MakeDWord(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long
MakeDWord = (HiWord * &H10000) Or (LoWord And &HFFFF&)
End Function
 
Private Function GetHandleParentControl(hwnd As Long, lControlID As Long) As Long 
GetHandleParentControl = GetParent(GetHandleControl(hwnd, lControlID))
End Function
 
Private Function GetHandleControl(hwnd As Long, lControlID As Long) As Long
Dim lID As Long
Dim hWndChild As Long
lID = GetWindowLong(hwnd, GWL_ID)
If lID = lControlID Then
GetHandleControl = hwnd
Else
hWndChild = GetWindow(hwnd, GW_CHILD)
Do While hWndChild <> 0 And GetHandleControl = 0
lID = GetWindowLong(hWndChild, GWL_ID)
If lID = lControlID Then
GetHandleControl = hWndChild
Else
If GetWindow(hWndChild, GW_CHILD) <> 0 Then
GetHandleControl = GetHandleControl(hWndChild, lControlID)
End If
End If
hWndChild = GetWindow(hWndChild, GW_HWNDNEXT)
Loop
End If
End Function
clipper is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Send Keys to minimized PW-Window
07/21/2010 - Perfect World - 3 Replies
I want to learn how to send keys to a PW-Window, but it is minimized (because of the other functions my prog has).. i am programming in vb.net (i know.. not the best language but i am getting along with it quite good) so if anyone knows a simple function or can help me with this.. pls tell me :) greetz
Send key to minimized is there alternate to controlsend.
07/08/2010 - AutoIt - 6 Replies
Well I'm trying to convert alot of my programs so you can use when the programs minimized found mouseclickplus works well with things you can click on but I'm still lookin for an alternate way for controlsend.
[Request] How send clicks on minimized
10/11/2008 - CO2 Programming - 2 Replies
How send clicks on minimized in Visual C# ?
How do I: Click or Send Keys to a minimized window
04/08/2006 - General Coding - 6 Replies
I am making a bot for ConquerOnline, and I need to know how to send clicks or keys to a minimized window, like COPartner does. Thanks for any help.



All times are GMT +1. The time now is 18:28.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.