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 371793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:08:55+00:00 2026-05-12T14:08:55+00:00

I create a global hot key to show a window by PInvoking RegisterHotKey() .

  • 0

I create a global hot key to show a window by PInvoking RegisterHotKey(). But to do this I need that window’s HWND, which doesn’t exist until the window is loaded, that means shown for the first time. But I don’t want to show the window before I can set the hot key. Is there a way to create a HWND for that window that is invisible to the user?

  • 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-12T14:08:55+00:00Added an answer on May 12, 2026 at 2:08 pm

    If you are targeting .NET 4.0 you can make use of the new EnsureHandle method available on the WindowInteropHelper:

    public void InitHwnd()
    {
        var helper = new WindowInteropHelper(this);
        helper.EnsureHandle();
    }
    

    (thanks to Thomas Levesque for pointing this out.)

    If you are targeting an older version of the .NET Framework, the easiest way is to show the window to get to the HWND while setting a few properties to make sure that the window is invisible and doesn’t steal focus:

    var window = new Window() //make sure the window is invisible
    {
        Width = 0,
        Height = 0,
        WindowStyle = WindowStyle.None,
        ShowInTaskbar = false,
        ShowActivated = false
    };
    window.Show();
    

    Once you want to show the actual window you can then set the Content, the size and change the style back to a normal window.

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

Sidebar

Related Questions

I just read this article on how to create global hotkeys using Carbon events.
In Oracle, you can create a temp table using something like: CREATE GLOBAL TEMPORARY
I saw this example in php manual page http://www.php.net/manual/en/session.examples.php The example will create a
in this code: int foo() { static int x; } is the x global
I am implementing an iPhone application. In that I need to use a timer
In a Windows Application, when multiple threads are used, I know that it’s necessary
Situation Say I have the following: a table items a table lists to which
I have a vector class with a properly overloaded Vect*float operator and am trying
I have written a C based library and for it to work in multi-thread
The descriptor protocol in Python 2.6 is only defined for class definitions, and thus

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.