473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Launch WinApp from Keyboard press

Hi

I am in need of a way to launch my WinForms-app (app.exe) just by pressing a
keyboard combination like (Ctrl-Alt-P).
This functionality should be present "out of the box" after the app
(app.exe) is deployed on the Client's PC. The only way I know - is to place
a shortcut on the desktop and associate a "ShortCut Key" to it by
right-clicking on the shorcut on the desktop.

Now - how do I, do that during installation using Windows Installer (from
VS.NET 2003)??

Thanks a million!

/Ole Hanson
Nov 16 '05 #1
13 3317
Ole Hanson wrote:
Hi

I am in need of a way to launch my WinForms-app (app.exe) just by pressing a
keyboard combination like (Ctrl-Alt-P).
This functionality should be present "out of the box" after the app
(app.exe) is deployed on the Client's PC. The only way I know - is to place
a shortcut on the desktop and associate a "ShortCut Key" to it by
right-clicking on the shorcut on the desktop.

Now - how do I, do that during installation using Windows Installer (from
VS.NET 2003)??

Thanks a million!

/Ole Hanson


I'm interested in the same question. Only I was looking for assigning my progmra to a key like Print Screen.
I doubt its possible though. Maybe there is some registry setting.
Otherwise the program has to be running you have register a hotkey, so messages are sent to the application.
I guess you could make a very small service that does that and then launches the main application.
My program takes around 13mb of memory to stay open, its not something I could afford starting with the computer.
Nov 16 '05 #2
There is no direct way of specifying the Shortcut key for an exe in the
setup project.

Try this

Create a c# project to create a Shell Link for your EXE. You can specify the
shortcut key while creating Shell Link in the program.

After compiling the program, add the C# program as a "Custom action" in the
"custom action editor"

To create Shell link in c# use the interface specified in the following URL

http://www.vbaccelerator.com/home/NE...jects/Creating
_and_Modifying_Shortcuts/ShellLink_Code_zip_ShellLink%5CShellLink_cs.asp

--
Shak
(Houston)
"Ole Hanson" <ol********@ole.ole> wrote in message
news:cc**********@news.cybercity.dk...
Hi

I am in need of a way to launch my WinForms-app (app.exe) just by pressing a keyboard combination like (Ctrl-Alt-P).
This functionality should be present "out of the box" after the app
(app.exe) is deployed on the Client's PC. The only way I know - is to place a shortcut on the desktop and associate a "ShortCut Key" to it by
right-clicking on the shorcut on the desktop.

Now - how do I, do that during installation using Windows Installer (from
VS.NET 2003)??

Thanks a million!

/Ole Hanson

Nov 16 '05 #3
You should also look into global hooks:
http://www.codeproject.com/csharp/globalhook.asp

One solution is to install a global hook and have your application run in
the background (maybe even as a service that runs at startup). The hook
could then launch the main window of the application.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Ole Hanson" <ol********@ole.ole> wrote in message
news:cc**********@news.cybercity.dk...
Hi

I am in need of a way to launch my WinForms-app (app.exe) just by pressing a keyboard combination like (Ctrl-Alt-P).
This functionality should be present "out of the box" after the app
(app.exe) is deployed on the Client's PC. The only way I know - is to place a shortcut on the desktop and associate a "ShortCut Key" to it by
right-clicking on the shorcut on the desktop.

Now - how do I, do that during installation using Windows Installer (from
VS.NET 2003)??

Thanks a million!

/Ole Hanson

Nov 16 '05 #4
John Wood wrote:
You should also look into global hooks:
http://www.codeproject.com/csharp/globalhook.asp

One solution is to install a global hook and have your application run in
the background (maybe even as a service that runs at startup). The hook
could then launch the main window of the application.


Thank you for that link. Its EXACTLY what I was looking for. A tiny monitoring servie that can be enabled diabled from other apps
through public methods. AND it satisfy my other need for global mouse hooks. Thanks a lot.

Nick Z.
Nov 16 '05 #5
>> > My program takes around 13mb of memory to stay open, its not something
I could afford starting with the computer. <<

When you say this, are you referring to the impact it would have at startup?
(ie. time to start windows?). This shouldn't be so long if you're not
referencing many assemblies (especially try to miss out winforms if you
can).

Or are you referring to the memory overhead always present when the
application is running? Because the latter shouldn't be a problem as the
application will likely be paged out.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Nick" <pa*****@optonline.net> wrote in message
news:R5*********************@news4.srv.hcvlny.cv.n et...
Ole Hanson wrote:
Hi

I am in need of a way to launch my WinForms-app (app.exe) just by pressing a keyboard combination like (Ctrl-Alt-P).
This functionality should be present "out of the box" after the app
(app.exe) is deployed on the Client's PC. The only way I know - is to place a shortcut on the desktop and associate a "ShortCut Key" to it by
right-clicking on the shorcut on the desktop.

Now - how do I, do that during installation using Windows Installer (from VS.NET 2003)??

Thanks a million!

/Ole Hanson
I'm interested in the same question. Only I was looking for assigning my

progmra to a key like Print Screen. I doubt its possible though. Maybe there is some registry setting.
Otherwise the program has to be running you have register a hotkey, so messages are sent to the application. I guess you could make a very small service that does that and then launches the main application. My program takes around 13mb of memory to stay open, its not something I

could afford starting with the computer.
Nov 16 '05 #6
Yeah it's a great article and library... especially seeing as all the .net
documentation says it's not possible to have global hooks. Sometimes it's
best not to believe what everyone tells you...

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Nick" <pa*****@optonline.net> wrote in message
news:RI*********************@news4.srv.hcvlny.cv.n et...
John Wood wrote:
You should also look into global hooks:
http://www.codeproject.com/csharp/globalhook.asp

One solution is to install a global hook and have your application run in the background (maybe even as a service that runs at startup). The hook
could then launch the main window of the application.

Thank you for that link. Its EXACTLY what I was looking for. A tiny

monitoring servie that can be enabled diabled from other apps through public methods. AND it satisfy my other need for global mouse hooks. Thanks a lot.
Nick Z.

Nov 16 '05 #7
John Wood wrote:
My program takes around 13mb of memory to stay open, its not something


I could afford starting with the computer. <<

When you say this, are you referring to the impact it would have at startup?
(ie. time to start windows?). This shouldn't be so long if you're not
referencing many assemblies (especially try to miss out winforms if you
can).

Or are you referring to the memory overhead always present when the
application is running? Because the latter shouldn't be a problem as the
application will likely be paged out.


I was reffering to both. Startup especially.
What do you mean by it being paged out?
Nov 16 '05 #8
Just an idea that will NOT have anything running in the background consuming
memory.

By writing a small JScript file and the ShellObject (IShell), one can grap
hold of the shortcuts on the users desktop and here assign a "HotKey" (same
as Shorcut Key). This JScript file can be executed on the Commit Event from
the Windows Installer Package (known as Custom Actions). In this way - the
key combination of my desire is associated with the shortcut to my program
directly within the operating system.

/Ole Hanson


"Nick" <pa*****@optonline.net> wrote in message
news:RI*********************@news4.srv.hcvlny.cv.n et...
John Wood wrote:
You should also look into global hooks:
http://www.codeproject.com/csharp/globalhook.asp

One solution is to install a global hook and have your application run in
the background (maybe even as a service that runs at startup). The hook
could then launch the main window of the application.


Thank you for that link. Its EXACTLY what I was looking for. A tiny
monitoring servie that can be enabled diabled from other apps through
public methods. AND it satisfy my other need for global mouse hooks.
Thanks a lot.

Nick Z.

Nov 16 '05 #9
Paged out... in simple terms, the application's virtual memory is written
out to disk (paged out) and freed. When anything tries to access that
memory, it's paged back in and re-allocated.. this happens when you don't
touch an application for like 10 minutes, for example. Basically it means
you don't really have to worry about the memory consumption of an
application that is infrequently used.

The startup penalty can be somewhat removed if you limit the assembles that
are loaded. The WinForms assembly, in particular, has a big penalty in
startup time.

In my application, for example, I have a proxy loader, referencing minimal
assembles... a small executable that uses the Win32 API directly to display
a splash screen, and then load the larger executable that uses
Windows.Forms.

The benefit being that startup time at least appears to be faster (or more
responsive).. better than sitting there wondering what's happening while
it's loading.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Nick" <pa*****@optonline.net> wrote in message
news:6%*********************@news4.srv.hcvlny.cv.n et...
John Wood wrote:
>My program takes around 13mb of memory to stay open, its not something


I could afford starting with the computer. <<

When you say this, are you referring to the impact it would have at startup? (ie. time to start windows?). This shouldn't be so long if you're not
referencing many assemblies (especially try to miss out winforms if you
can).

Or are you referring to the memory overhead always present when the
application is running? Because the latter shouldn't be a problem as the
application will likely be paged out.


I was reffering to both. Startup especially.
What do you mean by it being paged out?

Nov 16 '05 #10
Ole Hanson wrote:
Just an idea that will NOT have anything running in the background consuming
memory.

By writing a small JScript file and the ShellObject (IShell), one can grap
hold of the shortcuts on the users desktop and here assign a "HotKey" (same
as Shorcut Key). This JScript file can be executed on the Commit Event from
the Windows Installer Package (known as Custom Actions). In this way - the
key combination of my desire is associated with the shortcut to my program
directly within the operating system.

/Ole Hanson


"Nick" <pa*****@optonline.net> wrote in message
news:RI*********************@news4.srv.hcvlny.cv.n et...
John Wood wrote:
You should also look into global hooks:
http://www.codeproject.com/csharp/globalhook.asp

One solution is to install a global hook and have your application run in
the background (maybe even as a service that runs at startup). The hook
could then launch the main window of the application.


Thank you for that link. Its EXACTLY what I was looking for. A tiny
monitoring servie that can be enabled diabled from other apps through
public methods. AND it satisfy my other need for global mouse hooks.
Thanks a lot.

Nick Z.



I was thinking of that but my main concern is the fact that the shortcut key has to be something like
Alt+Ctr+N meaning its not as direct as simply pressing Print Screen or simply N. Or am I wrong.
Nov 16 '05 #11
John Wood wrote:
Paged out... in simple terms, the application's virtual memory is written
out to disk (paged out) and freed. When anything tries to access that
memory, it's paged back in and re-allocated.. this happens when you don't
touch an application for like 10 minutes, for example. Basically it means
you don't really have to worry about the memory consumption of an
application that is infrequently used.

The startup penalty can be somewhat removed if you limit the assembles that
are loaded. The WinForms assembly, in particular, has a big penalty in
startup time.

In my application, for example, I have a proxy loader, referencing minimal
assembles... a small executable that uses the Win32 API directly to display
a splash screen, and then load the larger executable that uses
Windows.Forms.

The benefit being that startup time at least appears to be faster (or more
responsive).. better than sitting there wondering what's happening while
it's loading.


An interesting bit of information, thank you.
However, the assembles that are loaded are mandatory in my application.

And the way I wish to be running the application is.
----
Monitoring service is running in the back.
When key combo detected, launches main app, stops monitoring.
My app *quickly* opens and does its job, enables monitoring service, closes.
----

The following assemblies are referenced in my main application.

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX.AudioVideoPlayback;
Which is quite alot I think.
I was wondering if there is a performance, startup, memory usage, difference to using this instead of referencing a whole
assembly. For example if I need the Device object from DirectX assembly. I do this in code.

---
//not sure if thats the right path, but you get the idea.
Microsoft.DirectX.Device myDevice;
---

Instead of using Microsoft.DirectX;. But I suppose the compiler does that for me. Am I correct?

Nick Z.
Nov 16 '05 #12
Yeah there's not much difference between referencing classes with the fully
qualified namespace, and just putting the 'using' clause at the top of the
file. At the end of the day, if the project contains a reference to the
assembly, it'll be loaded.

Probably the largest of those assemblies would be the directx ones. Is even
the directx assembly used immediately in your application? The good thing
about .net is that it lets you dynamically load assemblies.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Nick" <pa*****@optonline.net> wrote in message
news:i8*********************@news4.srv.hcvlny.cv.n et...
John Wood wrote:
Paged out... in simple terms, the application's virtual memory is written out to disk (paged out) and freed. When anything tries to access that
memory, it's paged back in and re-allocated.. this happens when you don't touch an application for like 10 minutes, for example. Basically it means you don't really have to worry about the memory consumption of an
application that is infrequently used.

The startup penalty can be somewhat removed if you limit the assembles that are loaded. The WinForms assembly, in particular, has a big penalty in
startup time.

In my application, for example, I have a proxy loader, referencing minimal assembles... a small executable that uses the Win32 API directly to display a splash screen, and then load the larger executable that uses
Windows.Forms.

The benefit being that startup time at least appears to be faster (or more responsive).. better than sitting there wondering what's happening while
it's loading.

An interesting bit of information, thank you.
However, the assembles that are loaded are mandatory in my application.

And the way I wish to be running the application is.
----
Monitoring service is running in the back.
When key combo detected, launches main app, stops monitoring.
My app *quickly* opens and does its job, enables monitoring service,

closes. ----

The following assemblies are referenced in my main application.

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX.AudioVideoPlayback;
Which is quite alot I think.
I was wondering if there is a performance, startup, memory usage, difference to using this instead of referencing a whole assembly. For example if I need the Device object from DirectX assembly. I do this in code.
---
//not sure if thats the right path, but you get the idea.
Microsoft.DirectX.Device myDevice;
---

Instead of using Microsoft.DirectX;. But I suppose the compiler does that for me. Am I correct?
Nick Z.

Nov 16 '05 #13
John Wood wrote:
Yeah there's not much difference between referencing classes with the fully
qualified namespace, and just putting the 'using' clause at the top of the
file. At the end of the day, if the project contains a reference to the
assembly, it'll be loaded.

Probably the largest of those assemblies would be the directx ones. Is even
the directx assembly used immediately in your application? The good thing
about .net is that it lets you dynamically load assemblies.


Hmmm. Thats a good idea. The dx assembly will not be even used MOST of the time. I dindn't even know it was possible.

Thanks.
Nick Z.
Nov 16 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: asdasd | last post by:
Hello there, I'm hoping someone might be able to help me out. Its been awhile since I've programmed in visual basic (and roughly at that)... I want to create a program that will allow me to...
11
by: Pelo GANDO | last post by:
Hi everybody, It's me again...Pelo, for an other beginner question... What the code should be in C++ to wait for a keyboard entry in order to execute the sequal of my program...
1
by: Stefan | last post by:
I'd like to display the keyboard navigation indicators in my C# application without the user having to press the Alt key and regardless of the machines global setting (Hide keyboard navigation...
7
by: Paul | last post by:
Hi. I need to launch a windows application and then send keyboard event to this process to run certain commands. I've created a COM+ appplication to spawn and talk to the application which works...
0
by: Nuno | last post by:
Hello, I'm new on C# and i'm trying to implement a control that traps a certain sequence of keys to use for shortcut key functionality like the one used in the the...
4
by: Melson | last post by:
Hi Can anyone help. I would like to replace the keys on the PC keyboard. For example, when I press Q button it displays A on the screen in any programs (MS Words, Note, Lotus....). And also when...
0
by: Fromethius | last post by:
Hi everyone. For the past day I've been trying to find a good way to handle keyboard input. Naturally, I wanted to just use WM_KEYDOWN and WM_KEYUP to handle my events, but they proven to have...
6
by: AhmedGY | last post by:
Hi, I'm new to C#, and doing a simple calculator application, it's completed now and calculates well, i wanna provide the interface with hotkeys so when the user press a number lets say "1" on the...
5
by: bint | last post by:
Please help. Trying to just get simple keyboard input from a C program. Ideally would like to be able to just press a key without having to press return, but at this point I don't care anymore. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.