AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DLLCall: Support for Human Interface devices
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Blahman



Joined: 09 Nov 2008
Posts: 18

PostPosted: Sat Jan 10, 2009 5:49 am    Post subject: Reply with quote

So has anyone found a reliable way to actually override the default actions of buttons/keypresses, not just detect them and perform a different action in addition to the original action?

I'm trying to get my Harmony Remote to send commands directly to Windows Media Center without stealing focus from the active window which more often than not for me is a full-screen game.

My problem is two part, the first relates to this thread and the aforementioned default actions still occuring.

The second part is that Windows Vista Media Center is a DirectX application and as such ControlSend doesn't work. Meaning I probably would have to use PostMessages, but Window Spy/Winspector Spy also don't work with DirectX apps, and I have not found a list of messages for Vista Media Center.

If anyone can help with either please do!
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 34
Location: Germany

PostPosted: Sat Jan 10, 2009 8:05 pm    Post subject: Reply with quote

rockum wrote:
elmulti wrote:

It deactivates the normal scrolling function and then makes one wheel scroll vertical and the other horizontal.
If your device number is not 4, you need to adjust the script.

@Ucla: It should be no problem to change this to what you need. Just change the content of "MouseWheelActions".

Let me know if this works you you.
Happy New Year,
elmulti


Does that mean you've found a way to deactivate normal function of keys too?

Thanks

Kind of, but not really. I used the following lines to deactivate the WheelUp and WheelDown functions:
Code:
; deactivate normal wheel-action
$WheelUp::
$WheelDown::
   ; do nothing
Return
Then I used Micha's DLL to detect these functions anyways and to detect which wheel was used. I then programmed one wheel to scroll horizontally and the other to scroll vertically.

One could use this scheme for keyboard-keys as well, but it probably only works for single keys like letters, not for modifier keys like Shift or Control. If you need to reprogram a whole keyboard, this is not a good approach. It might work, but it would need a lot of work.

John Burgos wrote:
Hey, looks you have done a nice jod.... maybe you can help me out, im new with AutoHotkey, but what I want to do is to be able to remap my external USB HID Keyboard keys (but only remapping the external HID, without affecting the keys of the HID keyboard included in my laptop).

I have read the basics and followed some tutorials, but so far I can only remap keys but afecting both keyboards... Is there a way to only chose one keyboard to remap???

Hope you can help me out, since I tryied to understand your code, but it is too advanced for me...

Thanks in advance

John
As you can see in my recent posts here, it is possible to add special functionality to specific keys of an HID. It is tricky to stop this key from performing its default function, though.
What exactly do you have in mind? Which keys should be remapped and do you need to deactivate the default functionality?

You should start in following the link in the first post. Please read the whole page that Micha wrote, download the archive and try his "AutoHotkeyRemoteControlDLL.ahk" script.
Please play around with the script and try adjusting the "RemoteControl.ahk" script. Then if you get stuck, let me know the details and I'll try to help you out.
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 34
Location: Germany

PostPosted: Sat Jan 10, 2009 8:16 pm    Post subject: Reply with quote

Blahman wrote:
So has anyone found a reliable way to actually override the default actions of buttons/keypresses, not just detect them and perform a different action in addition to the original action?

I'm trying to get my Harmony Remote to send commands directly to Windows Media Center without stealing focus from the active window which more often than not for me is a full-screen game.

My problem is two part, the first relates to this thread and the aforementioned default actions still occuring.

The second part is that Windows Vista Media Center is a DirectX application and as such ControlSend doesn't work. Meaning I probably would have to use PostMessages, but Window Spy/Winspector Spy also don't work with DirectX apps, and I have not found a list of messages for Vista Media Center.

If anyone can help with either please do!
Sorry for the double post, but I overlooked one post...

@Blahman:
I'm still looking for a better way to overwrite a key function, but You see my current approach in the above post. Unfortunately this only works for standard keys, e.g. it doesn't work for the DVD button on my remote control.
You might be able to solve the focus problem by renaming the file "ehtray.exe" in "C:\Windows\ehome\". This is the background program from Media Center which captures media keys if Media Center is not active.
I don't know any Messages to send to WMC though.
Back to top
View user's profile Send private message
Blahman



Joined: 09 Nov 2008
Posts: 18

PostPosted: Sat Jan 10, 2009 11:32 pm    Post subject: Reply with quote

Thanks for the tip, that might be very useful if I can get the other bit (sending messages) working.
Back to top
View user's profile Send private message
Cholito



Joined: 25 Sep 2006
Posts: 6
Location: Peru

PostPosted: Wed Jan 21, 2009 2:19 am    Post subject: Help with two wheel mouse Reply with quote

Hallo elmulti, vielen Danke für deine Hilfe!
I want to show my particular recognition to your answer on page 8. Your script is very nice, although has some difficulties I hope they will be surmonted.
1. A window appears occasionally that disables only the scrolling of wheels, not the other functions of mouse, with the following message:
GetWM_INPUTHIDData failed. Errorcode: 0

Clicking on button "Okey", the window disappears and the script continues well. This occasional window is permanently disabled removing the next lines of code:
Code:
; if (errorlevel <> 0) || (nRC == 0xFFFFFFFF)
; {
;    MsgBox GetWM_INPUTHIDData failed. Errorcode: %errorlevel%
;    goto cleanup
; }
And the script runs fine.

2. The initial deactivation of wheels is apparently right. Eliminating the following code, or adding ~ at first of each line:
Code:
$WheelUp::
$WheelDown::
   ; do nothing
Return
causes the new mouse front wheel assignments not to function. V.g. in Explorer and Notepad the wheel scrolls upwards-left or downwards-right simultaneously, and in Office 2007 (Word, Excel, PowerPoint) and Mozilla Firefox scrolls only vertically, not horizontally. The rear wheel (vertical scroll) works fine.

3. Conserving this previous code, both wheels work well in most of my applications, but the front wheel (horizontal scroll) doesn't run (it's motionless) in Office 2007 applications and Firefox (ok in Microsoft Internet Explorer). I've tried it works introducing the directive #IfWinActive and ahk_classes into Word (ahk_class OpusApp), Excel (ahk_class XLMAIN), PowerPoint (ahk_class PP12FrameClass), and Firefox (ahk_class MozillaUIWindowClass), in vain.
Can you or somebody please help me with this?

4. Both wheels works fine, according to Ucla's request on page 8:
FOREMOST WHEEL upward send, {w}
FOREMOST WHEEL downward send, {s}
REARWHEEL upward send, {e}
REARWHEEL downward send, {d}

But if Caps Lock or Shift keys are pressed the result is always lowercase letters.

5. All the previous one is for Windows-32 bit. Micha's AutohotkeyRemoteControl.dll and AutoHotkeyRemoteControlDLL.ahk (and elmulti's script) do not work on Windows Vista x64 bit. In Micha's script, after I hit "Register" button, and then press any key or mouse click, Windows closes inopportunely AutoHotkeyRemoteControlDLL.ahk. The Windows message is:
"AutoHotkey has stopped working
Windows can check online for a solution the problem"
Then gives these two options:
"Check online for a solution and close the program.
Close the program"
Details:
"Problem signature:
Problem Event Name: APPCRASH
Application Name: Autohotkey.exe
..."

elmulti's script is also immediately closed after some movement of mouse, then appears that message. But Windows doesn't close my script Autohotkey.ini (with other hotkeys), and Autohotkey.exe continues running ok. But if I introduce the code from elmulti's script in my script, it crashes. Micha's DLL and scripts are only for Windows-32 bit.
When we will have a version of 64 bits of that fabulous dll?

With best of best regards.
Sorry my English.
_________________
¿Cuándo traducimos AHK al español?
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 34
Location: Germany

PostPosted: Wed Jan 21, 2009 5:27 pm    Post subject: Reply with quote

Right now I can't do anything to make Micha's DLL work on a 64bit system, but if Micha could share the source code, one could play around with it!?
I read somewhere in the forum, that Micha's DLL could completely be replaced by lots of AHK-code, but I didn't fund the code and unfortunately I can't write it myself.

@Cholito:
My script from page 8 uses the horizontal scrolling command via SendMessage. For programs that don't support it, workarounds must be found. In this thread, there is some useful code that more or less works for Word and some other programs. If you can't get it to work, let me know.
Back to top
View user's profile Send private message
msanders
Guest





PostPosted: Mon Jan 26, 2009 6:39 pm    Post subject: script writer Reply with quote

When I loaded AHK on my laptop, I wrote a script and it worked great. I started another one and needed the script writer for it and a box popped up that said "dll load failed". any ideas?
Back to top
elmulti



Joined: 14 Jan 2008
Posts: 34
Location: Germany

PostPosted: Mon Jan 26, 2009 7:54 pm    Post subject: Re: script writer Reply with quote

msanders wrote:
When I loaded AHK on my laptop, I wrote a script and it worked great. I started another one and needed the script writer for it and a box popped up that said "dll load failed". any ideas?

Hello msanders!
I think you are asking this question at the wrong place, unless you downloaded Micha's "AutoHotkeyRemoteControlDLL" and tried to make it work.
Please make a thread in the Ask for Help section and include your script or at least a few more infos.
Good luck!
Back to top
View user's profile Send private message
francesco
Guest





PostPosted: Sat Feb 07, 2009 1:02 am    Post subject: Reply with quote

hi, is there any way to make this work in vista?or another similar dll that work in vista? i'm actually trying to use it in seven...
Back to top
Unicorn_Systems



Joined: 01 Apr 2009
Posts: 1
Location: Northern Ireland

PostPosted: Wed Apr 01, 2009 10:44 am    Post subject: Reply with quote

Hey everyone, I am still getting the error code -3 with the latest version of this software... I was trying to follow the guide here to assign the Fn key on my new apple bluetooth wireless keyboard, but when trying to detect the HID's I get the error:

"GetDeviceCount fehlgeschlagen. Errorcode: -3"

Its a brand new install of Windows XP (had a crash a few days ago) with no updates installed... I suspect that the lack of updates/ hotfixes is the cause of the error but would like someone to confirm this for me... FYI I am not installing Windows updates at present because SP3 was what actually caused my OS crash in the first place, it has some major issues at the moment and caused a major conflict with a new driver that I installed earlier in the week.

Any help would be greatly appreciated here, I am eager to get my new keyboard working properly in windows! Thanks in anticipation,

Matt.
_________________
Matt Nesbitt
Unicorn Systems
Bespoke Perfoemance PC's
Back to top
View user's profile Send private message
Micha



Joined: 15 Nov 2005
Posts: 500
Location: Germany

PostPosted: Thu Apr 02, 2009 12:27 am    Post subject: Reply with quote

Unicorn_Systems wrote:
Hey everyone, I am still getting the error code -3 with the latest version of this software...

Hi are you sure have you installed the vc-redist?
Ciao
Micha
Back to top
View user's profile Send private message
bxr



Joined: 08 Mar 2009
Posts: 9

PostPosted: Sat Apr 18, 2009 8:29 pm    Post subject: Reply with quote

Any solution for continuous button pressing?
i.e. when I press a button and don't leave it I want it to send multiple messages.
Back to top
View user's profile Send private message
micha as guest
Guest





PostPosted: Sat Apr 18, 2009 10:53 pm    Post subject: Reply with quote

bxr wrote:
Any solution for continuous button pressing?
i.e. when I press a button and don't leave it I want it to send multiple messages.

If you do not release the button, there's no release event.
You can i.e use SetTimer.
Start a timer if pressed and while no release event triggers, do what you want multiple times#
ciao
micha
Back to top
glitch00



Joined: 14 May 2009
Posts: 1

PostPosted: Thu May 14, 2009 9:54 am    Post subject: Reply with quote

micha as guest wrote:
bxr wrote:
Any solution for continuous button pressing?
i.e. when I press a button and don't leave it I want it to send multiple messages.

If you do not release the button, there's no release event.
You can i.e use SetTimer.
Start a timer if pressed and while no release event triggers, do what you want multiple times#
ciao
micha

This is exactly what I want to do.

How can I do this with SetTimer. I'm completely new to this. Thanks! Smile
Back to top
View user's profile Send private message
Micha



Joined: 15 Nov 2005
Posts: 500
Location: Germany

PostPosted: Thu May 14, 2009 4:57 pm    Post subject: Reply with quote

Hi glitch00,
for example:
Code:

^a::
SetTimer, DoAction ,300, Priority
return

^b::
SetTimer, DoAction, Off
tooltip,
return

DoAction:
tooltip, Action active %A_TickCount%
return


If you press the key start the timer (^a::....). After you have started the timer the label DoAction is called periodically. Do there what you want the script to do. I.E. Send, {home}

If you release the button, the up-event is triggered. Stop the Timer
(^b:: ....)

Ciao
Micha
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 9 of 10

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group