469,645 Members | 1,424 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

a "Global" application - is this possible?

I am currently working on a project that I am interested in porting to Win32
or .NET, but I don't know where to get started. I have quite a bit of
experience with MFC, and I have been working with C# for the last few months
and I feel like if I know where to start looking, I can do this.

The current app is for Mac OS X and is being built with Cocoa and
Objective-C. Bascially, it is a system service that allows users to paste
things to the system clipboard and then the service performs work on that
data. The service can be triggered easily by pressing a cntrl-shift-<key>
combo.

I have been reading the .NET 2.0 docs and the Win SDK for a couple of hours,
and I am not sure if what I want to do is possible in Windows though. The
best thing would be for the user to copy the data to the clipboard, and then
press a key-board combo to notify the service. It seems like I cannot do
this though, as the key events are specific to the WinForm in which they are
triggered. Is it possible to intercept these? Would this be considered a
security issue? If so, what could I do to achieve this type of functionality?

I would love for the user to be able to do copy some data from Internet
Explorer or any other third-party app, and then with a key-combo be able to
call my service to handle that copied data.

What is the proper way to attain this type of behavior in .NET or Win32?
Thank you for your time and help.
Mar 6 '06 #1
2 1125
> ... it is a system service that allows users to paste
things to the system clipboard and then the service performs work on that
data. The service can be triggered easily by pressing a cntrl-shift-<key>
combo.


First, I don't think you need a service. Your app reads user supplied data
on the clipboard which is meaningful only if a user is signed on. If that is
true, then an ordinary app that runs when a user signs on and quits when the
user signs off should suffice. This app does not need to present a gui to
the user - it just needs to be running.

Second, there are two general activation techniques like you described,
namely a global hot key and a global hook. Search for "global hot key"
and/or "SetWindowsHookEx" for some info. I have no experience with either,
but global hot key looks promising. These are win32 items, and I'm unaware
of any support for them in .net (I use 1.1, maybe there is something in 2.0).

An alternative activation approach would be a tray icon program and the
mouse. The user would put something on the clipboard and then click an icon
typically in the lower right corner of his screen. The icon is tied to a
program of yours (what you have been calling a service), and the click is
enough to activate it (one click operation). If you need options, the click
could cause a short menu to pop up, and the user selects his option (two
click operation). There is support in .net for this kind of thing.

Mar 6 '06 #2
Thanks so much for the pointers, I will check hot the global hot key. You
are right it does not need to be a service, that would be a bit overkill.
Since the hot key is Win32, I guess I will switch to MFC/Win32 for this app.
Thanks again for the help!

Mar 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by mrbog | last post: by
3 posts views Thread by Ernesto | last post: by
2 posts views Thread by Sir Psycho | last post: by
4 posts views Thread by =?Utf-8?B?QWxleCBNdW5r?= | last post: by
1 post views Thread by Tom Berger | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.