Archive

Archive for the ‘C# How To’ Category

C# Check If Application Is Already Running Then Set Focus

October 6th, 2011 9 comments

Here is a simple code snippet to assist in determining if another instance of the application is running. If there is another instance then close the current one and provide focus to the already running process.

I located this code on a forum, link here

Continue reading “C# Check If Application Is Already Running Then Set Focus” »

Passing parameters collected in dialog to Custom Action in msi C#

May 14th, 2011 Comments off

I was a little lost to why the dialog boxes I was adding to my windows installer msi was not being passed to my custom action.

There is a very simple item that I overlooked, and that is you must specify what values you want sent to your custom action.

On the properties of the custom action, there is a property called CustomActionData.

The format of this properties is:

/ParamName1=”[DIALOGPROPERTY1]” /ParamName2=”[DIALOGPROPERTY2]” …. etc

Custom Action Properties

Custom Action Properties

Then to use the parameters you will use the following code:

string sqlServer = Context.Parameters["ParamName1"];
string username = Context.Parameters["ParamName2"];
string password = Context.Parameters["ParamName3"];
%d bloggers like this: