• 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

    • Honestly, I think the long-term play here is for Microsoft to ditch the idea of a traditional console entirely and just turn Xbox into a full-on operating system. They (or anyone!) could release hardware like a Mac Mini or a typical console with built-in GPU and RAM, but instead of being locked into a console ecosystem, they run the Xbox OS. It makes total sense because it pushes Game Pass, Windows, and all their other software. The handheld angle is really interesting too. You’d basically have a portable PC. Hook up a keyboard and mouse, and suddenly you can edit videos or get some real work done while on the go. Something like a prebuilt Xbox PC would be more than just a gaming box. It could be a decent little PC that people might actually upgrade with each generation. And since it’s running a PC-based OS, you’d get all the usual perks like mod support, cheaper games across different stores, and no extra charges just to plug in a webcam or other standard accessories. Plus, if they let you install the OS on your own rig, then you’ve got full upgradability too. Best bit also being Microsoft wont even need to build them anyone can and when they do Microsoft just wins. The competition is kind of stuffed. Those maybe relying on SteamOS might be ok but will still have software support issues and no Game Pass. Sony and Nintendo can’t really offer the same kind of flexibility at all not sure how they will live on. They’d struggle to match something that works as a desktop OS, console, handheld, streaming box, and media hub, all with your game library ready to go, never needing to rebuy games. Console exclusives are the only way they can live I think, but if they ever get blocked by antitrust rulings down the line, it’s game over. I'm waiting to see the bloat that's still left on these and if they let you install on a regular old PC. Fingers crossed this could be the lightweight OS we have been asking for.
    • I take my Apple Watch off at night and put it on the charger when I go to bed. Then I wake up the next morning I put it back on.
    • I don’t get what an ai device like a pendant does for me. As a man, I’m not wearing pendant. Then there is battery life. Battery life on my Apple Watch is horribly embarrassing. Having to charge every 36 hours is horribly inconvenient. Fitbits that hold a charge for 5-7 days are much better, so the pendant would need that level of charge. Voice is actually jarring for me. I find it inconvenient when people talk into their phones and I overhear their request. Speaker phones are fine in a closed office but not when others are around. If the device is screen less, it must either respond vocally or respond via the screen on my phone. if this another health device, does the marketplace need another?
  • Recent Achievements

    • Reacting Well
      NeoToad777 earned a badge
      Reacting Well
    • Reacting Well
      eric79XXL earned a badge
      Reacting Well
    • First Post
      brynmot earned a badge
      First Post
    • Reacting Well
      brynmot earned a badge
      Reacting Well
    • Week One Done
      Al_ earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      479
    2. 2
      +FloatingFatMan
      277
    3. 3
      ATLien_0
      243
    4. 4
      snowy owl
      209
    5. 5
      Edouard
      187
  • Tell a friend

    Love Neowin? Tell a friend!