Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AHK, WinAPI & DllCall's


  • Please log in to reply
14 replies to this topic
jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
AutoHotkey, WinAPI & DllCall's
!!! Support will be discontinued here !!!

You can find the latest version here [>>> AutoHotkey, WinAPI & DllCall's <<<]
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Add Keyboard Input Functions \ BlockInput
Add Keyboard Input Functions \ GetKBCodePage
Add Keyboard Input Functions \ GetKeyboardLayout
Add Mouse Input Functions \ GetCapture
Add Mouse Input Functions \ GetDoubleClickTime
Add Mouse Input Functions \ ReleaseCapture
Add Mouse Input Functions \ SetDoubleClickTime
Add Mouse Input Functions \ SwapMouseButton
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

chaidy
  • Members
  • 57 posts
  • Last active: Oct 21 2015 05:53 PM
  • Joined: 20 Apr 2010
great

chaidy
  • Members
  • 57 posts
  • Last active: Oct 21 2015 05:53 PM
  • Joined: 20 Apr 2010
great

fump2000
  • Members
  • 591 posts
  • Last active: Nov 11 2015 07:52 AM
  • Joined: 01 Nov 2012

How can I use BlockInput in Windows 7?

I used the function but the mouse pointer can be moved further.


RHCP
  • Members
  • 1228 posts
  • Last active: Jan 15 2017 04:37 AM
  • Joined: 29 May 2006

You need to run the script with admin privileges. Also, you might want to use AHK's blockInput command, as it has more options.

 

Cheers.



fump2000
  • Members
  • 591 posts
  • Last active: Nov 11 2015 07:52 AM
  • Joined: 01 Nov 2012
Is there another possibility to block mouse input without admin privileges?


RHCP
  • Members
  • 1228 posts
  • Last active: Jan 15 2017 04:37 AM
  • Joined: 29 May 2006

 

Is there another possibility to block mouse input without admin privileges?

 

SetBatchLines, -1

#SingleInstance force

OnExit, RemoveHooks
mouseHook := SetWindowsHookEx(14, RegisterCallback("MouseHook"))
return 

RemoveHooks:
UnhookWindowsHookEx(mouseHook)
ExitApp
return 


f1::
global mouseBlock := True
sleep 3000
mouseBlock := False 
return






	; mouse has different WM_Messages for each down/up event on each button
	; check the wm_  messages in ahk manual or google to find the one you need if you only want
	; to block a particular button 
	; eg wParam = WM_MOUSEMOVE := 0x200 for mouse movement
MouseHook(nCode, wParam, lParam)
{ 
	Critical 1000

	If !nCode
	{
		; Input is blocked and this is a user pressed / released button	
		if (mouseBlock && !(NumGet(lParam+12) & 0x10))  ; LLKHF_INJECTED key not sent via sendinput
			return -1 ; this causes other hooks in the chain to ignore the input
	}
   	Return CallNextHookEx(nCode, wParam, lParam) ; make sure other hooks in the chain receive this event if we didn't process it
}

SetWindowsHookEx(idHook, pfn)
{
   Return DllCall("SetWindowsHookEx", "int", idHook, "Uint", pfn, "Uint", DllCall("GetModuleHandle", "Uint", 0), "Uint", 0)
}

UnhookWindowsHookEx(hHook)
{
   Return DllCall("UnhookWindowsHookEx", "Uint", hHook)
}

CallNextHookEx(nCode, wParam, lParam, hHook = 0)
{
   Return DllCall("CallNextHookEx", "Uint", hHook, "int", nCode, "Uint", wParam, "Uint", lParam)
}

Obviously you can also have the hook always block stuff without the 'mouseBlock' variable and just install/remove the hook when you want to block stuff.



jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Add Multimedia Functions \ timeGetTime
Fix Time Functions \ GetTickCount
Fix Time Functions \ GetTickCount64
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Add National Language Support Functions \ GetDurationFormat
Add System Information Functions \ GetComputerName
Add System Information Functions \ GetProductInfo
Add System Information Functions \ GetSystemDirectory
Add System Information Functions \ GetSystemRegistryQuota
Add System Information Functions \ GetSystemWindowsDirectory
Add System Information Functions \ GetSystemWow64Directory
Add System Information Functions \ GetUserName
Add System Information Functions \ GetWindowsDirectory
Fix Array-Begin from 0 to 1
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Add String Functions \ CharLower
Add String Functions \ CharLowerBuff
Add String Functions \ CharUpper
Add String Functions \ CharUpperBuff
Fix return (delete , and %)
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

hilogogifts
  • Members
  • 1 posts
  • Last active:
  • Joined: 06 Mar 2014

 

Is there another possibility to block mouse input without admin privileges?

 

how can i use it ?



jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Add File Management Functions \ GetFileAttributes
Add File Management Functions \ GetFileSize
Add File Management Functions \ GetFileSizeEx
Add File Management Functions \ GetTempPath
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Add Error Handling Functions \ FormatMessage
Add Error Handling Functions \ GetLastError
Add PSAPI Functions \ GetModuleFileNameEx
Fix c++ codes
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you

jNizM
  • Members
  • 928 posts
  • Last active: Dec 30 2016 12:39 PM
  • Joined: 01 Aug 2012
update:
Change License
Fix Bugs
Add Error handling
Add Directory Management Functions \ CreateDirectory
Add Directory Management Functions \ RemoveDirectory
Add Directory Management Functions \ SetCurrentDirectory
Add Mouse Input Functions \ ClipCursor
Add System Information Functions \ GetUserNameEx


Please report any bugs or mistakes.
New update with bugfixes, error handlings and new Functions coming soon
[AHK] 1.1.24.03 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.447) x64
My GitHub Profile | Donations are appreciated if I could help you