winforms-interop

WinAPI MoveWindow function not working for some windows

烈酒焚心 提交于 2019-12-19 11:19:23
问题 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

Switch to last active application like Alt-Tab

核能气质少年 提交于 2019-12-19 09:06:26
问题 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

Adding a custom context menu item to Windows Form title bar

前提是你 提交于 2019-12-18 10:36:29
问题 I found a thread on MSDN that shows how to add an item to the context menu of a winform title bar. Unfortunately it does not show how to register an event with the custom menu item and I have been unable to figure out how to do it. Below is a sample app that can be copied and pasted into a new Windows Forms Application. I would appreciate it if someone could complete the sample for me. Thanks using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace

How to customize Calendar in DateTimePicker Control?

给你一囗甜甜゛ 提交于 2019-12-17 19:55:37
问题 I think the question is simple and clear. The image bellow is my current progress. As you can see, customized version is my extended DateTimePicker Control. The control changes button and border color depending on the Focused value. The dropped down calendar is the next thing I want to style. I just don't know where to start because nothing seams to be working. I wouldn't change much at least border color, font color and etc... 回答1: You have very few options. The drop-down calender is a

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine while data export to MS ACCESS

夙愿已清 提交于 2019-12-17 01:58:51
问题 I am beginner in using Microsft.ACE.OLEDB 12.0. I create a Winforms application VS 2010. And create a function for export data grid data to MS Access file. I using Microsoft Oledb for export the data grid data to MS Access file.But i get this error when i try to export the data to ms access. Please see the below image. I also refer the Microsoft.Office 12.0 Object Library in my application. Batch Build Configuration 回答1: The reference to the Access Interop bits has nothing to do with your

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine while data export to MS ACCESS

倾然丶 夕夏残阳落幕 提交于 2019-12-17 01:58:08
问题 I am beginner in using Microsft.ACE.OLEDB 12.0. I create a Winforms application VS 2010. And create a function for export data grid data to MS Access file. I using Microsoft Oledb for export the data grid data to MS Access file.But i get this error when i try to export the data to ms access. Please see the below image. I also refer the Microsoft.Office 12.0 Object Library in my application. Batch Build Configuration 回答1: The reference to the Access Interop bits has nothing to do with your

Erroneous Mouse Coordinates Returned from Low Level Mouse Hook C#

社会主义新天地 提交于 2019-12-13 23:07:48
问题 I'm building a WPF application with some hackery involved to embed Form elements on the same render layer. Essentially what I do is I render the form off-screen and have a mock-up of the form in a WPF image. I also have a low level mouse hook which steals events from the WPF application if they are destined for the Form mock-up and instead use PostMessage(...) to send the events off to the hidden form element. If I return a non-zero value from my hook procedure indicating to eat the event

How to access winforms data from wpf interop?

安稳与你 提交于 2019-12-12 02:45:53
问题 There are 2 projects in my Solution. -WindowsFormsApplication8 -WpfControlLibrary1 I am using ElementHost from WPF Interoperability to host UserControl1 from the WpfControlLibrary1. _________________________ Form1 - [] x | ------------------------- .......... | label1 | // label .......... // elementHost1 // wpf control has one // button and nothing else ____________ | | | ClickMe1 | |____________| __________________________ Now, <Canvas> <Button Click="btnclick">hello</Button> </Canvas>

Mesa3D doesn't like my context creation code?

妖精的绣舞 提交于 2019-12-12 01:26:40
问题 Today I removed my dependence on OpenTK; my application no longer relies on OpenTK for creating an OpenGL context. However, my code no longer functions acceptably when running in Mesa 3D (the software-rendered implementation of OpenGL); my code runs, but the FPS is about 0.001 FPS (compared to about 16+FPS using OpenTK's context creation) and stuff that is normally drawn to a FBO is shown on the window, piece by piece as it is composed. Although running my code without Mesa 3D results in

RaiseEvent from a UserControl that's placed on a UserControl that's on a Form

坚强是说给别人听的谎言 提交于 2019-12-12 01:03:43
问题 I have a Windows Form that contains a custom control container as a UserControl. For the sake of this question, this custom control container is called Dashboard. This container called Dashboard contains numerous other controls depending on their permissions. I need to raise events that are contained on these controls through the Dashboard control and over to the Windows Form. How can I bubble up the event? I'm using VB.NET for this project, but can convert C# into VB.NET. Also, to complicate