如何使用WndProc(ref Message msg) 方法??
我的設計工具: VS2005 C# 智能設備。(windows ce 5.0)消息進行處理。在很多程序上,在msdn上也有是使用這個wndproc()方法接收消息。而且說明是windows ce 獨有的。現在我也把using Microsoft.WindowsCE.Forms; 引入了。
可是總是無法使用 protected override void WndProc(ref Message msg); 當我寫到 protected override void 這裏的時候,下拉菜單沒有WndProc 這個方法啊!
我的源代碼:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using Microsoft.WindowsCE.Forms;
namespace MyApplicationCe
{
public partial class Form1 : Form
{
public const int USER = 0x0400;
public const int TEST1 = USER + 1;
//api
[DllImport("coredll.dll")]
private static extern int SendMessage
(
IntPtr hWnd, // handle to destination window
uint Msg, // message
uint wParam, // first message parameter
uint lParam // second message parameter
);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SendMessage(this.Handle,TEST1,100,200);
}
protected override void ???
這裏就寫不下去了啊!哪位高手指教我一下啊!
可是總是無法使用 protected override void WndProc(ref Message msg); 當我寫到 protected override void 這裏的時候,下拉菜單沒有WndProc 這個方法啊!
我的源代碼:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using Microsoft.WindowsCE.Forms;
namespace MyApplicationCe
{
public partial class Form1 : Form
{
public const int USER = 0x0400;
public const int TEST1 = USER + 1;
//api
[DllImport("coredll.dll")]
private static extern int SendMessage
(
IntPtr hWnd, // handle to destination window
uint Msg, // message
uint wParam, // first message parameter
uint lParam // second message parameter
);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SendMessage(this.Handle,TEST1,100,200);
}
protected override void ???
這裏就寫不下去了啊!哪位高手指教我一下啊!
...全文
相关推荐
WndProc使用方法
这是一个C#操作WndProc的技术文档,里面全面介绍了WndProc的操作
C# 重写WndProc 拦截 发送 系统消息 + windows消息常量值
通过重载虚函数WndProc在C#下处理Windows系统消息。
C#无边框窗体移动的三种方法
1.重写wndProc代码; 2.创建消息; 3.调用API代码:
c# 重载WndProc,实现重写“最小化”的实现方法
在做“亦歌桌面版”的时候,发现当打开歌词状态下,用最小化隐藏窗体到托盘的话(如下code #1),在调出发现歌词缩小了(虽然显现的窗体大小跟刚才一样),从这点看调用该方法其实窗体大小是改变了的(这个过程只是不可视而已)。
C# Winform实现捕获窗体最小化、最大化、关闭按钮事件的方法
主要介绍了C# Winform实现捕获窗体最小化、最大化、关闭按钮事件的方法,可通过重写WndProc来实现,需要的朋友可以参考下


