How can you register global hotkeys with Windows?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • How can you correctly register hotkeys with Windows with your Fusion programs? I know that we can already listen for keypresses even when a Fusion-built application is minimised or in the system tray, by using the Key or Is Key Pressed Outside objects. But it would be good to be able to correctly register these hotkeys with Windows the 'proper' way, to help prevent conflicts with other programs that might try to use the same ones. I have a hunch that managing these hotkeys via the OS might also be more performant than using the Key object.

    From what I can understand of the links below, you have to use a system function called RegisterHotkey, and you have to ensure that your application can communicate with Windows using a "Message Loop". But I have no idea how to do any of that. Would anyone be able to explain how I might go about the process?

    Link 1: Please login to see this link.

    Link 2: Please login to see this link.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • The message loop is WindowProc messages, which is part of Windows exts (and extension SDK). Fusion runtime gets the messages from OS, passes them to extensions that listen to that, and sends responses based on runtime or extension.

    For example, a mouse click is a Please login to see this link. message, followed by a Please login to see this link.. It's queued until the app ticks and takes it from queue. It's why windows suddenly respond to all the typed keys if they break out of Not Responding, as the queue was still storing it. It's also how windows register as Not Responding to begin with; if they don't read from the queue for several interactions. Even drawing the window is a request with Please login to see this link., sent when a window above it is moved away, for example.

    For RegisterHotkey, you'll need an extension for that. You can do it with Dll Object, and use Window Message Object Pro to listen to the WM_HOTKEY message type.

    Please login to see this attachment.

    Darkwire Software Lead Programmer (C++ & C#)
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

  • I haven't yet found the time to try this, but I just wanted to say thanks for the reply, Phi - this seems like just the information I needed. :thumbup:

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!