Click here to Skip to main content
15,891,811 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to disable the Form capture? Pin
Nader Elshehabi27-Sep-06 16:00
Nader Elshehabi27-Sep-06 16:00 
GeneralRe: How to disable the Form capture? [modified] Pin
Rojan Gh.27-Sep-06 16:18
professionalRojan Gh.27-Sep-06 16:18 
GeneralRe: How to disable the Form capture? Pin
Nader Elshehabi27-Sep-06 16:24
Nader Elshehabi27-Sep-06 16:24 
GeneralRe: How to disable the Form capture? Pin
Rojan Gh.27-Sep-06 16:35
professionalRojan Gh.27-Sep-06 16:35 
AnswerRe: How to disable the Form capture? Pin
Nader Elshehabi27-Sep-06 18:38
Nader Elshehabi27-Sep-06 18:38 
GeneralRe: How to disable the Form capture? Pin
Rojan Gh.28-Sep-06 4:05
professionalRojan Gh.28-Sep-06 4:05 
GeneralRe: How to disable the Form capture? Pin
Nader Elshehabi28-Sep-06 4:16
Nader Elshehabi28-Sep-06 4:16 
AnswerRe: How to disable the Form capture? Pin
Rojan Gh.28-Sep-06 8:23
professionalRojan Gh.28-Sep-06 8:23 
Nop! Not WM_LBUTTONUP nor WM_NCLBUTTONUP fire!
I tested it in Spy++, it showes that the WM_LBUTTONUP fires but the application does not receive it, and even if it receives, there is no way to check if the mouse is on exactly on the minimize button!
And there is something else, although the Spy++ reports that the WM_LBUTTONUP fires, the MSDN tells that, the WM_LBUTTONUP message would be sent to the window, just when the mouse is on the ClientArea of the window.

Anyway, I changed my code to this:
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int WM_NCLBUTTONUP = 0xA2;
        
bool filterOff = true;
Message message = new Message();
bool internalMessage = false;

        [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_NCLBUTTONDOWN && m.WParam == (IntPtr)0x8)
            {
                if (internalMessage)
                {
                    internalMessage = false;
                }
                else
                {
                    message = m;
                    if (filterOff)
                    {
                        Message mes = new Message();
                        mes.HWnd = this.Handle;
                        mes.Msg = 162;
                        mes.WParam = m.WParam;
                        mes.LParam = IntPtr.Zero;
                        this.WndProc(ref mes);
                    }
                    return;
                }

            }
            else if (m.Msg == WM_NCLBUTTONUP && m.WParam == (IntPtr)0x8)
            {
                internalMessage = true;
                this.WndProc(ref message);
                return;
            }
            base.WndProc(ref m);
        }

        private void Form_KeyUp(object sender, KeyEventArgs e)
        {
            if(e.KeyCode.ToString() == "Escape")
            {
                if (!filterOff) { filterOff = true; }
                else
                {
                    filterOff = false;
                }
                
            }
        }

and when I recieve the WM_NCLBUTTONUP, I send a WM_NCLBUTTONDOWN message to the window, myself, but I don't like it!
There have to be someway to make the WM_NCLBUTTONDOWN be sent to the window!D'Oh! | :doh:
It is driving me crazy! I have to solve this!Confused | :confused:

Sojaner!

QuestionWeb Aplication learning with ASP.NET Pin
unitecsoft27-Sep-06 12:25
unitecsoft27-Sep-06 12:25 
AnswerRe: Web Aplication learning with ASP.NET Pin
Christian Graus27-Sep-06 12:55
protectorChristian Graus27-Sep-06 12:55 
AnswerRe: Web Aplication learning with ASP.NET Pin
Nader Elshehabi27-Sep-06 14:04
Nader Elshehabi27-Sep-06 14:04 
AnswerRe: Web Aplication learning with ASP.NET Pin
_AK_27-Sep-06 21:06
_AK_27-Sep-06 21:06 
GeneralRe: Web Aplication learning with ASP.NET Pin
unitecsoft27-Sep-06 22:34
unitecsoft27-Sep-06 22:34 
GeneralRe: Web Aplication learning with ASP.NET Pin
_AK_27-Sep-06 23:00
_AK_27-Sep-06 23:00 
GeneralRe: Web Aplication learning with ASP.NET Pin
unitecsoft28-Sep-06 4:56
unitecsoft28-Sep-06 4:56 
GeneralRe: Web Aplication learning with ASP.NET Pin
_AK_28-Sep-06 8:13
_AK_28-Sep-06 8:13 
QuestionRelative path of database? Pin
fahiemulleh27-Sep-06 10:51
fahiemulleh27-Sep-06 10:51 
AnswerRe: Relative path of database? Pin
Not Active27-Sep-06 10:54
mentorNot Active27-Sep-06 10:54 
GeneralRe: Relative path of database? Pin
fahiemulleh27-Sep-06 11:01
fahiemulleh27-Sep-06 11:01 
GeneralRe: Relative path of database? Pin
Not Active27-Sep-06 13:12
mentorNot Active27-Sep-06 13:12 
GeneralRe: Relative path of database? Pin
Bob Nadler27-Sep-06 17:38
Bob Nadler27-Sep-06 17:38 
AnswerRe: Relative path of database? Pin
elitehuang28-Sep-06 23:14
elitehuang28-Sep-06 23:14 
QuestionDirectGraphics and C# Pin
bayfouinc27-Sep-06 10:45
bayfouinc27-Sep-06 10:45 
AnswerRe: DirectGraphics and C# Pin
Dave Kreskowiak27-Sep-06 13:30
mveDave Kreskowiak27-Sep-06 13:30 
GeneralRe: DirectGraphics and C# Pin
bayfouinc28-Sep-06 2:18
bayfouinc28-Sep-06 2:18 

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.