• 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

    • Will be replacing my last 2 Windows 10 PC's in household ASAP, if they could upgrade now i've done it already. Main Desktop runs Windows 11 already, that ones all set. Now just to get the other 2 all set asap
    • I think you answered why it gets so much attention in your comment. It's designed to make Windows accessible to everyone! It's a core component of the Windows UI, and 30 years of its existence is why it remains such a key component and receives so much attention to this day!
    • I agree with your points, particularly around workflows. But I think this is a symptom of the way Microsoft plans, builds, and releases its OS's, not about its UI ideals itself. It has historically been large jumps in UI changes between releases, XP > Vista > 7 > 8 were ALL significant changes in how we performed tasks. Then Win10 was released and updated twice a year with minor changes. This was somewhat nice as the changes were often minimal, however as it looked like the same OS for the most part, when something did change (like the start menu), it was a bit confusing for people who didn't understand that they had actually been upgraded, and why just this one key part of their workflow had changed. But I believe that was too slow, and didn't allow their future designs to be played out in that release structure. So the "last Windows version ever" was superseded with a new UI and overhauled once more. It too has changed quite a bit in its 4 years, but I think there needs to be an understanding of that change, which I guess we have in the "24H2" version numbering, but not in the marketing that most users know. The most consistent and clear communication of changes I think is done with MacOS. While I'm not a fan of Apples software, their clear and consistent release schedule, and progressively planned changes to the OS is easy to understand, leading towards a well thought out goal. Their users understand the branding of the big updates, and that changes will occur when they update, yet these are more subtle than changes we see in Windows 7 > 8 > 10 > 11 releases. On that, Windows 10/11 version updates just get lost in the vast collection of update types in Windows Update, and as such most users wouldn't know if the were on 22H2, 23H2 or 24H2, or even know what those meant. My thoughts are that Microsoft will drop the Win11/Win12 branding once Windows 10 has finally died. And hopefully, make it a bit more consistent with feature/UI updates sticking to an improved branded version/year release rather than "moments" or just randomly enabled elements in a random monthly update. Until then, even us tech users rarely know what features are in what release and if we will see it on our own computers. Get with it MS!
    • Hello, Horizon Data Systems, the developer, has been around for 27 years.  I do not recall hearing anything bad about them, but I also haven't used their software, either. Regards, Aryeh Goretsky  
  • Recent Achievements

    • Reacting Well
      pelaird earned a badge
      Reacting Well
    • Mentor
      The Werewolf went up a rank
      Mentor
    • First Post
      Myriachan earned a badge
      First Post
    • Week One Done
      DrRonSr earned a badge
      Week One Done
    • Week One Done
      Sharon dixon earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      601
    2. 2
      ATLien_0
      214
    3. 3
      +FloatingFatMan
      169
    4. 4
      Michael Scrip
      151
    5. 5
      Som
      151
  • Tell a friend

    Love Neowin? Tell a friend!