sendmessage

MFC的SendMessage用法

天涯浪子 提交于 2019-12-31 13:16:13
Cwnd::SendMessage 函数将直接调用窗口过程,并且在该窗口处理该消息之前,不会返回。 这与 PostMessage 成员函数不同,后者将消息放入窗口的消息队列,并立即返回。 函数声明: LRESULT SendMessage(UINT message, WPARAM wParam = 0,LPARAM lParam = 0); 具体的用法: void CAboutDlg::OnPaint() { // This code, normally emitted by the Application Wizard for a dialog- // based project for the dialog's WM_PAINT handler, runs only if the // window is iconic. The window erases the icon's area, then // paints the icon referenced by m_hIcon. if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0); // Center icon in

VB.net Programmably drop down the DateTimePicker

风格不统一 提交于 2019-12-31 05:19:07
问题 Hey all i have this code here: Call SendMessage(dtPicker.Handle, CB_SHOWDROPDOWN, True, 0&) That works fine on comboboxes but doesn't seem to work when it comes to the DateTimePicker box. What could be the problem? Thanks! David 回答1: No, that's for a ComboBox. The native DTP control is quite noddy. It supports the DTM_CLOSEMONTHCAL message to close the calendar but doesn't have a corresponding message to open it. You'll have to do something ugly like faking mouse or keyboard input. The latter

Get tooltips text from C# with PInvoke

我的梦境 提交于 2019-12-31 04:25:05
问题 I'm using PInvoke in C#, trying to read tooltips visible in a window with a known handler, but the apps who's windows I try to inspect in this manner crash with memory access violation errors, or simply don't reveal the tooltip text in the lpszText TOOLINFO member. I'm calling EnumWindows with a callback and then sending a message to the tooltip window in that function: public delegate bool CallBackPtr(IntPtr hwnd, IntPtr lParam); static void Main(string[] args) { callBackPtr = new

SendMessage, When To Use KEYDOWN, SYSKEYDOWN, etc?

穿精又带淫゛_ 提交于 2019-12-31 01:41:30
问题 I am writing an application that sends keystrokes to another application using SendMessage . [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam); I have been experimenting with the various arguments and I have noticed that, depending on which keystroke I am sending, I have to pass in different arguments to the parameter int Msg . For example, I have the following defined as possible values for Msg . private static ushort WM_SYSKEYDOWN

SendMessage, When To Use KEYDOWN, SYSKEYDOWN, etc?

旧巷老猫 提交于 2019-12-31 01:41:04
问题 I am writing an application that sends keystrokes to another application using SendMessage . [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam); I have been experimenting with the various arguments and I have noticed that, depending on which keystroke I am sending, I have to pass in different arguments to the parameter int Msg . For example, I have the following defined as possible values for Msg . private static ushort WM_SYSKEYDOWN

Installing TTF fonts on windows with python

徘徊边缘 提交于 2019-12-30 21:57:19
问题 I want to install new fonts on windows with Python 2.7. First I copied myFont.ttf to windows Fonts folder then I Added My Font (True Type) key to registry ( HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts ). Now I want to declare system that a new font has been installed. For this I found that I should use win32api.SendMessage , But I don't know how to provide required arguments for this method? Is there anyway to install ttf fonts on windows with python? I googled it but I couldn't

C#调用Win32_的API函数--User32.dll

雨燕双飞 提交于 2019-12-29 08:12:40
来自森大科技官方博客 http://www.cnsendblog.com/index.php/?p=230 GPS平台、网站建设、软件开发、系统运维,找森大网络科技! http://cnsendnet.taobao.com C#调用Win32 的API函数--User32.dll Win32的API函数是微软自己的东西,可以直接在C#中直接调用,在做WinForm时还是很有帮助的。有时候我们之直接调用Win32 的API,可以很高效的实现想要的效果。 代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace WindowsAPI { class CSharp_Win32Api { #region User32.dll 函数 /// <summary> /// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄,以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图。hWnd:设备上 下文环境被检索的窗口的句柄 /// </summary> [DllImport("user32.dll", CharSet = CharSet.Auto)] public

第三方组件引用另一个第三方组件的悲剧

旧街凉风 提交于 2019-12-29 05:16:14
首先我先声明,我的摘要是故意这样写的,如果你是因为看了摘要才进来的,请让我大笑三声:哈哈哈~~ 不过既然你已经进来了,不妨继续往下看看~~ 事件背景 话说最近换工作了,刚接手的项目的项目中遇到一个棘手的事情;一个第三方组件中使用了老版的log4net(1.2.10),另一个第三方组件中使用了新版的log4net(1.2.13) 这下问题来了 当我自己的项目中需要同时使用这2个第三方组件的时候,他们各自引用的log4net版本是不一致的 所以,不管我引用的是哪个版本的log4net,最终的效果 是另一个组件初始化的时候将抛出异常 如下图: 由于2个都是非开源的项目,所以无法重新编译,好在其中一个组件是有技术支持的,所以联系了他们的服务人员 经过一些交涉,问题算是初步解决了 服务还是非常好的!!赞一个!!!! 不过从最后一句话可以看出,其实最终的原因,还是出在设计上!! 为什么一定要耦合log4net? 没错~我承认log4net确实是一款不错的log组件,但是即使是不错也 不是必要的,不可或缺的 ! 想想JQuery,多么好的一个js组件,依然有很多公司没有使用jquery,依赖于jquery的往往被称为jquery插件,因为一旦jquery失效了(或没引用),你的组件就无法使用了 所以在开发自己的组件的时候,就需要 定位清楚 ! 这套组件到底是log4net的插件,还是功能独立的?

How to send an alert message to a special online user with firebase

随声附和 提交于 2019-12-28 12:45:27
问题 I'm trying to make a "FourConnect"-game with javascript. I want, that there is a list from all online users. This list I've made with the example on the firebase site. Now I want that I can choose one online user and send them a invitation to play with me. So I wrote a function, that all users expect of me have an additional div. When I click on the div this special user should get a confirm box to say okey or cancel. If the user clicks okey the play should begin. I'll save the name and the

WINDOWS窗口消息

孤人 提交于 2019-12-27 00:10:05
Windows 窗口消息 不看不知道,一看吓一跳。原来就只是单单理解了 SendMessage 和 PostMessage 。前者是发送完要处理后再返回,后者是发送后立即返回,不管有没有处理。但今天仔细看了书上讲解后,才发现原来事情多着呢。 窗口对象:线程里会有两种特别的对象,即窗口对象和挂钩对象。要知道,进程是分配资源的单位,因此,如果我们创建了某些资源,当我们没有明确要求释放的时候,这些资源只有在进程退出时才被释放。 但窗口对象和挂钩对象不同,他们是属于创建他们的线程的。原因是,窗口和挂钩对象的消除需要依靠 WM_DESROY 和 WM_NCDESTROY 消息,而如果线程退出了,消息循环不再继续,窗口收不到销毁信息,自然是释放不掉了。因此,如果一个线程创建了一个窗口或是安装了一个挂钩,线程结束后,操作系统会自动删除窗口或卸载挂钩。 首先来看看,消息的拥有者,消息队列。 THREADINFO: 每个创建窗口的线程,系统都会为之分配一个 THREADINFO 结构的实例。这个结构如下 Struct THREADINFO { PostMessageQueue; 登记消息队列 VirtualInputMessageQueue; 虚拟输入队列 SendMessageQueue; 发送消息队列 ResultMessageQueue; 应答消息队列 nExitCode; 退出码