Write a program to control the hiding and display of other application Windows:

Source: Internet
Author: User

1. register the hotkey

 

Bool registerhotkey (
Hwnd, // window to receive hot-key notification
Int ID, // identifier of Hot Key
Uint fsmodifiers, // key-modifier flags
Uint VK // virtual-key code
);

Registerhotkey (this-> m_hwnd, 0xa002, mod_control + mod_alt, 79 );

 

2. Use findwindow or find1_watpoint to find the hwnd of the application window.

 

3. process this hwnd in the hotkey.

 

Call showwindow (hwnd, sw_hide); // or sw_show to hide and display the application window corresponding to this hwnd.

 

4. The pseudocode is as follows:

 

Cmainframe: Create (..)
{
If (! Cframewnd: Create (..))
Return-1;
Obtain the hwnd of the required program;
Register the hotkey;
Return 0;
}
Cmainframe: onkeydown (...)
{
If (equivalent to the registered hot key)
{
If (hide window)
{
Display window;
}
Else
{
Hide the window;
}
}
Cframewnd: onkeydown (..);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.