Make MSN, QQ message Prompt window

Source: Internet
Author: User

QQ and MSN Chat tools are known, as long as friends on the line, will be in the location of the tray to display a prompt window, you can pull the curtain type, or in the form of fading out; Think about why not add a nice hint window for your program too:

Do what you say.

One, MSN pull the curtain-type window making

Divided into three parts: 1, the window Display 2, the window to stay 3, the window disappeared;

If this is achieved, the system should have three timers, separate control. The timer defined is as follows:

#define ID_TIMER_POP_WINDOW 1
#define ID_TIMER_DISPALY_DELAY 2
#define ID_TIMER_CLOSE_WINDOW 3

Inheriting a window from CWnd, of course, can also derive from CFrameWnd, which is not a major problem, and the key is to see how you handle Wm_paint,wm_mousemove,wm_timer messages. In general, I display a picture from OnPaint () and process the timer message in Wm_timer, following the code used in the Virgin timer:

Cmsgwnd::cmsgwnd ()
{
...
SetTimer (id_tiemr_pop_window,20,null);
...   
}
void Cmsgwnd::ontimer (UINT nidevent)
{
static int nheight=0;
int Cy=getsystemmetrics (sm_cyscreen);
int cx=getsystemmetrics (sm_cxscreen);
RECT RECT;
SystemParametersInfo (spi_getworkarea,0,&rect,0);
int y=rect.bottom-rect.top;
int x=rect.right-rect.left;
X=x-win_width;       

Switch (nidevent)
{
Case Id_timer_pop_window:
if (nheight<=win_height)
{
++nheight;       
MoveWindow (x,
Y-nheight,
Win_width,
Win_height);

Invalidate (FALSE);       
}
Else
{
KillTimer (Id_timer_pop_window);
SetTimer (Id_timer_display_delay,5000,null);   
}
Break;
      Case Id_timer_close_window:
if (nheight>=0)
{
nheight--;
MoveWindow (x,
Y-nheight,
        Win_width,
Nheight);       
}
Else
{
KillTimer (Id_timer_close_window);
SendMessage (WM_CLOSE);   
}
Break;
    Case Id_timer_display_delay:
KillTimer (id_timer_display_delay);
SetTimer (Id_timer_close_window,20,null);
break;
}

Cwnd::ontimer (nidevent);
}

Control the display process of the window according to the length of the timer you set;

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.