How to launch 3rd party external application from my own WPF application? - c#

I have wpf application. I need to be able to launch 3rd party external application from my wpf app.
I have searched and found I can use Process.Start() but for that i need the path to 3rd party external applications executable.
Would I be able to get the path for 3rd party external applications executable from my wpf application code?
OR
Is there any process to launch existing apps in windows from wpf application ?
Ex: I need to launch Nvidia GeForce Experience from my wpf application on button click

To know the path of external apps - I can think of 3 ways:
Look at the known Registry Keys for your external apps (like Nvidia
wil lalways make a specific entry and also puts the Install Path and
at times the path to exe)
Assume the user would install at the default location: C:\Program Files - so search in it for the executable
Ask user to do a one time setup by browsing the executable. That way your wpf app can launch it any other time.

Related

Install a windows service from Windows Store application

I'm building a desktop application in WPF that installs a Windows Service (that I'm also building) on first start.
I'd like to be able to build and distribute a windows store application out of this.
Building the package seems to work, but when the application tries to install the service, it fails because such an operation needs elevated privileges.
I know that windows store applications run in isolated environment but I really hope that for desktop application (not UWP) there's a way to tweak the appxmanifest to grant such operation.
Any help/advice is welcome !

how to create silent installer exe for wpf c# application?

I developed C# wpf application using 3rd party SDK now i want to deploy application. i want to create exe which is download and install application directly from web with minimal user interaction.
i also want to install .net framework silently on client machine without user interaction. for example like zoom meeting windows application.
Thank You.
you say download and install but how?
if you want to install like msi setup i'm suggest you to try squirrel
which is like clickonce but it works.
But you can also check: Installshield or Advanced Installer which it can let you create an update windows service. With windows service privileges, you can do your job without user interaction.
Also the other way which i prefered 2 months ago is your own application. You can create an updater windows service application. I've developed an updater software which checks an url for the version, if the version higher then download and update the application. Also check if application is running if app is not running then run it. i'm starting processes with an 3rd party tool which you can find it here you will need it if you want to develop your own application which is windows service. Because of windows service isolated "session 0"
I think best way will be your own development.

How do you use CefSharp in a WCF Service?

I am trying to use the CefSharp.OffScreen(41.0.0) Nuget Package within a WCF Service Application, and I'm getting the following error while trying to run the service from Visual Studio 2013:
Could not load file or assembly 'CefSharp.BrowserSubprocess.Core.DLL'
or one of its dependencies. The specified module could not be found.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'CefSharp.BrowserSubprocess.Core.DLL' or one of its
dependencies. The specified module could not be found.
The mentioned assembly is present in the project's bin folder as well as all the required assemblies listed on CefSharp's Website. If there is in fact another assembly required I haven't figured out what it is.
A few other points worth mentioning:
It is easy to reproduce: Start with VS2013's "WCF Service Application" template simply added the CefSharp.Offscreen Nuget Package.
I build the project in x86.
CefSharp also depends on the Visual Studio C++ 2012 redistributables.
I copied those file into the bin folder but still get the same error.
I tried the solutions in the SO question here, to no avail.
CefSharp works fine when referenced from a Console Application or WPF
Application.
Few points,
IIS cannot access Desktop
So you can't run anything that needs a desktop. Your Console and WPF application has access to Desktop and are called user interactive processes.
CEF needs desktop
Cef will need Window manager to create window, without which it cannot render page. This is the reason, the error is misleading here, as IIS cannot load dependent assemblies which require Desktop interaction unless Allow service to interact with Desktop is selected for IIS process in Windows Services.
Console application is only option with Login
You will have to run your application as console and you will need to login to desktop, allowing IIS to interact with desktop is not a good option and I don't even know what kind of problems it might have.
You can set your server to auto login to some user by modifying registry and set your console application in your startup. So this way everytime server will be restarted, your server will automatically login to specified user and your console app will start. (Windows 8.1 has little difficulty but you will get some solution).
Custom Windows Service with Desktop Access
You can change your application type to Windows Service instead of Console and you can install your windows service that allows access to desktop shown in this article, beware, there are problems that this will work only if somebody is logged on to server.
http://www.codeproject.com/Articles/4891/Interact-With-Desktop-when-Installing-Windows-Serv
PhantomJS headless browser
There is PhantomJS headless browser which you can run in IIS/Windows Service without need to interact with desktop, however you will need to shift your code to JavaScript instead of C#. There are other libraries to manage PhantomJS from your app as well.
According to this link it appears that the solution to this problem is to run the CefSharp code in a [STAThread] thread.

Embed ClickOnce Application

Is it possible to embed a ClickOnce Application in an other Application?
I think there will be problems because a ClickOnce Application is not installed to the same folder every Installation. Is there a solution to embed a ClickOnce Application anyway (So an other Application can run it)?
I managed to find a solution for this problem.
My solution was to create an installer which copies some files to a custom location, the user chooses, on the first run after an update. So the application files will always be in the same direction and can be embedded in other Applications.
Be sure the main Application knows the direction of the ClickOnce Installer Application and checks for updates every Start.

Have activex serve and store executable to a known location

I have a web application that runs internally. I need to run an executable (command line application written in C#) from the browser by passing it 2 parameters.
Infrastructure:
Windows XP - 8
Internet Explorer 6+
C# (.Net 4.0)
The code the launches the executable:
var scanApp = new ActiveXObject("WScript.shell");
scanApp.run("C:\\Path\\To\\exe param1 param2", 1, true);
The above works on my local machine because I have the exe in a known location (on my desktop).
My question is, how best can I deploy this on a client machine through activex and then run the executable?
The workflow would be:
1. Go to webpage
2. Click link that attempts to launch exe
3. Activex 'installs/downloads' the exe to a known location if its not there already
4. Run the exe
TLDR
How to deploy an executable through ActiveX and then launch it whenever user clicks on a webpage button?
Is it necessary that the installation occur through ActiveX? If not and you can deploy a different way (Group Policy, ClickOnce, etc), you can register a protocol handler to accomplish your second goal (similar to how iTunes is registered as a handler for itunes:// links). Just make that part of the install script.
For more information on that topic, see here or here.

Categories

Resources