12 2013 档案

摘要:应用程序和硬件设备的通信过程是:应用程序使用CreateFile函数打开设备,然后用DeviceIoControl()与硬件设备通信.CreateFile函数: [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] private static extern IntPtr CreateFile( string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntP... 阅读全文
posted @ 2013-12-05 16:53 super-白 阅读(1218) 评论(4) 推荐(1)
摘要:WPF中处理消息首先要获取窗口句柄,创建HwndSource对象 通过HwndSource对象添加消息处理回调函数.HwndSource类:实现其自己的窗口过程。创建窗口之后使用AddHook和RemoveHook来添加和移除挂钩,接收所有窗口消息。 private void UserControl_Loaded(object sender, RoutedEventArgs e) { HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;//窗口过程 ... 阅读全文
posted @ 2013-12-04 16:51 super-白 阅读(2897) 评论(5) 推荐(1)