Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Windows Forms Apps with Task Bar Icons / Shortcut Linking

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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

860 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