Deactivating Outlook window for a custom form - c#

I'm currently writing an add-in where a pop-up box of choices appears when a certain action takes place. I'd like to make it so that the user can't continue in Outlook until they've either made a choice or cancelled the pop-up window.
I know how to do this for a static windows form-based application but seem to be running into difficulty and few answers (my google-fu is not coming up with anything right now).
Advice and assistance are welcome as always,
Larry

Call ShowDialog().

Related

Disable prompts in Windows Forms Webbrowser

I have a C# application which uses a System.Windows.Forms.WebBrowser.
The problem is: i'd like the user to navigate smoothly in my application, without prompts, without javascript windows popping up, without security prompts. Even if this requires some contents to be unavailable.
I just want to have one window (always one window, if a receive a new window event, i redirect it to the single window).
How can i do this?
I tried to use this.browser.ScriptErrorsSuppressed = true but i doesnt seem to work.
For example, if i test it on a browser page which performs text validation, i still receive a popup window saying that my text is invalid.
Thank you!
I've found a solution somewhere else, since it wasn't available here.
Here it is: http://www.codeproject.com/Articles/31163/Suppressing-Hosted-WebBrowser-Control-Dialogs
Basically, you have to hook the WM_INITDIALOG message.
It works wonders here.

Pop up enabling

I have a web app in ASP.NET, when you a click a link, am opening a pop up window in a new page, while i do that, if pop ups are disabled in end user computer, is there a way to detect that & enable pop up blockers? so that the new window can automatically open.
Thanks.
You cannot enable popups if they are blocked. It's a little different as to how to tell if your popup was blocked. See this answer Detect blocked popup in Chrome
The best thing to do is to detect if the popup was blocked and ask the used to allow popups for your site.
No, you can't control a person's browser settings from your website. That would be a big security problem and no body would have bothered implementing a pop-up blocker in the first place.
UPDATE:
See Bala's comment. One thing is detecting that it was blocked and another thing is changing the user's browser behavior.

Showing the hidden Winform

I have two independent application. First application is called MSGAPP and other is called SCUForm.
I am controlling the the SCUForm through MSGAPP application by sending the Windows Messages. I can minimize, maximize the SCUForm application by sending the Windows Messages through MSGAPP. And I can also Hide the SCUForm. But when I hide the application, I am not able to show the form back.
what I should do to show it back.
I tried this.Show() but no use.
Am I missing some basics here?
Please guide me.
Thanks in advance.
-Harsha
If I remember well (I did it some year ago), you should try to use WM_SYSCOMMAND with SC_RESTORE.
Watch here.
You could find this and this useful, perhaps.

How do i close all open windows from my C# program?

Hi i have a windows application where i show a webbrowser, i have a button that removes the browser (its a preview) and goes to another "view" in my application (another tab). My problem is that my users are getting advanced, they build HTML with links (and its ok) but the links may spawn new browser windows (IExplorer), and my button needs to close these windows, but how?
I have made some code to traverse all eht windows that ends with "Windows Internet Explorer", ahd it all seems to work - but how do i close them? I am trying to do it like this:
SendMessage((int)hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
It seems to work, but the browser pops up a dialog asking me if i want to close the tab of all the tabs...how to work around/solve this?
Cheers,
walking over all top level iE windows and closing them is a bad idea, unless you are guaranteed users can't launch ie and browse the Internet on their own. Otherwise, you might actually lose user data (say an email or a blog post the user has been working on in the last half an hour)
You can't easily work around that dialog without modifying the per-user IE settings. Your other option is to look for that dialog and click the yes button, but that would be fragile and is not guaranteed to continue working if the user upgrades to IE9.
You could potentially prevent opening links in new window by listening to BeforeNavigate event and allowing only navigations that are guaranteed to happen in your control. However, there are scenarios where IE might still decide to open new window.

How can we prevent popup windows appearing on top of the application?

I have a fullscreen window, and I want to prevent pop up windows that appear at the right bottom corner of my screen. I set the Topmost property to true, but apparently it does not help. I also tried activating the form and giving it the focus once it got deactivated, but that did not help either. What is a way to ignore such windows while the user is engaged with the fullscreen app? I am .NET programming in C#.
You can't do it, this fails the "what if two programs tried to do this" test:
those popups are just normal windows like yours, they also use the same top-most style you are using.
if there was a way to always be above other topmost windows they would have used it too rendering it useless (because the authors of the other apps are just as concerned about the user missing their "super important" notifications as you are about them interfering with your full screen app).
You can try and play dirty tricks to force your window to the top of the top-most z-order, but those popups are likely to use the exact same tricks, again making this all useless (and as an extra bonus all those dirty tricks can turn your app into a compatibility nightmare).
You can disable these balloon notifications using these steps:
Click Start, Run and type regedit
Navigate to the following subkey:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
In the right pane, create a DWORD value named EnableBalloonTips
Double-click the new entry, and give it a value of 0.
Quit Registry Editor.
Log off Windows (this is not very cool...), and then log back on for the changes to take effect.
if you need help in how doing this by program, don't hesitate to ask ;)
I don't think that you can block all the popups, windows might not let you do that. But you can try with SetWindowPos function and pass it HWND_TOP parameter. It might work a little better than Topmost = true.
I used a sys tray popup control on my personal project SvnRadar written in WPF.
The control is at the http://www.hardcodet.net/projects/wpf-notifyicon written by Philipp Sumi.
Very nice.Only thing you will be need to "detach" it from the SysTray screen coordinates and
make it appear where you wish.
Hope it helps.
Good luck.

Categories