winforms-interop

How to get default Ctrl+Tab functionality in WinForms MDI app when hosting WPF UserControls

谁说我不能喝 提交于 2019-12-06 15:16:45
I have a WinForms based app with traditional MDI implementation within it except that I'm hosting WPF based UserControls via the ElementHost control as the main content for each of my MDI children. This is the solution recommended by Microsoft for achieving MDI with WPF although there are various side effects unfortunately. One of which is that my Ctrl+Tab functionality for tab switching between each MDI child is gone because the tab key seems to be swallowed up by the WPF controls. Is there a simple solution to this that will let the Ctrl+tab key sequences reach my WinForms MDI parent so that

Dynamic Application-level resources are not dynamic when hosted in ElementHost

我只是一个虾纸丫 提交于 2019-12-06 02:53:41
问题 I'm hosting a WPF UserControl in a WinForms container. Now, I want to be able to theme/skin the UserControl. To do this, I've got several resource dictionaries that define the "skins." When my app starts up I create a "new System.Windows.Application()" so that Application.Current exists. To change the theme the old skin is removed and a new skin is merged into the Application level resource dictionary at runtime. However, this does not change any of the dyanamically referenced resources in

Custom window frame with DWM: how to handle WM_NCCALCSIZE correctly

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 11:06:45
I'm trying to make a custom window frame for my form using DWM. The platform is C# WinForms, Pinvoking DWM. Following the MSDN article on making custom window frame with DWM , the main steps are next: Remove standard frame (non-client area), returning 0 in answer to WM_NCCALCSIZE message Extend the frame into client area using DwmExtendFrameIntoClientArea function I handle WM_NCCALCSIZE message in the next way: protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_NCCALCSIZE: if (isDwmWindowFramePaintEnabled() && m.WParam != IntPtr.Zero) { m.Result = IntPtr.Zero; } else {

How to connect to outlook 2010 while its running in c#?

无人久伴 提交于 2019-12-05 01:39:29
What I am trying to do is add an "Email To..." button to a winform client that opens a new outlook mail window and attaches a file so the user can forward it. I can get the outlook integration working just fine if outlook is not already running. This is a C# .NET 4.0 winforms app, using the Outlook 14.0 interop library, against Outlook 2010 32 bit running on windows 7 64 bit machine. I have the app already compiled to x86 for other reasons so I doubt its a 32/64 bit issue. Here is my code: // Connect to outlook and create a new mail item var app = new Outlook.Application(); var ns = app

Application hanging during CoCreateInstance of .NET-based COM object

被刻印的时光 ゝ 提交于 2019-12-04 15:02:38
I have a C++ DLL that is creating an instance of a COM object that's implemented in .NET. Under many circumstances this works fine, but under certain circumstances, it hangs the application, and I see it stuck with the following call stack (this is just the part underneath the level of my DLL's code): ntdll.dll!_NtAlpcSendWaitReceivePort@32() rpcrt4.dll!LRPC_CASSOCIATION::AlpcSendWaitReceivePort(unsigned long,struct _PORT_MESSAGE *,struct _ALPC_MESSAGE_ATTRIBUTES *,struct _PORT_MESSAGE *,unsigned long *,struct _ALPC_MESSAGE_ATTRIBUTES *,union _LARGE_INTEGER *) rpcrt4.dll!LRPC_BASE_CCALL:

Dynamic Application-level resources are not dynamic when hosted in ElementHost

a 夏天 提交于 2019-12-04 07:26:57
I'm hosting a WPF UserControl in a WinForms container. Now, I want to be able to theme/skin the UserControl. To do this, I've got several resource dictionaries that define the "skins." When my app starts up I create a "new System.Windows.Application()" so that Application.Current exists. To change the theme the old skin is removed and a new skin is merged into the Application level resource dictionary at runtime. However, this does not change any of the dyanamically referenced resources in the UserControl. I tried this in a straight WPF application and it worked just fine. Am I missing

WPF ElementHost in Winforms crashes (Windows) when Maximized

末鹿安然 提交于 2019-12-04 06:02:51
问题 I'm trying to integrate a new WPF control into an existing WinForms application and I'm using an ElementHost(Dock-Fill) to host the following XAML UserControl. (.NET 4) When I set the WinForm to Maximised my entire operating system crashes. I have updated to the latest NVidia Drivers for my video card, but I still end up with a BlueScreen in nvlddmkm.sys. I have searched around for others that are experiencing crashes like this, but haven't found anything other than "update video card drivers

how to play flash in WPF application

六眼飞鱼酱① 提交于 2019-12-02 05:47:52
I have a WPF application and I want to play flash movies in it. I used the WInforms active X control as described in this link It worked partially, but now whenever I run the application it crashes saying "InvalidActiveXStateException" does anyone have an idea how to solve this? I would recommend adding a WebBrowser control to your WPF application and allow IE to load the URL of the Flash Movie directly; which in turn would load the Flash Plugin. You will need to build your WPF application as x86 only for this to work on x64 Windows. I found a solution. You can use a AxShockwaveFlash. see this

Paint or Hide Control Box for Borderless Form while maximize and minimize

佐手、 提交于 2019-12-02 04:42:59
问题 I've attached a small example about the issue. How can I hide the control box completely during Maximize and Minimize the Borderless Form using System.Windows.Forms; using System.Runtime.InteropServices; using System.Security; using System.Threading; namespace TalkTime { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private const int WM_NCPAINT = 0x0085; protected override void WndProc(ref Message m) { int message = m.Msg; switch (m.Msg) { case WM_NCPAINT: {

Paint or Hide Control Box for Borderless Form while maximize and minimize

久未见 提交于 2019-12-02 00:47:17
I've attached a small example about the issue. How can I hide the control box completely during Maximize and Minimize the Borderless Form using System.Windows.Forms; using System.Runtime.InteropServices; using System.Security; using System.Threading; namespace TalkTime { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private const int WM_NCPAINT = 0x0085; protected override void WndProc(ref Message m) { int message = m.Msg; switch (m.Msg) { case WM_NCPAINT: { Thread.Sleep(100); return; } } base.WndProc(ref m); } protected override CreateParams CreateParams { get