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

C#

 
AnswerRe: How to disable the Form capture? Pin
Nader Elshehabi27-Sep-06 14:35
Nader Elshehabi27-Sep-06 14:35 
GeneralRe: How to disable the Form capture? Pin
Rojan Gh.27-Sep-06 14:53
professionalRojan Gh.27-Sep-06 14:53 
GeneralRe: How to disable the Form capture? Pin
Nader Elshehabi27-Sep-06 15:00
Nader Elshehabi27-Sep-06 15:00 
GeneralRe: How to disable the Form capture? Pin
Rojan Gh.27-Sep-06 15:12
professionalRojan Gh.27-Sep-06 15:12 
QuestionRe: How to disable the Form capture? Pin
Nader Elshehabi27-Sep-06 15:18
Nader Elshehabi27-Sep-06 15:18 
AnswerRe: How to disable the Form capture? Pin
Rojan Gh.27-Sep-06 15:33
professionalRojan Gh.27-Sep-06 15:33 
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 
It's about 24 hours that I'm reading about and working with this messages!Sigh | :sigh:
Let me tell the exact question:
"I want to write a event handler for clicking the minimize and maximize buttons of the window, using the messages" my code is this:
[STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
      <code>MessageFilter filter = new MessageFilter();
            Application.AddMessageFilter(filter);</code>
            Application.Run(new Form());
        }
        <code>
        class MessageFilter:IMessageFilter</code>
        {
            private const int WM_NCLBUTTONUP = 0xA2;
            private const int WM_NCLBUTTONDOWN = 0xA1;

            public bool PreFilterMessage(ref Message m)
            {
          <code>//When the mouse is pressed(m.Msg == WM_NCLBUTTONDOWN)
                //on the nonClientArea and on the
                //minimize button(m.WParam == (IntPtr)0x8)</code>
                if (m.Msg == WM_NCLBUTTONDOWN && m.WParam == (IntPtr)0x8)
                {
                     //Raise some events
               <code>//Because it returns true,
                     //the message will not be sent to the window!
                     return true;
                     //if it returns false,
                     //the WM_NCLBUTTONUP would not be sent
                     //to the window!</code>
                }
          <code>//When the mouse is released(m.Msg == WM_NCLBUTTONUP)
                //on the nonClientArea and on the
                //minimize button(m.WParam == (IntPtr)0x8)</code>
                else if (m.Msg == WM_NCLBUTTONUP && m.WParam == (IntPtr)0x8)
                {
                    //Raise some events
                    return false;
                }
                return false;
            }
        }

but just the first event raises when if (m.Msg == WM_NCLBUTTONDOWN && m.WParam == (IntPtr)0x8) returns false!
if I return true for the if (m.Msg == WM_NCLBUTTONDOWN && m.WParam == (IntPtr)0x8), the press message would be ignored and would not be sent to the window and so the Capture would not start!
But that way I should ignore the press message and so the window would not be minimized!Sigh | :sigh: D'Oh! | :doh: Cry | :((

Now, did you get my problem?




-- modified at 22:25 Wednesday 27th September, 2006

Sojaner!

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 
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 

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.