I am automating a "save as" dialog through win32 API in a WPF project. The dialog is called internally from the IOleCommandTarget interface of InfoPath 2013. So I do not have access to how the save as window is initialized as far as a DoModal() method or anything similar.
The issue is I do not want the user to be able to interact with the save as window at all. Some things I have tried are ShowWindow with SW_HIDE, SetWindowPos to move the window off screen or below the main application window, and SetLayeredWindowAttributes to make the window transparent. None of these approaches has worked to hide the dialog.
Related
I have created add in for Outlook 2013. It has got a hidden web browser control within it. On button click Web browser loads the speciified data in Internet Explorer window. Content is loading but the IE window does not come to foreground and my outlook will continue be in focus. IE keeps blinking at the task bar.
I want the IE window be in foreground.
If you want to show a Windows Form on top of Outlook window you need to specify the parent window handle. In your case it will be the explorer window handle. To get the handle you need to cast an instance of the Explorer class to the IOleWindow interface which provides the GetWindow method.
The Show or ShowDialog methods of the System.Windows.Form class accepts an instance of the IWin32Window inteface which represents the handle of the parent window. Thus, your window will be shown on top of the parent one.
"Want to launch IE outside the outlook window. – "
In that case use - https://msdn.microsoft.com/en-us/library/System.Diagnostics.Process.Start(v=vs.110).aspx
Process.Start("http://URL");
This will launch the default browser and navigate to the URL specified.
Taking it a bit further than hosting WinForms user controls in my WPF application, I am actually hosting Delphi forms, i.e. top level windows. I am doing so through the voodoo in blog post How To Host Top-Level HWNDs In WPF.
Nearly everything works perfectly. I send a COM server, built in Delphi, a menu path string, and it sends back a window handle, which I pass to the host control described in the blog. The Delphi window receives nearly all events (rather, Windows Messages) correctly, without any intervention on my part.
The only problem is the buttons. They receive a click event/message fine, and work, but now the Delphi guys have added new icons to the buttons, and each button has an active icon, a hover icon, and a click icon. They receive none of the messages they should to change these icons. Why do nearly all messages work except these? What can I read and or do to try and correct this?
In MouseOver event, send some user message and catch it.
WPF and Win32 Interoperation
HWNDs inside WPF > Notable Differences in Input behavior
While the mouse is over the HwndHost, your application does not receive WPF mouse events, and the value of the WPF property IsMouseOver will be false.
I've started using the XCEED MessageBox recently, which uses custom chromes (<-I think that's their name) for the title bar, and it seems that there is no handling for the case when a dialog window (or modal dialog in Win32 terms) needs to flash in response to the user trying to click on the (disabled) parent window.
The flashing border animation is usefull to notify a user that he must respond to a dialog before continuing and to give a hint on which dialog window is that.
Is there a way to get notified when a window needs to perform the flash animation in WPF or set XAML triggers for it?
In WPF, if i want to open a modal/response window then i write code like
Window1 _windowObj1 = new Window1();
_windowObj1.Owner = mainWindowObject;
_window1Obj.ShowDialog();
How to do the same in XBAP. I tried it, but the window is opened independently from the parent page as i cant assign it as a Owner of modal window.
How to Open modal window/dialog in XBAP Application?
I'm not really experienced with XBAP apps, but I believe you should try displaying "popups" in an adorner layer. This has the same effect (you can't access the rest of the application), but doesn't actually open another window according to windows. Google for "wpf adorner dialog" and you should get some results.
Here are some links:
How do I make modal dialog for a Page in my WPF-application?
http://www.codeproject.com/KB/silverlight/slmodal.aspx
http://www.codeproject.com/KB/WPF/wpfmodaldialog.aspx
You did implement Window of WPF? If so, it will not work in XBAP. Please host your UserControl to Windows.Form, then you can open modal window/dialog in XBAP Application
I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.