2

how can i open C# WPF desktop application when user hit specific formated url on browser ?

Thank you.

user8793959
  • 31
  • 1
  • 3
  • This link contains information you need: https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx – Evk Nov 23 '17 at 13:37
  • OP and upvoters should perhaps take a refresher of [ask] –  Nov 23 '17 at 13:43
  • Also, repeating the title in the _body_ of a question is the peak of laziness –  Nov 23 '17 at 13:45

2 Answers2

2

So at first you need to register your application to an URI-SCHEME via the windows registry.

SAMPLE REGISTRY FILE:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\your_specific_scheme_name]
"URL Protocol"=""
@="URL:your_specific_scheme_name"

[HKEY_CLASSES_ROOT\your_specific_scheme_name\shell]

[HKEY_CLASSES_ROOT\your_specific_scheme_name\shell\open]

[HKEY_CLASSES_ROOT\your_specific_scheme_name\shell\open\command]
@="\"C:\\PathToYourAppInstallFolder\\AppName.exe\" \"%1\""

Then you just need to pass the arguments within your application.

SAMPLE C#:

static void Main(string[] args)
{
    // so somethings with your arguments
}

EDIT:

For proper use of startup arguments at WPF applications you can have a look here: How to start WPF based on Arguments as well

  • i understand little bit what you said here but can you please provide me a simple demo or something more bcoz i don't understand exactly where to register url and what is the meaning of "%1" – user8793959 Nov 24 '17 at 07:18
  • Thank you so much this is perfect solution. it's works for me. – user8793959 Nov 27 '17 at 10:47
-2

Microsoft has ClickOnce deployment technology.
You may read about it here https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-security-and-deployment

There is no other normal solution. (for WPF DESKTOP application)

In case when you control pc of user - you may write and install activeX component to his pc to run application by link. But better to use ClickOnce - it will install app to user or call it, if it is installed already.

Muritiku
  • 222
  • 1
  • 7
  • 1
    Link-only answers are discouraged. Please see : [answer]. Consider adding detail to this answer to summarize. – J... Nov 23 '17 at 13:39
  • ClickOnce is the proprietary technology. There is no other way to understand it - only reading of official documentation. On my view - copy-paste of official documentation - more worst case. – Muritiku Nov 23 '17 at 13:43
  • _[Your answer is in another castle: when is an answer not an answer?](http://meta.stackexchange.com/questions/225370/your-answer-is-in-another-castle-when-is-an-answer-not-an-answer)_. Consider editing your answer to contain a summary of the article pointed to by the link. –  Nov 23 '17 at 13:45
  • Could you please tell me, Where do you see XBAP in question? Question author asked about 'WPF desktop application' – Muritiku Nov 23 '17 at 13:51