External DLL use Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
KIFO
Posts: 6
Joined: 21 May 2022, 08:14

External DLL use

Post by KIFO » 21 May 2022, 08:21

I want to add the external virtual mouse dll file to ahk and use it. I couldn't run the command functions even if I added it. Does anyone know how to run the dd_move command.

My Code

Code: Select all

PID := DllCall("GetCurrentProcessId")
Process, Priority, , RealTime

DllCall("LoadLibrary","Str","MouseInput.dll")
dd_mov, 100, 100

sample python code of the related virtual mouse device that I found on the internet

Code: Select all

from ctypes import *

dd_dll = windll.LoadLibrary('C:\DD94687.64.dll')

st = dd_dll.DD_btn(0) #DD Initialize
if st==1:
    print("OK")
else:
    print("Error")
    exit(101)

dd_dll.DD_movR(100, 500)

i just need to learn how to code and use dd_mov(x,y) command morally

mouseinput.dll function github page information:
DD_mov(int x, int y)
Function: Absolute mouse movement
parameter:
x , y take the upper left corner of the screen as the origin.
example:
Move the mouse to the middle of the screen with a resolution of 1920*1080,
int x = 1920/2; int y = 1080/2;
DD_mov(x,y) ;

teadrinker
Posts: 4309
Joined: 29 Mar 2015, 09:41
Contact:

Re: External DLL use

Post by teadrinker » 21 May 2022, 12:03

Try this:

Code: Select all

if !hLib := DllCall("LoadLibrary", "Str", "MouseInput.dll", "Ptr")
   throw "Failed to load dll"
if !pFunc := DllCall("GetProcAddress", "Ptr", hLib, "AStr", "DD_mov", "Ptr")
   throw "DD_mov function not found"
DllCall(pFunc, "Int", 100, "Int", 100)

KIFO
Posts: 6
Joined: 21 May 2022, 08:14

Re: External DLL use

Post by KIFO » 21 May 2022, 12:14

teadrinker wrote:
21 May 2022, 12:03
Try this:

Code: Select all

if !hLib := DllCall("LoadLibrary", "Str", "MouseInput.dll", "Ptr")
   throw "Failed to load dll"
if !pFunc := DllCall("GetProcAddress", "Ptr", hLib, "AStr", "DD_mov", "Ptr")
   throw "DD_mov function not found"
DllCall(pFunc, "Int", 100, "Int", 100)

Code: Select all

DllCall(MouseInput/pFunc, "Int", 100, "Int", 100)
not working

note: mouseinput.dll > 64bit file

KIFO
Posts: 6
Joined: 21 May 2022, 08:14

Re: External DLL use

Post by KIFO » 21 May 2022, 12:26

This is my full code, but not working :(

Code: Select all

ListLines, Off
#Persistent
#KeyHistory, 0
#NoEnv
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
#InstallKeybdHook
#UseHook
#SingleInstance, Force
SetKeyDelay, 0, 8
SetControlDelay, -1
SetMouseDelay, -1
SetWinDelay, -1
SendMode, InputThenPlay
SetBatchLines,-1
CoordMode, Pixel, Screen, Fast RGB
PID := DllCall("GetCurrentProcessId")
Process, Priority, , RealTime

ZeroY := 515
ZeroX := 960
CFovX := 200
CFovY := 200

ScanL := ZeroX - CFovX
ScanR := ZeroX + CFovX
ScanT := ZeroY - CFovY
ScanB := ZeroY + CFovY

Loop {

ImageSearch, FoundX, FoundY, ScanL, ScanT, ScanR, ScanB, *TransWhite *19 kilit.gif
	if errorlevel=0
		{
		KYD = 2
		SENS := 0.8
		gosub islemler
		}

} ;Loop kapama

islemler:
{
	
 AimX := FoundX - ZeroX
 AimY := FoundY - ZeroY
  If ( AimX > 1 ) {
   DirX := 0.8
  }
  If ( AimX < 1 ) {
   DirX := -0.8
  }
  If ( AimY > 1 ) {
   DirY := 0.4
  }
  If ( AimY < 1 ) {
   DirY := -0.4
  }
 AimOffsetX := AimX * DirX
 AimOffsetY := AimY * DirY				
 MoveX := Floor(( AimOffsetX * ( 2 / 3 )) * DirX * SENS)
 MoveY := Floor(( AimOffsetY * ( 2 / 3 )) * DirY * SENS)

if !hLib := DllCall("LoadLibrary", "Str", "MouseInput.dll", "Ptr")
   throw "Failed to load dll"
if !pFunc := DllCall("GetProcAddress", "Ptr", hLib, "AStr", "DD_mov", "Ptr")
   throw "DD_mov function not found"
DllCall(pFunc, "Int", MoveX, "Int", MoveY)
}

F1::
Reload
Return

F2::
Pause
return

teadrinker
Posts: 4309
Joined: 29 Mar 2015, 09:41
Contact:

Re: External DLL use

Post by teadrinker » 21 May 2022, 14:00

Try my code as a separate script. Do any messages appear?

KIFO
Posts: 6
Joined: 21 May 2022, 08:14

Re: External DLL use

Post by KIFO » 21 May 2022, 14:19

teadrinker wrote:
21 May 2022, 14:00
Try my code as a separate script. Do any messages appear?
I do, I didn't get any error message. so i just said below code is not working
DllCall(MouseInput/pFunc, "Int", 100, "Int", 100)

teadrinker
Posts: 4309
Joined: 29 Mar 2015, 09:41
Contact:

Re: External DLL use

Post by teadrinker » 21 May 2022, 15:34

It musn't, it's incorrect. I still don't understand, if my code works as it is.

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: External DLL use

Post by Helgef » 22 May 2022, 02:06

@teadrinker, perhaps you need to initialise, compare, st = dd_dll.DD_btn(0) #DD Initialize.

@KIFO, without any documentation for the dll you are using, we can only guess.

Cheers.
Edit,
Thanks @Helgef!
Cheers @teadrinker :tea: :wave:
Last edited by Helgef on 23 May 2022, 03:26, edited 1 time in total.

KIFO
Posts: 6
Joined: 21 May 2022, 08:14

Re: External DLL use

Post by KIFO » 22 May 2022, 05:34

Helgef wrote:
22 May 2022, 02:06
@teadrinker, perhaps you need to initialise, compare, st = dd_dll.DD_btn(0) #DD Initialize.

@KIFO, without any documentation for the dll you are using, we can only guess.

Cheers.
The dll source page I used:
https://github.com/ddxoft/master

It also works with python, I tested it on the pc.

teadrinker
Posts: 4309
Joined: 29 Mar 2015, 09:41
Contact:

Re: External DLL use  Topic is solved

Post by teadrinker » 22 May 2022, 05:59

Maybe like this:

Code: Select all

if !hLib := DllCall("LoadLibrary", "Str", "MouseInput.dll", "Ptr")
   throw "Failed to load dll"
if !DllCall("MouseInput\DD_btn", "Int", 0)
   throw "Failed to initialise button"
DllCall("MouseInput\DD_mov", "Int", 100, "Int", 100)

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: External DLL use

Post by malcev » 22 May 2022, 08:35

I do not see mouseinput.dll in source files, but like this it works, like it should:

Code: Select all

DllCall("LoadLibrary", "Str", "DD94687.64.dll", "Ptr")
DllCall("DD94687.64.dll\DD_btn", "Int", 0)
DllCall("DD94687.64.dll\DD_mov", "Int", 100, "Int", 100)

KIFO
Posts: 6
Joined: 21 May 2022, 08:14

Re: External DLL use

Post by KIFO » 22 May 2022, 13:43

teadrinker wrote:
22 May 2022, 05:59
Maybe like this:

Code: Select all

if !hLib := DllCall("LoadLibrary", "Str", "MouseInput.dll", "Ptr")
   throw "Failed to load dll"
if !DllCall("MouseInput\DD_btn", "Int", 0)
   throw "Failed to initialise button"
DllCall("MouseInput\DD_mov", "Int", 100, "Int", 100)
it worked perfectly. thank you so much. you're welcome. You have been very helpful. Greetings from Turkey. :dance:

teadrinker
Posts: 4309
Joined: 29 Mar 2015, 09:41
Contact:

Re: External DLL use

Post by teadrinker » 22 May 2022, 13:51

:wave:
Thanks @Helgef!

Post Reply

Return to “Ask for Help (v1)”