How to show messageBox with InstallShield 2009 - c#

I'd like to show a messageBox in the setup.
Have how to put this messageBox into a Custom Action?
Because I want to this messageBox appears when one condition is satisfied.
If isn't clear, please, let me know!
EDIT:
I want to make a script to verify if the .exe that I'm trying to execute it's already installed, if don't --> execute, else --> do nothing.

My solution is w.r.t. Installshield 2014 but it is quite common use case to show an error message box during installation based on certain condition. So, this solution might help someone even in case you want to achieve it in an installshield version higher than Installshield 2009.
I achieved it through SpawnDialog control event as discussed below. Let's say you have a dialog with <Back, Next> and Cancel buttons. On the click of Next> button you want to make some check e.g. whether a service is up and running or not.
If service is down then you might want to show an error dialog popup instead of moving to the next wizard step. So this is how you setup your Next> button behavior as shown in the snapshot below:
Now you can notice the SpawnDialog event. I've set it to SetupErrorNew. What is SetupErrorNew? SetupErrorNew is also a dialog. I created it by cloning pre-existing SetupError dialog template as shown in the snapshot below:
This dialog will show the error message that you desire. Few key things that we need to set on the new error message dialog SetupErrorNew as below:
Set the Error Dialog property of the dialog to False.
Error dialog has a number of buttons for Yes, No, Ok, Cancel, Retry, Abort, Ignore options. Delete all buttons except Ok button.
Set the appropriate error message text.
Under Behavior -> For Ok button change the argument value of EndDialog event to Return as shown in the snapshot below:

Use an InstallScript function, there you have a MessageBox().

Related

How to validate greyed out tab on windows app via selenium C#?

I'm working on MSTest framework where the window based app is automated using selenium with .net C#.
I have a scenario to automate where all the options (tab, text or button etc) present on windows app are greyed out. So, when a user try to click on any of those option nothing should happen.
I thought to take the locator of any these option and put a bool condition to see if an app refresh or not, when user try to click on greyed out option. But I am not able to think well how to do so as I'm not good in coding :(
I took the AccessibilityId (locator) of the option (eg: Tab) and observe that in debug mode that WindowsApplicationDrive is returning Element in id form to the variable. So, now I don't know how to use the bool condition to validate this.
Any example help would be appreciated which I can relate and try to test the above scenario.
You can verify the buttons etc attributes - for instance if button is set to Disabled. Inspect the button when 'greyed out' and see what is set.

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.

Reformatting code with R# in a single keyboard shortcut

Using the R# keyboard shortcut for formatting code presents the following window:
which forces me click the Run button every time.
Is there a way to bind a keyboard shortcut directly into the Reformat Code option, rather than just opening this dialog window?
Edit: To make things clear, I don't actually click the Run button with the cursor, I press Enter. (I still find it annoying, and wish for a direct shortcut.)
Oh sweet.. I just checked Tools -> Options -> Keyboard and found the command "ReSharper_SilentCleanupCode". It seems to execute ReSharper's code formatting function without popping up the dialog. Give it a try but try to not break your fingers... the default is ctrl-alt-shift-f :D That needs a rebind...
Although I can't answer the question directly I want to propose Ctrl-K-D as an alternative. This will invoke Visual Studio built-in formatting. It is less thorough but also less intrusive.

Messagebox without buttons in c#

I am trying to handle exception in C#...suppose if the program writes to an output file it checks for if file already exists then it should display an error message.
I don't want to use MessageBox.Show() as it comes with an OK button.
I want to use some kinda informational message where user doesnot have to click on any ok button.
any suggestions???
Thank you
You might be looking for a Toast message that shows a notification, then disappears after a short time by itself.
An example for this is shown here.

SpicIE toolbar, SHDocVw.IWebBrowser2 execScript problem?

I'm developing an addon for IE8+.
Main function:
- when I click the toolbar, it will display a box inside every single page, ex: google.com, bing.com, codeproject.com... by using execScript to execute jQuery.
Therefore, what Im doing is run javascript in the current page.
Everything has done except when that page perform an Pop-up, it doesnt work anymore.
I click the toolbar, nothing happen, but when I look at the pop-up, surprise! has the box which im trying to display. So, I think the current tab and the popup of its is running the same process.
I have change registry key TabProcGrowth to 20, to make sure every single tab run by its own process, but maybe it not work with popup.
sr for my bad english, any suggestion is welcome.
Thanks in advance.
update:
I have changed the way to develop my addon, so I change my question, too. (But any suggestion for the 1st question still very useful for me).
My new question still mention the "execScript" problem.
HOW to execute javascript with every individual tab of IE browser with TabProcGrowth = 0. I need this value set to 0 because I have the timer to request to the server every interval1 (ex: 60s). So if there are more than one processes of IE, the addon will send multi request to server at the sametime.
In my situation now, I set TabProcGrowth to 0. Open IE, open some tabs. Click the toolbar at the newest tab, it works, ofcourse!. But when I click toolbar at the old one, nothing happen. The script still be execute but it takes effect on the newest tab.
It's the big problem for me, resolve this problem, you guys save my life.

Categories