Click here to Skip to main content
14,733,682 members
Home » Discussions » C#
   

C#

 
GeneralRe: Grid View Event.. Pin
Rahul DSG14-Jun-09 22:31
MemberRahul DSG14-Jun-09 22:31 
AnswerRe: Grid View Event.. Pin
deepseeindeepsy14-Jun-09 22:49
Memberdeepseeindeepsy14-Jun-09 22:49 
GeneralRe: Grid View Event.. Pin
Rahul DSG14-Jun-09 22:56
MemberRahul DSG14-Jun-09 22:56 
GeneralRe: Grid View Event.. Pin
Mycroft Holmes14-Jun-09 23:00
professionalMycroft Holmes14-Jun-09 23:00 
GeneralRe: Grid View Event.. Pin
deepseeindeepsy14-Jun-09 23:02
Memberdeepseeindeepsy14-Jun-09 23:02 
AnswerRe: Grid View Event.. Pin
Henry Minute15-Jun-09 1:14
MemberHenry Minute15-Jun-09 1:14 
AnswerRe: Grid View Event.. Pin
Kaushal Arora15-Jun-09 3:53
MemberKaushal Arora15-Jun-09 3:53 
QuestionWhy I can't get the WM_CREATE msg in the PreFilterMessage method Pin
hwswin14-Jun-09 20:49
Memberhwswin14-Jun-09 20:49 
I can get the WM_CREATE msg in WndProc when I click button1,but it didn't fired at the PreFilterMessage.

Follow is the source code.Thanks!

    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            filter ft = new filter();
            Application.AddMessageFilter(ft);

            Form1 f = new Form1();
            f.Show();
            Application.Run();
        }
    }

    public class filter : IMessageFilter
    {

        #region IMessageFilter 成员

        const int WM_CREATE = 0x00001;
        public bool PreFilterMessage(ref Message m)
        {
<code>            if (m.Msg == WM_CREATE)
            {
                MessageBox.Show("A");
                return true;
            }</code>
            return false;
        }

        #endregion
    }

    public partial class Form1 : Form
    {
        #region Designer
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(0, 0);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(609, 265);
            this.Controls.Add(this.button1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button button1;
        #endregion

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }


        private void button1_Click(object sender, EventArgs e)
        {
            Form1 f = new Form1();
            f.Show();
        }

        const int WM_CREATE = 0x00001;
        protected override void WndProc(ref Message m)
        {
<code>            if (m.Msg == WM_CREATE)
            { MessageBox.Show("B"); }
            base.WndProc(ref m);</code>
        }
    }

AnswerRe: Why I can't get the WM_CREATE msg in the PreFilterMessage method Pin
N a v a n e e t h14-Jun-09 21:58
MemberN a v a n e e t h14-Jun-09 21:58 
GeneralRe: Why I can't get the WM_CREATE msg in the PreFilterMessage method Pin
hwswin14-Jun-09 22:21
Memberhwswin14-Jun-09 22:21 
GeneralRe: Why I can't get the WM_CREATE msg in the PreFilterMessage method Pin
hwswin14-Jun-09 23:19
Memberhwswin14-Jun-09 23:19 
GeneralRe: Why I can't get the WM_CREATE msg in the PreFilterMessage method Pin
N a v a n e e t h14-Jun-09 23:34
MemberN a v a n e e t h14-Jun-09 23:34 
GeneralRe: Why I can't get the WM_CREATE msg in the PreFilterMessage method Pin
N a v a n e e t h15-Jun-09 0:11
MemberN a v a n e e t h15-Jun-09 0:11 
AnswerRe: Why I can't get the WM_CREATE msg in the PreFilterMessage method Pin
hwswin15-Jun-09 16:25
Memberhwswin15-Jun-09 16:25 
QuestionTake picture from Webcam (problem) Pin
S K Y14-Jun-09 19:04
MemberS K Y14-Jun-09 19:04 
AnswerRe: Take picture from Webcam (problem) Pin
Christian Graus14-Jun-09 19:22
protectorChristian Graus14-Jun-09 19:22 
GeneralRe: Take picture from Webcam (problem) Pin
S K Y14-Jun-09 20:14
MemberS K Y14-Jun-09 20:14 
QuestionWebBrowser in VS2008 Pin
trinm198714-Jun-09 15:56
Membertrinm198714-Jun-09 15:56 
AnswerRe: WebBrowser in VS2008 Pin
Christian Graus14-Jun-09 18:52
protectorChristian Graus14-Jun-09 18:52 
AnswerRe: WebBrowser in VS2008 Pin
trinm198714-Jun-09 21:29
Membertrinm198714-Jun-09 21:29 
QuestionDisplay a grid of all character of a font Pin
baranils14-Jun-09 13:04
Memberbaranils14-Jun-09 13:04 
AnswerRe: Display a grid of all character of a font Pin
PIEBALDconsult14-Jun-09 16:12
professionalPIEBALDconsult14-Jun-09 16:12 
AnswerRe: Display a grid of all character of a font Pin
_Maxxx_14-Jun-09 16:21
professional_Maxxx_14-Jun-09 16:21 
GeneralRe: Display a grid of all character of a font Pin
Luc Pattyn14-Jun-09 16:29
sitebuilderLuc Pattyn14-Jun-09 16:29 
GeneralRe: Display a grid of all character of a font Pin
_Maxxx_14-Jun-09 17:56
professional_Maxxx_14-Jun-09 17:56 

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.