Jump to content
Sign in to follow this  
yinui

I'd like to know how to hook the touch click?

Recommended Posts

yinui

I'd like to know how to hook the touch click?
I tried to hook it by mouse, but failed.
I cannot found any information from _WinAPI_SetWindowsHookEx, but I'm sure that the touch click is different from the mouse click.

Share this post


Link to post
Share on other sites
guinness

Search mouse hook.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

I know you're new, but apply some commonsense please. What did you try? What hooking UDF did you use? I can name 3 or 4 that work on the Forum.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
yinui

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#RequireAdmin
Global $hForeground
Global $Chickstate = 1, $key = "", $su = 0, $key_s = ""
$hGUI = GUICreate("Test", 400, 300, -1, -1, Default, $WS_EX_TOPMOST)
GUICtrlCreateButton("Send ""a""", 40, 40, 150, 80)
GUICtrlSetCursor(-1, 0)
$hButton1 = GUICtrlGetHandle(-1)

GUICtrlCreateButton("Send ""3""", 200, 40, 150, 80)
GUICtrlSetCursor(-1, 0)
$hButton3 = GUICtrlGetHandle(-1)


GUICtrlCreateButton("Exit", 40, 160, 150, 80)
GUICtrlSetCursor(-1, 0)
$hButton2 = GUICtrlGetHandle(-1)

$iThreadId = _WinAPI_GetCurrentThreadId()
$hInstance = _WinAPI_GetModuleHandle(0)

$hCBTProc = DllCallbackRegister("_CBTCallBack", "int", "uint;wparam;lparam")
$pCBTProc = DllCallbackGetPtr($hCBTProc)
$hCBTHook = _WinAPI_SetWindowsHookEx(5, $pCBTProc, $hInstance, $iThreadId)

$hMouseProc = DllCallbackRegister("_MouseProc", "int", "uint;wparam;lparam")
$pMouseProc = DllCallbackGetPtr($hMouseProc)
$hMouseHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pMouseProc, $hInstance, 0)

$hEventProc = DllCallbackRegister("_EventProc", "none", "ptr;dword;hWnd;long;long;dword;dword")
$pEventProc = DllCallbackGetPtr($hEventProc)
$hEventHook = _SetWinEventHook($pEventProc, 1)

GUISetState()
While GUIGetMsg() + 3
    If $Chickstate = 0 And $key <> "" Then $su = $su + 1
    If $key = "" Then $su = 0
    If $Chickstate = 0 And $key <> "" And $key <> "exit" And $su = 1 OR $su > 20 Then Send($key)
    If $key = "exit" Then ExitLoop
    Sleep(2)
WEnd
GUIDelete($hGUI)
_WinAPI_UnhookWindowsHookEx($hCBTHook)
_WinAPI_UnhookWindowsHookEx($hMouseHook)
_UnhookWinEvent($hEventHook)

DllCallbackFree($hCBTProc)
DllCallbackFree($hMouseProc)
DllCallbackFree($hEventProc)
Exit

Func _CBTCallBack($iCode, $iwParam, $ilParam)
    Switch $iCode
        Case 5
            If HWnd($iwParam) = $hGUI Then Return 1
    EndSwitch

    Return _WinAPI_CallNextHookEx($hCBTHook, $iCode, $iwParam, $ilParam)
EndFunc   ;==>_CBTCallBack

Func _EventProc($hEventHook, $iEvent, $hWnd, $iObject, $iChild, $iEventThread, $iEventTime)
    If ($iEvent = 0x8005) Then $hForeground = $hWnd
EndFunc   ;==>_EventProc

Func _MouseProc($iCode, $iwParam, $ilParam)
    If ($iCode < 0) Then
        Return _WinAPI_CallNextHookEx($hMouseHook, $iCode, $iwParam, $ilParam)
    EndIf

    Switch $iwParam
        Case $WM_LBUTTONDOWN, $WM_LBUTTONUP, $WM_RBUTTONDOWN, $WM_RBUTTONUP, $WM_MBUTTONDOWN, $WM_MBUTTONUP
            Local $tBuffer, $hWindow
            If ($iwParam = $WM_LBUTTONUP) Then
                $Chickstate = 1
                $key = ""
            ElseIf ($iwParam = $WM_LBUTTONDOWN) Then
                $Chickstate = 0
            EndIf
            $tBuffer = DllStructCreate("int X;int Y", $ilParam)
            $hWindow = _WinAPI_WindowFromPoint($tBuffer)
            $tBuffer = 0
            Switch $hWindow
                Case $hGUI
                    Return 1
                Case $hButton1
                    If ($iwParam = $WM_LBUTTONDOWN) Then $key = "a"
                    Return 1
                Case $hButton2
                    If ($iwParam = $WM_LBUTTONUP) Then $key = "exit"
                    Return 1
                Case $hButton3
                    If ($iwParam = $WM_LBUTTONDOWN) Then $key = "3"
                    Return 1
                Case $GUI_EVENT_CLOSE
                    If ($iwParam = $WM_LBUTTONUP) Then $key = "exit"
                    Return 1
            EndSwitch
    EndSwitch
    Return _WinAPI_CallNextHookEx($hMouseHook, $iCode, $iwParam, $ilParam)
EndFunc   ;==>_MouseProc

Func _SetWinEventHook($pCallBack, $iFlags, $iEventMin = 1, $iEventMax = 0x7FFFFFFF, $iProcessId = 0, $iThreadId = 0)
    Local $iResult
    $iResult = DllCall("User32.dll", "ptr", "SetWinEventHook", "uint", $iEventMin, _
            "uint", $iEventMax, "ptr", 0, "ptr", $pCallBack, "dword", $iProcessId, _
            "dword", $iThreadId, "uint", $iFlags)
    Return $iResult[0]
EndFunc   ;==>_SetWinEventHook

Func _UnhookWinEvent($hEventHook)
    Local $iResult
    $iResult = DllCall("User32.dll", "int", "UnhookWinEvent", "ptr", $hEventHook)
    Return $iResult[0]
EndFunc   ;==>_UnhookWinEvent

I want to make a screen keyboard, mouse test normal, but there is a problem in touch click.

Edited by yinui

Share this post


Link to post
Share on other sites
yinui

http://msdn.microsoft.com/en-us/library/windows/desktop/dd317334%28v=vs.85%29.aspx

Note that a solitary touch point or, in a set of simultaneous touch points, the first to be detected, is designated the primary. The system mouse position follows the primary touch point and, in addition to touch messages, also generates WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP messages in response to actions on a primary touch point. The primary touch point can also generate WM_RBUTTONDOWN and WM_RBUTTONUP messages using the press and hold gesture.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×