winforms-interop

WinAPI MoveWindow function not working for some windows

安稳与你 提交于 2019-12-01 13:26:28
I want to resize and/or move some external windows from my application, mainly the On-Screen keyboardwindow. Here is the code: [DllImport("user32.dll", SetLastError = true)] internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); [DllImport("user32.dll", EntryPoint = "SetWindowPos")] public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags); //assorted constants needed public static uint MF_BYPOSITION = 0x400; public static uint MF_REMOVE = 0x1000; public static int GWL_STYLE = -16;

Switch to last active application like Alt-Tab

半世苍凉 提交于 2019-12-01 07:15:25
ok, I have found many posts on finding a window by name, etc. What I have not found is how to find and switch the window application focus to last active window. The code I am showing below will give me the list of active applications in the task manager that are active. What I can not figure out how to do is figure out what application was the last active application, and then switch to it. for example... I have my custom winform application open. I click a button My application switches to the last active window / application. Here is the working code I have so far. (this is the action on a

Assembly generation failed — Referenced assembly 'Interop.Office' does not have a strong name

核能气质少年 提交于 2019-11-30 20:15:28
I have a WPF 4 project to interact with word documents made in VS2010 and a win form User Control project to host word application into it. And other com dlls. All com dlls are referred into my main wpf application. I want to publish my project so I can install it on another machine and perform automatic update for it, I get error: "Assembly generation failed -- Referenced assembly 'Interop.Office' does not have a strong name. ". error for each COM Dll. A dll refer to (Interop.word.dll, interop.office.dll, interop.VBIDE.dll) and all these dlls are also refer and used into my wpf code. I found

How to avoid visual artifacts when hosting WPF user controls within a WinForms MDI app?

人盡茶涼 提交于 2019-11-30 05:25:31
When hosting WPF user controls within a WinForms MDI app there is a drawing issue when you have multiple forms that overlap each other that causes very distinct visual artifacts. These artifacts are mostly visible after dragging one child form over another one that also hosts WPF content or by allowing the edges of the child form to be clipped by the main MDI parent when dragging it around. After the drag and drop of the child form is completed the artifacts stay around generally but I've found that setting focus to a different application's window and then refocusing back on to my application

Assembly generation failed — Referenced assembly 'Interop.Office' does not have a strong name

六眼飞鱼酱① 提交于 2019-11-30 04:22:43
问题 I have a WPF 4 project to interact with word documents made in VS2010 and a win form User Control project to host word application into it. And other com dlls. All com dlls are referred into my main wpf application. I want to publish my project so I can install it on another machine and perform automatic update for it, I get error: "Assembly generation failed -- Referenced assembly 'Interop.Office' does not have a strong name. ". error for each COM Dll. A dll refer to (Interop.word.dll,

WinForms to WPF - How do we get there from here?

送分小仙女□ 提交于 2019-11-29 17:23:19
问题 Is there a practical way for us to slowly evolve a WinForms application to WPF without creating a support nightmare for ourselves with strange interop scenarios? Background info: We have a large battleship gray WinForms application that is heavily used by an internal group of about 60-75 users. We're starting to run into places where we could see some benefit from having the app in WPF, but it's not enough to justify a large project to completely re-write it. All of the screens in the app are

ComboBox Cue Banner not italic when DropDownStyle is DropDown

爱⌒轻易说出口 提交于 2019-11-29 11:07:15
We have a WinForms control that is an extended version of ComboBox that supports "cue banners" (aka watermarks) when there is no selection or text. Our control is similar to this implementation making use of CB_SETCUEBANNER . However, when we set DropDownStyle for the control to ComboBoxStyle.DropDown (that is, also allows free text entry) the cue banner is showing, just not in italics (which is how it usually shows). Does anyone know how to draw the cue banner in italics for a combo box in ComboBoxStyle.DropDown mode??? Hans Passant By design. When the Style = DropDown, the text portion of

getting text entered in textbox of other applications using c#

▼魔方 西西 提交于 2019-11-29 05:23:34
I am fighting with this thing for the whole day. Still i couldn't figure out the exact solution for this. Help me out. My objective is very simple. I want to get the text which is in textbox of other application. It may be a textbox of gtalk client or a soap UI screen. I googled and most of the forums suggested winapi is the concept that i have to use to achieve this. I never used this concept and also i didn't get any good examples. Please help me on how to approach this and get this thing done. Is there any another way to achieve this ? Waiting for your response guys... Here is an example of

Hosting Windows Forms UserControl into Silverlight application

跟風遠走 提交于 2019-11-28 11:15:53
问题 I've a DLL written in Windows Forms. I need to host one UserControl from this DLL to my silverlight project. Is this possible? In WPF, this is possible using WindowsFormsHost : <WindowsFormsHost Name="m_WindowsFormsHost" Height="800" Width="900" > <winform:PlayerWindowControl /> </WindowsFormsHost> I want to do this in silverlight. 回答1: There is no similar support, nor does it seem likely any would be added, as Silverlight tries to be cross-platform. If you want this feature, then you should

Override tooltip text for Titlebar buttons (Close, Maximize, Minimize, Help)

孤者浪人 提交于 2019-11-28 10:11:34
I have been trying without luck to change the text of the tooltip that appears for the buttons on the main title bar of a form. In a nutshell, we have harnessed the 'Help' button for Windows Forms to have some other purpose. This is working fine. The issue is that when hovering the mouse over that button, a 'Help' tooltip appears, which doesn't make any sense for the application. Ideally, there would be some way to change the text of that tooltip for my application; however, at this point I would be satisfied just finding a way to disable the tooltips altogether. I know that you can disable