By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,338 Members | 1,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,338 IT Pros & Developers. It's quick & easy.

Clipboard events in windows service

P: n/a
Hello,

I am trying to get clipboard events using SetClipboardViewer api.
It works in a windows form when i override the function:

protected override void WndProc(ref System.Windows.Forms.Message m)

that belongs to the base class System.Windows.Forms.

The problem is that i want to do it in a windows service...
Does someone knows how to get the clipboard events in a windows
service?

Thanks.

Jan 31 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you want to access the currently logged users clipboard, you cannot do it
directly from a service processes run on a different window station than the
interactive user. Every window station has it's own clipboard so the service
process would not see the users clipboard anyway.

Indirectly, you need to get the interactive user to start a "hidden" program
(could be a WinForms app w/o window) that then watches clipboard events and
uses named pipes/remoting etc. to comunicate with the service process.
Or, you could try to use CreateProcessAsUser Win32API to autostart the exe
but it could be tricky.

This link might be interesting:
http://msdn2.microsoft.com/en-us/library/ms683502.aspx.
<ye*****@gmail.comha scritto nel messaggio
news:11*********************@q2g2000cwa.googlegrou ps.com...
Hello,

I am trying to get clipboard events using SetClipboardViewer api.
It works in a windows form when i override the function:

protected override void WndProc(ref System.Windows.Forms.Message m)

that belongs to the base class System.Windows.Forms.

The problem is that i want to do it in a windows service...
Does someone knows how to get the clipboard events in a windows
service?

Thanks.

Jan 31 '07 #2

P: n/a
On Jan 31, 12:20 pm, "Laura T." <L...@NOWHERE.COMwrote:
If you want to access the currently logged users clipboard, you cannot do it
directly from a service processes run on a different window station than the
interactive user. Every window station has it's own clipboard so the service
process would not see the users clipboard anyway.

Indirectly, you need to get the interactive user to start a "hidden" program
(could be a WinForms app w/o window) that then watches clipboard events and
uses named pipes/remoting etc. to comunicate with the service process.
Or, you could try to use CreateProcessAsUser Win32API to autostart the exe
but it could be tricky.

This link might be interesting:http://msdn2.microsoft.com/en-us/library/ms683502.aspx.

<yevr...@gmail.comha scritto nel messaggionews:11*********************@q2g2000cwa.g ooglegroups.com...
Hello,
I am trying to get clipboard events using SetClipboardViewer api.
It works in a windows form when i override the function:
protected override void WndProc(ref System.Windows.Forms.Message m)
that belongs to the base class System.Windows.Forms.
The problem is that i want to do it in a windows service...
Does someone knows how to get the clipboard events in a windows
service?
Thanks.- Hide quoted text -

- Show quoted text -
Thank you very much.

Feb 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.