Solved

Windows Forms Apps with Task Bar Icons / Shortcut Linking

Posted on 2011-09-25
4
379 Views
Last Modified: 2012-05-12
Hello all.

I have a C# Windows Forms application that I've developed. The program is launcher with a launcher, which does some updating, etc.

My current issue is that once the program starts running, the user can pin the Application to the Windows Task Bar, which would then allow them to run the program directly, bypassing the Launcher.

Is it possible for me to some how make it so that no matter what, the launcher is always run first?
0
Comment
Question by:Dragonseer
  • 2
  • 2
4 Comments
 
LVL 40
ID: 36597325
The launcher could create a temporary file or an entry in the Windows registry.

When the application starts, it would check for the presence of that file or registry entry.

If found, the application would delete it and start normally.

If not found, it would mean that the application was started directly. You could then display a message telling the user to start from the launcher and abort the application.
0
 
LVL 8

Expert Comment

by:jagrut_patel
ID: 36598126
Please explain how pinning a program to the taskbar can affect lifecycle events of a Forms application.

As I understand if a program is pinned to the taskbar, the program's icon stays there in the taskbar even after application is closed. Thus, user can easily restart the same application just by clicking that icon in the taskbar. It is like a shorcut link to the application.
0
 
LVL 40
ID: 36599587
@jagrut_patel

This is exactly the question. He does not want a user to be able to start the application from a shortcut link.

He want the user to always use a launcher application, that will set up a few things before launching the application.
0
 
LVL 8

Accepted Solution

by:
jagrut_patel earned 500 total points
ID: 36708443
Thanks @JamesBurger for explaination. I could have never understood actual problem from the original description of the question.

"My current issue is that once the program starts running, the user can pin the Application to the Windows Task Bar, which would then allow them to run the program directly, bypassing the Launcher. "

That was a cryptic statement for me to understand without your explaination! Thanks again.

======================================================

So here we have two separate programs: One is Launcher and another one is a WinForm Application. Problem is to ensure that Launcher is always executed no matter how the WinForm Application is started.

How about starting the Launcher program from the Form Load event of the WinForm application. If Launcher is an executable then one can use Process class to launch it. To ensure that no action is possible in WinForm app until Launcher has completed its task we keep UI of WinForm application disabled. Periodically check (may be using Timer) whether Launcher is done. If so then enable the UI of WinForm application.

0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question