• 0

[C#] How to create a quick launch button ?


Question

Hi,

I have a friend who is using C# to program some software. However, she wants to know how to create a quick launch button using C#.

As i do not have C# programming knowledge, thus not able to give her any advice.

I hope that i can get some answer from here.

Thanks in advance.

Nikas

13 answers to this question

Recommended Posts

  • 0
  -Alex- said:
Maybe I am missing the point, but just create a shortcut to the program executable and drop it in the quick launch folder?

yes you are, the OP wants to add a shortcut to the quick launch bar programatically, when the application is installed

  • 0

You need to add a reference to IWshRuntimeLibrary (Windows Script Host Object Model)

using IWshRuntimeLibrary;

Then add this into an event (button or something)

WshShell = new WshShellClass();
IWshRuntimeLibrary.IWshShortcut qlShortcut;
qlShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Internet Explorer\\Quick Launch\\MyShortcut.lnk");
qlShortcut.TargetPath = Application.ExecutablePath;
qlShortcut.Description = "Application name, blabla";
qlShortcut.IconLocation = Application.StartupPath + @"\app.ico";
qlShortcut.Save();

  • 0

Just read this tutorial on how to do it. It explains it more :)

Create shortcuts with a .NET application

The only different is that for the full path, you need to be using

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Internet Explorer\\Quick Launch\\MyShortcut.lnk"

  • 0

The correct way to do this is by using the IShellLink interface (google it :) ) and then Persist it to the Quick Launch folder (as above) by using the IPersistFile interface, though I would try that out on a non-english PC, I'm not sure if the folder name is globalized. This is exactly what the windows scripting library does except this way you are removing a totally unnessesary dependancy.

EDIT: theres even a wrapper available here :) :

http://www.msjogren.net/dotnet/eng/samples...t_shelllink.asp

Dan

Edited by dannyres
  • 0

for a basic way, set the program to reduce to the system tray. it will still open the program on mouseclick and will be minimised. this is not exactly what u asked for but it would work..

although the other previously mentioned alternatives are better.

  • 0
  Dan C said:
The only different is that for the full path, you need to be using
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Internet Explorer\\Quick Launch\\MyShortcut.lnk"

You never want to hard code in english names, what happens when you use it on another language? But even then, there was a reason they didn't give you access to the quick launch area, you should let the user decide what to stick in there, not your program.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Sounds good, but that'd require Microsoft to develop and API of some sort and then get all the developers to support it... but everyone knows that while others will support Microsoft, Microsoft won't support itself and will kill off the feature... again. Microsoft has tried this trick in Windows 9x era, they tried it with the games library in Vista, they tried a big push for Games for Windows Live, and then again in Windows 8 with the WPA apps via their mobile/windows phone eco system. Now they're trying it again, and it's lets not forget that this isn't a push to make PC gaming better. It's not. To do that they need to provide at least the same level of quality and feature set of Steam, otherwise why else are gamers going to not use Steam. Right now Xbox app and everything Microsoft centric around the PC gaming front is exclusively for their new Xbox brand push to make everything an Xbox. Your Toaster, your cat, your PC, your VR headset, everything is a Xbox and that'll last for this generation of Xbox now probably. Then, like Microsoft always has done and will do, they'll drop it like a hot potato and everyone will be left crying. Point in case, bringing Xbox games to the ROG handheld, their entire point of this... They're marketing it as if it's an Xbox console in a handheld, yet, it's not. There are going to be Xbox gamers who think, they'll be able to pickup their Xbox one games and play them on a handheld like Nintendo and Steam Deck users... except they're going to quickly find out that their Xbox game library is almost entirely missing or games they've already purchased on the Xbox need to be purchased again on the 'this is an Xbox' handheld.
    • man i remember hearing about new icons years ago and we still are at this......
    • That's entirely speculation. If he wants these on the road, I would assume (and hope) that he's tested the crap out of these things in real world scenario simulations until he (and any government regulators) are 100% convinced that they are as safe as a human driver before letting them on the streets of a real city. You don't test an automated ton of steel and aluminum with a big engine capable of going up to 200 mph by sticking it a public street with a human behind the wheel "just in case" and hoping for the best.
    • Get a lifetime subscription to AdGuard Family Plan for only $15.97 by Steven Parker Get rid of annoying and intrusive ads and protect your device from malware with this advanced ad blocking app Today's highlighted deal comes via our Apps + Software section of the Neowin Deals store, where you can get a lifetime subscription to AdGuard Family Plan for just $15.97. Meet the world's most advanced ad blocker! AdGuard is a unique program that has all the necessary features for the best web experience. The software combines the world's most advanced ad blocker, a whole privacy protection module, and a parental control tool—all working in one app. This amazing software deals with annoying ads, hides your data from a multitude of trackers, protects you from malware attacks, and lets you restrict your kids from accessing inappropriate content. Install AdGuard and see the internet as it was supposed to be: clean and safe. Get rid of annoying banners, pop-ups & video ads once and for all Hide your data from the multitude of trackers & activity analyzers that swarm the web Avoid fraudulent & phishing website and malware attacks Protect your kids online by restricting them from accessing inappropriate & adult content A lifetime subscription of AdGuard Family Plan normally costs $169.99, but this deal can be yours for just $39.99, that's a saving of $130 (-76%). For full terms, specifications, and license info please click the link below. Good to know Family Plan Length of access: lifetime This plan is only available to new users Redemption deadline: redeem your code within 30 days of purchase Max number of devices: 9 Access options: desktop & mobile Software version: AdGuard Family Updates included Use coupon FAMPLAN when checking out to apply additional discount Get this AdGuard Family lifetime deal for just $15.97 Although priced in U.S. dollars, this deal is available for digital purchase worldwide. As an online publication, Neowin too relies on ads for operating costs and, if you use an ad blocker, we'd appreciate being whitelisted. In addition, we have an ad-free subscription for $28 a year, which is another way to show support! We post these because we earn commission on each sale so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. Other ways to support Neowin Whitelist Neowin by not blocking our ads Create a free member account to see fewer ads Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: Neowin benefits from revenue of each sale made through our branded deals site powered by StackCommerce.
    • Spoken like a truly committed Tesla Fanboi. Somehow everything is Waymo's fault... including Tesla's 10+ years of failed FSD promises, Tesla's Swazticar PR, Tesla's blatant inability to not get their vehicles involved in nationwide recalls, and Tesla drivers' inability to drive cars... yup, sounds like it's all Waymo's fault. Jfc, Waymo's about to map+deploy NYC... Tesla can't even drive down a hill without random midroad hard stops in flat-as-earth Austin... and yet it's Tesla eating Waymo's lunch?! WUT?!?!!
  • Recent Achievements

    • Dedicated
      Camlann earned a badge
      Dedicated
    • Week One Done
      fredss earned a badge
      Week One Done
    • Dedicated
      fabioc earned a badge
      Dedicated
    • One Month Later
      GoForma earned a badge
      One Month Later
    • Week One Done
      GoForma earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      637
    2. 2
      Michael Scrip
      224
    3. 3
      ATLien_0
      219
    4. 4
      +FloatingFatMan
      142
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!