Click here to Skip to main content
15,881,173 members
Home / Discussions / C#
   

C#

 
GeneralRe: Can't launch URL from desktop app? Pin
Eddy Vluggen8-Mar-13 9:15
professionalEddy Vluggen8-Mar-13 9:15 
GeneralRe: Can't launch URL from desktop app? Pin
SledgeHammer018-Mar-13 11:08
SledgeHammer018-Mar-13 11:08 
GeneralRe: Can't launch URL from desktop app? Pin
Richard MacCutchan8-Mar-13 21:58
mveRichard MacCutchan8-Mar-13 21:58 
GeneralRe: Can't launch URL from desktop app? Pin
Eddy Vluggen8-Mar-13 22:00
professionalEddy Vluggen8-Mar-13 22:00 
GeneralRe: Can't launch URL from desktop app? Pin
Richard MacCutchan8-Mar-13 22:54
mveRichard MacCutchan8-Mar-13 22:54 
GeneralRe: Can't launch URL from desktop app? Pin
Eddy Vluggen8-Mar-13 22:58
professionalEddy Vluggen8-Mar-13 22:58 
GeneralRe: Can't launch URL from desktop app? Pin
Richard MacCutchan8-Mar-13 23:20
mveRichard MacCutchan8-Mar-13 23:20 
QuestionHow to detect mouse over & out on win form title bar Pin
Tridip Bhattacharjee8-Mar-13 7:23
professionalTridip Bhattacharjee8-Mar-13 7:23 
i want to detect mouse over on title bar or mouse out from title bar in my c# winform apps. i got a code sample which works but the problem is when i place the mouse on any area of win form then mouse leave occur and when i put mouse on title bar then right event call. actually i want that if i place my mouse on any area of form except title bar then nothing should happen.only when i will place mouse on title bar then a notification should come to me and when i will remove mouse from title to out of my form then label should display mouse out message but if remove mouse from title bar to form body then label should be blank.

here is code. just run this code and tell me what modification i should do to get my expected result. thanks
using System.Runtime.InteropServices;
C#
public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0xA0) // WM_NCMOUSEMOVE
            {
                TrackNcMouseLeave(this);
                //ShowClientArea();
                label1.Text = "mouse move on title bar";
            }
            else if (m.Msg == 0x2A2) // WM_NCMOUSELEAVE
            {
                //HideClientAreaIfPointerIsOut();
                label1.Text = "mouse leave from title bar";
            }

            base.WndProc(ref m);
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            //HideClientAreaIfPointerIsOut();
        }

        private int previouseHeight;

        private void ShowClientArea()
        {
            if (this.ClientSize.Height == 0)
                this.ClientSize = new Size(this.ClientSize.Width, previouseHeight);
        }

        private void HideClientAreaIfPointerIsOut()
        {
            if (this.Bounds.Contains(Cursor.Position))
                return;
            previouseHeight = this.ClientSize.Height;
            this.ClientSize = new Size(this.ClientSize.Width, 0);
        }

        public static void TrackNcMouseLeave(Control control)
        {
            TRACKMOUSEEVENT tme = new TRACKMOUSEEVENT();
            tme.cbSize = (uint)Marshal.SizeOf(tme);
            tme.dwFlags = 2 | 0x10; // TME_LEAVE | TME_NONCLIENT
            tme.hwndTrack = control.Handle;
            TrackMouseEvent(tme);
        }

        [DllImport("user32")]
        public static extern bool TrackMouseEvent([In, Out] TRACKMOUSEEVENT lpEventTrack);

        [StructLayout(LayoutKind.Sequential)]
        public class TRACKMOUSEEVENT
        {
            public uint cbSize;
            public uint dwFlags;
            public IntPtr hwndTrack;
            public uint dwHoverTime;
        }
    }

tbhattacharjee

SuggestionRe: How to detect mouse over & out on win form title bar Pin
Matt T Heffron8-Mar-13 7:42
professionalMatt T Heffron8-Mar-13 7:42 
Questiondata is not permanent in the database Pin
Member 98700588-Mar-13 7:21
Member 98700588-Mar-13 7:21 
AnswerRe: data is not permanent in the database Pin
Marco Bertschi8-Mar-13 9:58
protectorMarco Bertschi8-Mar-13 9:58 
GeneralRe: data is not permanent in the database Pin
Member 98700588-Mar-13 10:16
Member 98700588-Mar-13 10:16 
AnswerRe: data is not permanent in the database Pin
Dave Kreskowiak8-Mar-13 11:51
mveDave Kreskowiak8-Mar-13 11:51 
GeneralRe: data is not permanent in the database Pin
Member 98700588-Mar-13 14:04
Member 98700588-Mar-13 14:04 
GeneralRe: data is not permanent in the database Pin
Richard MacCutchan8-Mar-13 21:57
mveRichard MacCutchan8-Mar-13 21:57 
QuestionWhen to use & when not to use ( Abstract Class & Interface ) Pin
Krishna Varadharajan8-Mar-13 2:01
Krishna Varadharajan8-Mar-13 2:01 
AnswerRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Pete O'Hanlon8-Mar-13 2:13
mvePete O'Hanlon8-Mar-13 2:13 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Krishna Varadharajan8-Mar-13 2:59
Krishna Varadharajan8-Mar-13 2:59 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Keith Barrow8-Mar-13 3:22
professionalKeith Barrow8-Mar-13 3:22 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Krishna Varadharajan8-Mar-13 3:41
Krishna Varadharajan8-Mar-13 3:41 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Keith Barrow8-Mar-13 4:30
professionalKeith Barrow8-Mar-13 4:30 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Krishna Varadharajan8-Mar-13 4:40
Krishna Varadharajan8-Mar-13 4:40 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Keith Barrow8-Mar-13 4:49
professionalKeith Barrow8-Mar-13 4:49 
AnswerRe: When to use & when not to use ( Abstract Class & Interface ) Pin
GuyThiebaut8-Mar-13 2:40
professionalGuyThiebaut8-Mar-13 2:40 
GeneralRe: When to use & when not to use ( Abstract Class & Interface ) Pin
Krishna Varadharajan8-Mar-13 3:04
Krishna Varadharajan8-Mar-13 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.