Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalregister vs other types Pin
Ares218-Dec-03 23:04
Ares218-Dec-03 23:04 
GeneralRe: register vs other types Pin
Mike Beckerleg18-Dec-03 23:27
Mike Beckerleg18-Dec-03 23:27 
GeneralRe: register vs other types Pin
jmkhael18-Dec-03 23:27
jmkhael18-Dec-03 23:27 
GeneralRe: register vs other types Pin
Ares218-Dec-03 23:36
Ares218-Dec-03 23:36 
GeneralRe: register vs other types Pin
Prakash Nadar19-Dec-03 0:10
Prakash Nadar19-Dec-03 0:10 
GeneralRe: register vs other types Pin
Michael Dunn19-Dec-03 6:51
sitebuilderMichael Dunn19-Dec-03 6:51 
GeneralKeystroke log in a service Pin
De Nardis Andrea18-Dec-03 21:58
De Nardis Andrea18-Dec-03 21:58 
GeneralRe: Keystroke log in a service Pin
Robert Kuster19-Dec-03 1:09
Robert Kuster19-Dec-03 1:09 
> ..so basically I think this service should grab any keystrokes in any desktop
Not at all. Smile | :)
To grab keystrokes you have to call the SetWindowsHookEx API. Problem: SetWindowsHookEx resides in user32.dll and user32 functions are generally bound to a specific desktop. Because most services don't run under the logged-on user account you won't be able to grab the keystrokes of the loged-on user either (nor the keystrokes of any other desktop, like WinLogon for example) - at least not directly.

Fortunately there are two exceptions to the above rule:

1. Services running under the local System account can be made interactive. In other words, they can interact with the user and thus grab its keystrokes too. But this way you will only grab the keystrokes of the loged-on users desktop -> it's the same as if you would make an ordinary win32 exe right away.

2. You can "connect" a (service) thread to a desktop via SetThreadDesktop. Knowing this, you could try on of the following:

a) Spawn a new thread for each desktop that is present on the system; then call SetThreadDesktop and SetWindowsHookEx from within each thread.

b) Since there is only one interactive desktop (=desktop, that receives the user input) at any time, simply call SetThreadDesktop and SetWindowsHookEx always when the active desktop gets switched.

Note: This were just presumptions from the top of my head -> for the exact behavior/terminology and implementation check the MSDN documentation.

RK
GeneralRe: Keystroke log in a service Pin
De Nardis Andrea19-Dec-03 3:21
De Nardis Andrea19-Dec-03 3:21 
Questionhow to use two socket Pin
yingkou18-Dec-03 21:44
yingkou18-Dec-03 21:44 
AnswerRe: how to use two socket Pin
erkanina19-Dec-03 3:13
erkanina19-Dec-03 3:13 
Generalactivex problem Pin
satadru18-Dec-03 20:00
satadru18-Dec-03 20:00 
GeneralRe: activex problem Pin
Monty218-Dec-03 20:31
Monty218-Dec-03 20:31 
GeneralRe: activex problem Pin
satadru18-Dec-03 21:25
satadru18-Dec-03 21:25 
GeneralRe: activex problem Pin
Michael P Butler18-Dec-03 20:39
Michael P Butler18-Dec-03 20:39 
GeneralRe: activex problem Pin
Prakash Nadar18-Dec-03 21:13
Prakash Nadar18-Dec-03 21:13 
GeneralRe: activex problem Pin
satadru18-Dec-03 21:26
satadru18-Dec-03 21:26 
QuestionHow to handle windows messages in COM Exe server? Pin
Prakash Nadar18-Dec-03 19:54
Prakash Nadar18-Dec-03 19:54 
AnswerRe: How to handle windows messages in COM Exe server? Pin
Monty218-Dec-03 20:25
Monty218-Dec-03 20:25 
GeneralRe: How to handle windows messages in COM Exe server? Pin
Prakash Nadar18-Dec-03 21:11
Prakash Nadar18-Dec-03 21:11 
AnswerRe: How to handle windows messages in COM Exe server? Pin
John R. Shaw18-Dec-03 21:06
John R. Shaw18-Dec-03 21:06 
Generaldrawing from doc Pin
R. Thomas18-Dec-03 19:25
R. Thomas18-Dec-03 19:25 
GeneralRe: drawing from doc Pin
Monty218-Dec-03 19:47
Monty218-Dec-03 19:47 
GeneralRe: drawing from doc Pin
R. Thomas18-Dec-03 20:02
R. Thomas18-Dec-03 20:02 
GeneralRe: drawing from doc Pin
Monty218-Dec-03 20:21
Monty218-Dec-03 20:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.