Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6120133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:38:00+00:00 2026-05-23T15:38:00+00:00

I have a dll that is loaded by an application, I can not modify

  • 0

I have a dll that is loaded by an application, I can not modify the source of the application (as I do not have the source) and I want to register a system wide hotkey with the plugin. I can register the hotkey via something like RegisterHotKey(NULL, 1, MOD_CONTROL | MOD_NOREPEAT, 0x42) (see here) but I’m not sure how I should handle the message queue, should I make a new thread and create the message handling loop when the dll initializes? Will my dll be the one receiving the messages or will the application that loaded the dll be the one, and finally is there a better way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:38:01+00:00Added an answer on May 23, 2026 at 3:38 pm

    Here’s how it should be done:

    1. your DLL creates a thread
    2. this thread runs the message loop (GetMessage()/DispatchMessage()) — that sort of thing. GetMessage() is what you really need, whereas DispatchMessage() is needed if you create a window (see below)

    Now one of the two things should happen:

    • the thread creates a window (hidden, perhaps) and the RegisterHotKey() function in called (doesn’t matter what thread calls it) and the window handle is passed to it as the first argument

    OR

    • the thread created by the DLL calls RegisterHotKey(), passing NULL as the first argument.

    After all this your message loop will receive the WM_HOTKEY messages. This is the official and preferred way of doing this, so no, no better ways of doing this if you’re not using a framework which supports it for you (most don’t).

    Don’t forget to call UnregisterHotKey() and kill the window and the thread when you’re done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically I have a plugin dll that is loaded by a GUI-Application. In
I have a CWinApp-based application that is built as a DLL that is loaded
I have a VB6 dll that is loaded by a VB6 frontend. This VB6
I have a DLL that I want to profile.. I tried to use Very
I have a DLL that is written in C++ and I want to suppress
I have a DLL that I can use to pull the following information about
I have a DLL that's compiled, and I don't have the source code for
I have a VB6 application that still references some old VB5 libraries (dll, vbr,
I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when
I have an MFC application (using a legacy library that I can't change). When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.