wndproc

Properly using AddClipboardFormatListener and subscribing to WM_CLIPBOARDUPDATE message

我与影子孤独终老i 提交于 2021-01-28 05:25:41
问题 I am currently attempting to use the Windows clipboard and its notifications in my application. Specifically, I am attempting to subscribe to the WM_CLIPBOARDUPDATE window message by using the AddClipboardFormatListener() function. Previously, I had been using the SetClipboardViewer() function in order to add my window directly into the clipboard viewer chain. This had worked just fine, and I had received the relevant messages WM_DRAWCLIPBOARD and WM_DESTROYCLIPBOARD when expected. However, I

How to handle WM_SETCURSOR in C#

故事扮演 提交于 2021-01-27 06:33:11
问题 In my media player application, I hid the cursor using SetCursor(NULL) and to make sure that Windows does not reset the cursor state, I handled WM_SETCURSOR in my WndProc method. protected override void WndProc(ref Message m) { switch (m.Msg) { case WM.SETCURSOR: base.WndProc(ref m); int lowWord = (m.LParam.ToInt32() << 16) >> 16; if (lowWord == HTCLIENT && FullScreen) { SetCursor(IntPtr.Zero); // hides cursor m.Result = (IntPtr)1; // return TRUE; equivalent in C++ } return; } } However when

Listening to OS messages in C#

大憨熊 提交于 2020-12-12 18:12:33
问题 Is there any methods in C# similar to WndProc method to listen to the OS messages.I cant use WndProc because,my class is neither Form nor Inherited from Control(Its DLL) protected override void WndProc(ref System.Windows.Forms.Message m) { switch (m.Msg) { // listen os messages // Ueye Message case uEye.IS_UEYE_MESSAGE: //fetch frame break; } base.WndProc(ref m); } 回答1: WMI will do if you want to listen for specific messages. I once had a project (see comment on question) that listened for

Change cursor in window caption

耗尽温柔 提交于 2020-02-02 13:11:49
问题 I have a WinForm and now I need to change the cursor when it's in the windows caption part. I have some code working, it has 2 problems: It also changes the cursor when on the edges (normal resize cursor should be shown). I found out the I need something like this WM_NCHITTEST & HTTOP , but how do I combine that? There's some flicker when moving the mouse. I also tried placing the code below the base.WndProc(ref m); . This is the code I already have: if ((m.Msg == Win32.WM.NCMOUSEMOVE || m

How to wrap a win32 WndProc into a C++ class?

匆匆过客 提交于 2020-01-24 15:42:51
问题 Is this even possible? For example, let's say I have the following: class Window { private: WNDCLASSEX wc; public: inline WNDCLASSEX getWindowClass() { return wc; } Window(); LRESULT CALLBACK WndProc(HWND hwnd, UINT message, LPARAM lParam, WPARAM wParam); } void RegisterWindow(Window win) { WNDCLASSEX* wc = win.getWindowClass(); RegisterClassEx(wc); } Now, somewhere there is going to be a section (probably in the constructor of the Window class, where it's necessary to assign the WNDCLASSEX a

C++ Changing HWND Window Procedure in runtime

匆匆过客 提交于 2020-01-22 23:22:09
问题 I'm working in an IDE which creates a hwnd and its respective WndProc LRESULT CALLBACK . I need to change the WndProc to a custom one. I've read that SetWindowLong would do the job but I can't find any working example. For example: HWND hwnd; //My window SetWindowLong(hwnd, GWL_WNDPROC, myNewWndProc); Third parameter for SetWindowLong is a Long as the name of the function names it. How can I make a reference from my WndProc function to a Long ? My WndProc : LRESULT CALLBACK WndProcedure(HWND

Why are there multiple DBT_DEVICEREMOVECOMPLETE messages for a BLE HID device?

倖福魔咒の 提交于 2020-01-16 19:25:16
问题 When looking for a WM_DEVICECHANGE message for a BLE HID device via WndProc the arrival and removal messages sometimes occur 1-4 times without any actual removal or turning off of the device. On arrival, I setup communication and on removal I end communication. However, I wanted to see if communication could still occur if I ignored subsequent removal messages and kept reading from the device via ReadFile . What I found is that I would get a read failure if another removal message came in.

Where can I get the actual message codes for the Winform DateTimePicker control?

感情迁移 提交于 2020-01-07 02:57:04
问题 I am building a custom datetimepicker control derived from the standard datetimepicker control and I need to deal with it's messages in the WndProc override. I have scoured the web but the following links are as best as I can get: https://msdn.microsoft.com/en-us/library/windows/desktop/ff485908(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ff485909(v=vs.85).aspx They don't provide the actual message values. Appreciate your kind help. Thanks in advance. By the way I'm