• 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

    • OpenAI announces o3 Pro, its most intelligent reasoning model by Pradeep Viswanathan OpenAI today announced o3-pro, its flagship reasoning model that uses more compute to "think harder" and provide consistently better answers. This new model will be replacing o1-pro in ChatGPT since it consistently performs better in math, science, and coding. To help everyone make the most out of the model, o3-pro supports tool calling. So, based on the user prompt, the model can do a web search, analyze files, reason about visual inputs, use Python, personalize responses using memory, and more. This is a big improvement over o1-pro, which lacked access to tools. But the downside is that o3-pro will take more time to respond. OpenAI recommends users use o3-pro in cases where reliability matters more than speed. According to OpenAI's evaluations, users consistently preferred o3-pro's responses over o3 in key domains like science, education, programming, business, and writing help. o3-pro was also rated consistently higher for clarity, comprehensiveness, instruction-following, and accuracy. The new o3-pro model is available in ChatGPT's model picker for Pro and Team. ChatGPT's Enterprise and Edu users will get access to this latest model next week. For developers, the o3-pro model comes with a 200,000 context window and is priced at $20 per million input tokens and $80 per million output tokens. OpenAI recommends developers use background mode with o3-pro to prevent timeouts. And the model has a May 31, 2024 knowledge cutoff. The OpenAI team also noted the following as the current limitations of the o3-pro model: At the moment, temporary chats are disabled for o3-pro as we resolve a technical issue. Image generation is not supported within o3-pro—please use GPT-4o, OpenAI o3, or OpenAI o4-mini to generate images. Canvas is also currently not supported within o3-pro. As OpenAI continues to refine its models, the balance between speed and reliability will likely remain a key consideration for users choosing the right tool for their needs.
    • What annoys me is updates take forever to install on my Pixel 9 Pro XL, it was never so slow on my Samsung devices.
    • Still waiting for Android freaking 15 (One UI 7) on my (supported) Samsung phone and Google is already moving on to 16...
    • PS I just contacted patch for a free trail, But I'm sure that I'm gonna pay for another 5 years of win10 My acer laptop is now almost 6 years old, it's an old school laptop; I can open it with my iFixit toolset, I clean it every 6 months, I can replace a lot parts without any problems it will run another 5 years no matter what. If I need I have the money to buy a frame.work laptop with heavy specs. That will do for a many of years
  • Recent Achievements

    • Reacting Well
      rshit earned a badge
      Reacting Well
    • Reacting Well
      Alan- earned a badge
      Reacting Well
    • Week One Done
      IAMFLUXX earned a badge
      Week One Done
    • One Month Later
      Æhund earned a badge
      One Month Later
    • One Month Later
      CoolRaoul earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      542
    2. 2
      ATLien_0
      269
    3. 3
      +FloatingFatMan
      209
    4. 4
      +Edouard
      203
    5. 5
      snowy owl
      140
  • Tell a friend

    Love Neowin? Tell a friend!