RDP ActiveX Ctrl+Alt+Del - c#

In our C# application we use the RDP viewer as an ActiveX control. The application has its own toolbar with a Ctrl+Alt+Del button. There does not seem to be a method on the ActiveX control to perform this function. I know you can hit Ctrl+Alt+End on your keyboard which is fine but how do I do that from the toolbar button click?

Try to use the SendKeys class.
In this example, you could send CTRL+ALT+END as this:
SendKeys.Send("(^%{END})");

Related

How to enable keyboard events in WebBrowser control in Office custom task pane

I have a WebBrowser control shown in a custom task pane in an Microsoft Office Application-level add-in created in Visual Studio. The web page shown in the WebBrowser doesn't receive keyboard events that can be handled by JavaScript code, such as KeyUp. The same page shown in a comparable WebBrowser in a Form does receive keyboard events. The WebBrowser control itself doesn't seem to expose any events related to keyboard input, and I don't seem to be able to handle keyboard events by adding event handlers to the UserControl added as a custom task pane.
I have created a minimal example – a Visual Studio solution – which recreates the problem.
Is there any way to pass on keyboard events to the web page?
Yup, you can do it. You'll have to hook into the HTML DOM events (like onclick, onmouseover, etc.). Take a look here: http://www.w3schools.com/jsref/dom_obj_event.asp.
And there's an example here:
http://www.codeproject.com/Articles/547451/WebBrowser-Element-Events-and-Values
I think you'll have to add a reference to the MSHTML library. BTW, put the WebBrowser control in a Panel control or it will act goofy - especially with keyboard events.
Actually I found a solution is to use the WebBrowser under Excel namespace
https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.controls.webbrowser.aspx
Obviously it is subclassing the windows form WebBrowser and fix the keyboard issues by handing some windows message manually.

How to capture the WebBrowser control close event?

I have a WebBrowser control in a WPF application. The browser control is in a grid and when the WebBrowser control renders some webpages, in one of the pages there is popup alert box from the webpage, and when the user taps on the popup the WebBrowser control seems to be closed. I need to capture this close event and take some action.
I already tried subscribing to the unload event but it does not seem to fire. Is there any way to get this event captured?
There is WindowClosing event on the underlying WebBrowser ActiveX control for that. I haven't tried it myself, but I think it should work.
Here's a full-fledged sample showing how handle the "underlying" WebBrowser events like that. It's for WPF, but it can be easily adapter for WinForms (using WebBrowser.ActiveXInstance).

Win Forms Key press events do not get triggered when Form is invoked from System.AddIn Adapter

I am using System.AddIn library from .NET 3.5 AddIn & Extensibility features. I have a requirement to add a Button in the toolbar of the existing application which acts as Add Host. I was able to add the button and invoke the custom Win Form from the button click action.
OnClick of the Add-In button, I am invoking a win form which loads WebBrowserControl. Every thing work perfect except the none of the Keyboard events get triggered. If I make my form as Dialog window Keyboard events get triggered. I am bit blocked due the behavior. Any inputs would be appriciated.
Thanks,
Nags

Handling the events of a Interop control in C#

In a Win32 C# App, we are using a AxInterop control, it has some buttons on it like Ok, Cancel,etc...now in the C# code when I call and open the window of that AxInterop I want to see how can I know that user clicked on Ok buttton for example in that control so I can handle some stuff in C# code....
You can only use whatever the control exposes. You cannot capture the control events if they do not capture your click and translate it to a custom click that you can handle.
If you don't have the control documentation you can examine the controls methods/properties/events ... pressing F2.

C#- triggering mouse and keyboard movements

Is it possible to capture/trigger mouse or keyboard events inside an Internet Explorer browser tab?
How do I access the clipboard data of the browser?
How to manipulate the DOM of the page?
Does a mechanism exist which will work across all IE versions?
To capture you can use SetWindowsHookEx() with MouseProc() and KeyboardProc():
http://msdn.microsoft.com/en-us/library/ms644990
To trigger look at SendInput function():
http://msdn.microsoft.com/en-us/library/ms646310
You can access clipboard through Clipboard class, here some examples:
http://www.geekpedia.com/tutorial188_Clipboard-Copy-and-Paste-with-Csharp.html
http://www.codeproject.com/KB/shell/clipboard01.aspx
What do you mean 'manipulate'?
If you want to input some text, and press some buttons in IE window you can try to use UI Automation or Microsoft Active Accessiblity:
http://msdn.microsoft.com/en-us/library/ms788733.aspx

Categories