It is currently December 14th, 2018, 8:24 pm

HotKey plugin 1.0

Share your custom plugins and applications to enhance Rainmeter.
User avatar
Brian
Developer
Posts: 1797
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: HotKey plugin 0.0.1.8 (in beta)

Brian » August 7th, 2014, 7:03 pm

New version here: http://rainmeter.net/forum/viewtopic.php?p=102030#p102030

*Hopefully* this version will help with any antivirus issues. :oops:

-Brian
User avatar
fonpaolo
Moderator
Posts: 1351
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: HotKey plugin 0.0.1.8 (in beta)

fonpaolo » August 28th, 2014, 10:12 am

I don't know if it's already possible (and maybe useful for someone else besides me...), there's a way to simply detect the use of any key?
I hope not to insert all the keyboard keys as separate hotkeys... O.O
All I need is to know if any key is used (letters, numbers, shift and so on) to execute an action.

Thanks.
User avatar
Brian
Developer
Posts: 1797
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: HotKey plugin 0.0.1.8 (in beta)

Brian » August 28th, 2014, 12:58 pm

fonpaolo wrote:I don't know if it's already possible (and maybe useful for someone else besides me...), there's a way to simply detect the use of any key?
Where's the "any" key? :D



I actually have no plans to add this feature mainly because I am already really close to having the plugin flagged as malware, and detecting *any* keystroke may just push it over the edge.

-Brian
User avatar
fonpaolo
Moderator
Posts: 1351
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: HotKey plugin 0.0.1.8 (in beta)

fonpaolo » August 28th, 2014, 7:08 pm

Doh!
...so I have to park some of my skins until I'll find a solution.

Well, it really doesn't have to detect every key, only letters, numbers and maybe shift and capslock... :sly:
User avatar
Krainz
Posts: 136
Joined: May 27th, 2012, 5:16 am

Re: HotKey plugin 0.0.1.8 (in beta)

Krainz » September 5th, 2014, 12:08 pm

Sorry in advance; I didn't test your plugin or read the entire topic. I'm in a rush with a college project.

I just have one question: does your plugin support global hotkeys?
User avatar
jsmorley
Developer
Posts: 18494
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: HotKey plugin 0.0.1.8 (in beta)

jsmorley » September 5th, 2014, 12:46 pm

Krainz wrote:Sorry in advance; I didn't test your plugin or read the entire topic. I'm in a rush with a college project.

I just have one question: does your plugin support global hotkeys?
I may be missing your point a bit, but in a sense all uses of the HotKey plugin are both global and non-blocking at all times.

By that I mean that if you are watching and taking some action in Rainmeter based on a press of the "F2" key, then no matter where you are in Windows, no matter what has the focus, that keystroke will be detected and acted upon by Rainmeter. At the same time, Rainmeter won't in any way stop any other application or the OS itself from seeing and acting on that keystroke based on what it is defined for in that context.

If you are in Windows Explorer and have a file highlighted, then pressing F2 will still activate the "rename" functionality in Explorer, while Rainmeter will also see the keystroke and take whatever action you have defined.

If you really didn't want a HotKey defined in Rainmeter to be "global" in nature, but only detected when the mouse is over the Rainmeter skin or the skin has the "focus" in Windows, then you would want to use the "start / stop / toggle" options in the plugin with various mouse / focus detection actions available in Rainmeter, to turn on and off the monitoring of the keystroke.

By the same token, there is no way to have Rainmeter "intercept" a keystroke, take some action based on it, but not allow other applications with focus, or Windows, to see the same keystroke. For both security and best practice reasons, I assume Brian would never allow Rainmeter to do this.

Note: While I am not sure of any examples offhand, it is possible for a application that has enough security in Windows, and has elected to do so, to "block" any other applications from seeing a particular keystroke. In that case, Rainmeter would not detect the key.
User avatar
jsmorley
Developer
Posts: 18494
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: HotKey plugin 0.0.1.8 (in beta)

jsmorley » September 5th, 2014, 1:42 pm

Brian, I'm a little confused perhaps. I might be missing something.

Seems to me that KeyUpAction is never detected on any key unless there is also a KeyDownAction of some kind defined. That KeyDownAction can be anything, even a null [] action, but it seems that it must exist for KeyUpAction to be fired on release of the key.

Is this the expected behavior?

Perhaps in a "logical" sense this is the proper behavior, as I'm not sure I see the point of having an "up" action alone, while having both "down" and "up" distinctly defined has obvious utility. If you only need to detect the keystroke, then "down" alone is enough. It's not like the mouse where you can press down the button, then move the mouse off the object and never get an "up" action. With a key, you are going to have to let go of it sooner or later.

If this is the expected behavior, that's fine, but we might want to document it, particularly since we have just hammered folks to use LeftMouseUpAction rather than LeftMouseDownAction in the context of mouse clicks.
User avatar
Brian
Developer
Posts: 1797
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: HotKey plugin 1.0

Brian » September 6th, 2014, 4:34 am

New version here: http://rainmeter.net/forum/viewtopic.php?p=102030#p102030

jsmorley wrote:Is this the expected behavior?
No, this isn't expected at all, which I believe I have fixed in the latest version. It should work now.

This seems like a good time to remind folks that the KeyUpAction may not execute in all instances. In some cases you may need to release the keys in the reverse order of being pressed to get the action to execute. This is due to Windows removing the key "up" messages before the plugin can "read" the message.

-Brian
cfixd
Posts: 31
Joined: September 1st, 2014, 1:38 am

Re: HotKey plugin 1.0

cfixd » September 10th, 2014, 12:09 pm

I've published my timer plugin,with a skin using your hotkey plugin
http://rainmeter.net/forum/viewtopic.php?f=18&t=19283

However,I found your HotKey plugin v1.0.0.10 a little big (about 100K),have you used the DLL option ((/MD) in "C/C++" of the project) to build the plugin?
User avatar
Brian
Developer
Posts: 1797
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: HotKey plugin 1.0

Brian » September 10th, 2014, 4:22 pm

cfixd wrote:However,I found your HotKey plugin v1.0.0.10 a little big (about 100K),have you used the DLL option ((/MD) in "C/C++" of the project) to build the plugin?
The plugin SDK uses the /MT option to statically link to the CRT. This prevents the system from having to load different copies of the CRT for Rainmeter to use. This gives you the added benefit of not having to have users download a separate (and older) CRT redistributable in the future (or for older systems, the current CRT redistributable).

One thing I have learned recently, is that you want all your .dll files to use the same CRT as the main app. We statically link to the CRT with the main Rainmeter executable, so you want to use that switch (at the cost of size) for the .dll's.

Of course you can use the /MD option, but you may need to point out in your documents which CRT version you are using, and possibly provide a link to download the correct one.

One of the other reason my plugin is so big is because for some reason certain anti-virus programs were flagging my plugin as malware. I found out that turning off any optimization helped.

-Brian