MicroTimer - Sub-10ms timers for AHK (C# DLL)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: MicroTimer - Sub-10ms timers for AHK (C# DLL)

23 Jun 2017, 04:32

MicroTimer does not replace Sleep, it replaces SetTimer.
DllCall("MicroTimer.dll\Sleep", "UInt",t) is not the way to call MicroTimer, I was replying to a previous poster to say that it could not do this.

When you say the demo code did not do anything, did you just copy and run the code from the first post?
That will not work as you are missing the DLL - you need to click the download link.
Jazah
Posts: 3
Joined: 05 Dec 2017, 04:48

Re: MicroTimer - Sub-10ms timers for AHK (C# DLL)

05 Dec 2017, 05:09

Hi, I'm hoping you might still read this forum thread.
I'm really insterested in getting your Timer working, either MicroTimer, or WaitableTimer.

The problem I'm having is when I call

Code: Select all

asm := CLR_LoadLibrary("MicroTimer.dll")
The object is just blank.

I've used the debugger to run through whats happening, and it appears that inside CLR.ahk

Code: Select all

Loop 1 {
		if assembly := AppDomain.Load_2(AssemblyName)
			break
		static nulln := ComObject(13,0)
		args := ComObjArray(0xC, 1),  args[0] := AssemblyName
		typeofAssembly := AppDomain.GetType().Assembly.GetType()
		if assembly := typeofAssembly.InvokeMember_3("LoadWithPartialName", 0x158, nulln, nulln, args)
			break
		if assembly := typeofAssembly.InvokeMember_3("LoadFrom", 0x158, nulln, nulln, args)
			break
	}
assembly is always nothing. (typeofAssembly & args are both objects with properties)

This happens with both MicroTimer.dll and WaitableTimer.dll
I've tried all the versions of your DLL that I can find, but still no luck.
___

When I try the same thing from some of your other posts, such as

Code: Select all

asm := CLR_LoadLibrary("MouseDelta.dll")
it does work. "asm" becomes a proper object, and the rest of the code can run without a problem.
If it's of any relevence, for MouseDelta.dll, the assembly object is filled out on this line (inside CLR.ahk)

Code: Select all

assembly := typeofAssembly.InvokeMember_3("LoadFrom", 0x158, nulln, nulln, args)
Any help is greatly appreciated :)

My system is Windows 10 64-bit, with the latest .net framework installed
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: MicroTimer - Sub-10ms timers for AHK (C# DLL)

05 Dec 2017, 11:24

I know we had a problem in the past where the DLLs that I posted were bad and refused to load on some people's machines - this may be what is happening here.
I take it you tried the version from the releases page of the github repo?
Jazah
Posts: 3
Joined: 05 Dec 2017, 04:48

Re: MicroTimer - Sub-10ms timers for AHK (C# DLL)

05 Dec 2017, 20:07

I tried the links from this post, and both 1.0 and 1.1 from your github.
Still the same issue, very strange.

I might try instaling Visual Studio and compiling the DLL from your source, and see if that makes any difference.

Thanks for the fast reply!
I just noticed you're also the one responsible for me being able to use F13-F24 on my logitech mouse, and the reason I found SciTE4AutoHotKey.
You're a legend!
Jazah
Posts: 3
Joined: 05 Dec 2017, 04:48

Re: MicroTimer - Sub-10ms timers for AHK (C# DLL)

06 Dec 2017, 06:02

Tried with Unicode x86, x64, and ANSI x86

Edit:

Just downloaded the free visual studio, and compiled your source code from github. The DLL is working now :thumbup:
It was built using the default settings,
Platform target = Any CPU
Target Framework = .Net Framework 4.5.2

The DLL was 1kb bigger for some reason, this whole thing is a mystery to me, but it's working!

Thanks for all your work, and your help!

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 106 guests