Solved

Windows Forms Apps with Task Bar Icons / Shortcut Linking

Posted on 2011-09-25
4
360 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now