wndproc

FormBorderStyle.None removes the native open effect of windows 8

北城以北 提交于 2019-11-29 15:03:25
I like to have my form borderless in C#. So I used this code: FormBorderStyle = FormBorderStyle.None; But it removes the aero effect of windows 8. The form opens suddenly like a blink. How can i bring the aero effect back? Matin Lotfaliee I am answering my own question using the C++ reference I wrote a class inherited from Form Class. Each form in application should be inherited from this class instead of Form Class. public class AeroForm : Form { int _w = 100, _h = 100; bool aero = false; [StructLayout(LayoutKind.Sequential)] struct MARGINS { public int Left, Right, Top, Bottom; } [DllImport(

Get the coordinates of a WM_NCHITTEST message?

廉价感情. 提交于 2019-11-29 07:04:20
How do I get the coordinates of a WM_NCHITTEST message in C# code? I'd love to get the fastest way, because performance is a requirement. From MSDN: wParam This parameter is not used. lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. So you just need to extract the low-order and high-order words from the message's lParam : int x = lParam.ToInt32() & 0x0000FFFF; int y = (int)((lParam

Catch windows shutdown event in a wpf application

天大地大妈咪最大 提交于 2019-11-29 04:22:25
I have a c# WPF application that needs to save data when it closes. The Window Closing/Closed events work fine if the user closes the program, but they do not get called if the user logs off/shutdown the computer. I have found ways to catch this event in winforms programs ( here , and here ). but i cant figure out how to achieve this in a WPF application. I'm trying to halt the shutdown until my program is ready to exit There is a built-in event Application.SessionEnding - this event fires when the user logs off or shuts down the computer... you just need to subscribe to that and put your code

How do I send/receive windows messages between VB6 and c#?

此生再无相见时 提交于 2019-11-29 02:36:47
I know I can receive messages with the code below in c#, how do I send to vb6, and receive in vb6, and send from vb6? [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] protected override void WndProc(ref Message m) { int _iWParam = (int)m.WParam; int _iLParam = (int)m.LParam; switch ((ECGCardioCard.APIMessage)m.WParam) { // handling code goes here } base.WndProc(ref m); } meklarian Before I start, I'd like to say that I concur with MarkJ. COM Interop will make your life much easier and will not require you to do as much work.

Use class member as WNDPROC/DLGPROC with or without global

自闭症网瘾萝莉.ら 提交于 2019-11-28 02:18:01
I'll go ahead and give a summary to this, how can I use a dialog procedure that is a member of a class? I am creating a window wrapper class, but CreateDialogParam needs a global dialog procedure, so I tried this workaround: I have done a bit of searching on this topic. I am making a Dialog class which I am subclassing to make a CMainWnd and then instantiating that. In the Dialog class I have a member function defined as INT_PTR CALLBACK Dialog::cb_proc(HWND,UINT,WPARAM,LPARAM) . Now, I know that windows must have a global function as a callback procedure. So I made a std::map<HWND,Dialog*>

Class method for WndProc

隐身守侯 提交于 2019-11-28 01:35:05
This article explains brilliantly the options to call a class member WndProc. I've seen this response in stackoverflow but the main problem associating class member WndProc after CreateWindow is that some messages will be lost (including the important WM_CREATE) as explained in the mentioned article . My question : I would like to hear the opinion from an expert on which of the methods exposed below or new one is the best one (performance, maintanability, ...) to create a class member WndProc. Briefing the two final solutions exposed in the article (suposing that it exists a Window class with

WPF Borderless Window issues: Aero Snap & Maximizing

China☆狼群 提交于 2019-11-27 21:38:31
I've created a borderless WPF window by setting the following window properties in XAML: ... WindowStyle="None" AllowsTransparency="True" ... This causes a number of issues: 1) Resolved: It no longer has any built-in resize functionality 2) Resolved: It no longer has any built-in drag functionality 3) Resolved: Without the top toolbar, it no longer has minimize/maximize/restore/close buttons 4) Resolved: Maximizing via aero snap or setting WindowState prevents it from unsnapping. 5) Maximizing via aero snap or setting WindowState will use the whole screen as the boundary, overlapping the

How do I send/receive windows messages between VB6 and c#?

别来无恙 提交于 2019-11-27 16:55:53
问题 I know I can receive messages with the code below in c#, how do I send to vb6, and receive in vb6, and send from vb6? [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] protected override void WndProc(ref Message m) { int _iWParam = (int)m.WParam; int _iLParam = (int)m.LParam; switch ((ECGCardioCard.APIMessage)m.WParam) { // handling code goes here } base.WndProc(ref m); } 回答1: Before I start, I'd like to say that I concur with

WPF Borderless Window issues: Aero Snap & Maximizing

岁酱吖の 提交于 2019-11-27 04:28:43
问题 I've created a borderless WPF window by setting the following window properties in XAML: ... WindowStyle="None" AllowsTransparency="True" ... This causes a number of issues: 1) Resolved: It no longer has any built-in resize functionality 2) Resolved: It no longer has any built-in drag functionality 3) Resolved: Without the top toolbar, it no longer has minimize/maximize/restore/close buttons 4) Resolved: Maximizing via aero snap or setting WindowState prevents it from unsnapping. 5)

How to draw custom button in Window Titlebar with Windows Forms?

↘锁芯ラ 提交于 2019-11-27 04:18:23
How do you draw a custom button next to the minimize, maximize and close buttons within the Titlebar of the Form? I know you need to use Win32 API calls and override the WndProc procedure, but I haven't been able to figure out a solution that works right. Does anyone know how to do this? More specifically, does anyone know a way to do this that works in Vista? Matthew Scharley The following will work in XP, I have no Vista machine handy to test it, but I think your issues are steming from an incorrect hWnd somehow. Anyway, on with the poorly commented code. // The state of our little button