wndproc

How to send object instances to WndProc

ぐ巨炮叔叔 提交于 2019-12-13 04:02:52
问题 I'm using my custom class that describes some states and values: class MyClass { int State; String Message; IList<string> Values; } Because of application architecture, for forms interaction is used messages and its infrastructure (SendMessage/PostMessage, WndProc). The question is - how, using SendMessage/PostMessage, to send an instance of MyClass to WndProc? In my code PostMessage is defined next way: [DllImport("user32.dll", SetLastError = true)] public static extern bool PostMessage

Using wndproc in C# to minimize form on leftclick of taskbar

☆樱花仙子☆ 提交于 2019-12-13 03:34:44
问题 I have a C# application that is using wndproc to get a message for a right click to the taskbar, but I also need to use a left click to the taskbar so that I can minimize my form. The message value for right click on taskbar icon is WMTaskbarRClick = 0x0313. Does anyone know what the message value is for left click on taskbar icon? 回答1: This link may have the information you seek. Another link FWIW: I don't know that you should minimize a form when the taskbar is left clicked. The default

How to correctly handle Windows messages from an MSFTEDIT_CLASS (RichEdit) control?

ぃ、小莉子 提交于 2019-12-13 03:24:42
问题 UPDATE: As requested I have added all of the code I am using to create the Window and its RichEdit control. I'm trying to handle windows messages for a RichEdit control used as a child of another window. Now I did have the RichEdit control working with the exception of my own WndProc . The issue is that, when I set wc.lpszClassName = MSFTEDIT_CLASS; so that it matches lpClassName used in CreateWindowEx() , the content of the RichEdit control no longer appears to draw (ie text, etc), however,

Set SizeAll cursor while moving control by handling NC_HITTEST

喜夏-厌秋 提交于 2019-12-12 12:28:19
问题 I wrote the WndProc method for a moveable control such this: protected override void WndProc(ref Message m) { const int WM_NCHITTEST = 0x0084; if (m.Msg == WM_NCHITTEST) { base.WndProc(ref m); if ((int)m.Result == 0x1) m.Result = (IntPtr)0x2; return; } base.WndProc(ref m); } and setted SizeAll cursor for the cursor property. but when we set m.Result as i did, the cursor will be Default in any case. How can i do? 回答1: You should handle WM_SETCURSOR too. Also you may want to hanlde WM

Hittest transparency for an entire form

允我心安 提交于 2019-12-12 04:59:03
问题 Is it possible for the entire bounds of a form to be hittest transparent without adjusting the visibility of the form? I am using a user32 api call to WindowFromPoint in order to find the control under the mouse. In some circumstances I would like to ignore the existance of a child form that floats in front of the main form (or another child form), but keep this form to ignore visible. Setting the Opacity of the form to ignore to 0 will successfully cause the hittest to pass straight through

Win32 , WndProc, and parent-child windows

不想你离开。 提交于 2019-12-12 03:48:26
问题 I'm developing in C code that uses the Win32 Api to create multiple windows. I used createWindow twice - to create parent and child windows. I have a message loop while ( GetMssage (&msg, NULL,0,0)){ . translate dispatch . } But I only get the WND_Proc function called once, instead of twice for each of the windows. What am I doing wrong? 回答1: If I'm understanding your question correctly, you should expect your WndProc to receive a single WM_CREATE message for each window created of the window

Handling Right Click/Left Click of Task-bar Button in c#

空扰寡人 提交于 2019-12-12 02:32:17
问题 I have a form (having Taskbar button shown in Taskbar) and I want to handle left/right clicks of this Task-bar button . I searched everywhere but could find the right answer. There are some related queries posted in stack-overflow as well: Using wndproc in C# to minimize form on leftclick of taskbar How to Detect Right Click on the Taskbar But, nobody seems to have given a proper answer to "How to do" it? Is there any pointers or code snippet how to do it? Please note that I am talking about

Send window message to WPF application from another WPF application

淺唱寂寞╮ 提交于 2019-12-12 01:53:48
问题 I used this code in the server side void Window_Loaded(object sender, RoutedEventArgs e) { HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle); source.AddHook(new HwndSourceHook(WndProc)); } private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { // Handle messages... var htLocation = DefWindowProc(hwnd, msg, wParam, lParam).ToInt32(); if (msg == 1) { MessageBox.Show("" + msg); } return new IntPtr(1); } And I send the message

Creating window class for Dialog

北战南征 提交于 2019-12-11 08:23:41
问题 I create a window class with static window proc for dialog window and have an error executed when window is creating: access denied when writing location "0x00000000" // ... Creating window _hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, WndProc, (LPARAM)this); And window proc function: static INT_PTR CALLBACK MainWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { MainWindow * wnd = NULL; if(message == WM_NCCREATE) { wnd = reinterpret_cast<MainWindow *>

Way of getting control handle from TMessage

冷暖自知 提交于 2019-12-11 07:27:14
问题 Is there anyway to get the control handle or other information with i can indentify a control having only TMessage variable? Question is Delphi related. the thing im doing is that im hooking several controls wndproc with one function and i need to find what control message is that. code: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VirtualTrees, XML.VerySimple, Vcl.StdCtrls,