Click here to Skip to main content
15,908,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
http://stackoverflow.com/questions/12329421/is-there-a-way-to-check-when-mouse-is-above-standard-window-control-buttons-clo[^]

This code is not mine. I went through the above link and I had made some alteration according for my requirement. I'm trying to code mouse enter & mouse leave event for minimize & close button of form in c#?
C#
SpeechSynthesizer reader;
internal const int WM_NCMOUSEMOVE = 0x00A0;

protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_NCMOUSEMOVE)
    {
        //Mouse over on Minimize button
        if ((int)m.WParam == 0x8)
        {
            reader = new SpeechSynthesizer();
            reader.SpeakAsync("Minimize button");
        }

        //Mouse over on Maximize button
        if ((int)m.WParam == 0x9)
        {
            reader = new SpeechSynthesizer();
            reader.SpeakAsync("Maximize button");
        }

        //Mouse over on Close button
        if ((int)m.WParam == 0x14)
        {
            reader = new SpeechSynthesizer();
            reader.SpeakAsync("Close button");
        }
    }

    base.WndProc(ref m);
}

My Questions:
1. How can I use reader.SpeakAsync (Asynchronous) method without repeating. Since if I use reader.speak (Synchronous) that will wait process until it finish reading text.
2. Also I need to implement mouse leave event. Because if mouse leaves the button, I do want to call reader.Dispose() method. Are there any way to implement mouse leave events?
Please help.
Posted
Updated 6-Jun-13 2:43am
v3

1 solution

1. Try background worker, in this case reader.speak will work at background

2. Hope this link will help you - Easy Customize Title Bar[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900