|
Bonjour,
Windows NT/2000/Xp. My service is running but i want to make some actions when i move mouse in CTRL-ALT-DEL windows or when i hit a key on my keyboard.
How to do this ?
Please help.
Thanks.
|
|
|
|
|
phil63 wrote:
My service is running but i want to make some actions when i move mouse in CTRL-ALT-DEL windows or when i hit a key on my keyboard.
You want to to do something when Windows is displaying the login box? What do you mean by "OR when I kit a key"? When do you want this to happen? What do you want to happen?
Your service cannot interact with the keyboard and mouse since it is running on a different desktop, not the one your seeing on the screen.
RageInTheMachine9532
|
|
|
|
|
Dave Kreskowiak wrote:
Your service cannot interact with the keyboard and mouse since it is running on a different desktop, not the one your seeing on the screen.
Unless it's marked to interact with the desktop, in which case it either uses the desktop session (creates it if necessary) of the specified login (if the account has "Log in locally" rights), or the current desktop if logged in as LocalSystem (SYSTEM).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hye
"Your service cannot interact with the keyboard and mouse since it is running on a different desktop, not the one your seeing on the screen."
but this desktop may have a name because the system (gina ?) can intercept CTRL+ALT+DEL sequence and then display the winlogon dialog box.
And i have already seen, at work, a service witch do that and i know (developper said) it is without hook .
thanks
|
|
|
|
|
You're going to have to do it with the hook, unless you want to write your own GINA.DLL...
You could always ask the developer you know how he did it...
RageInTheMachine9532
|
|
|
|
|
"You could always ask the developer you know how he did it..."
He says that this tip is a little bit 'sensitive' so ...
But the hooks remain good idea i mean.
Thanks
|
|
|
|
|
You can use a system hook, although I warn you that poorly implemented code can lead to massive performance degradation.
See Using Hooks from C#[^] or any of the other articles[^] on using system hooks from .NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
In C++ you can use __asm{ -blocks for inline assembly language.
Is there a way to include inline IL assembly language in C# code? I can't find anything about asm- or ilasm-blocks in the documentation.
|
|
|
|
|
|
Nishant S wrote:
http://www.gotdotnet.com/team/csharp/learn/faq/
Clickety[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event[^].
|
|
|
|
|
C# does not yet support inline assembly code.
RageInTheMachine9532
|
|
|
|
|
Just a thought.... Does Managed C++ support it?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event[^].
|
|
|
|
|
Sure, it supports inline assembly, but NOT inline IL. I wasn't able to find anything on it...
RageInTheMachine9532
|
|
|
|
|
Why would you wan't to write IL code inside C# code? It gets translatated to IL, so I really don't see a benefit from doing this ...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hand optimization is the only reason I can think of...
RageInTheMachine9532
|
|
|
|
|
Dave Kreskowiak wrote:
Hand optimization is the only reason I can think of...
Without proper knowledge of the JIT, you can never be sure if your hand-optimized IL will be actually faster than the "compiled" one. Probably will be, but you can't be 100% sure...
I see dumb people
|
|
|
|
|
Don't have to tell me that. Writing IL by hand isn't the easiest thing in world to do since you have to keep in mind that the instructions don't translate one for one with machine instructions.
But, the only way to find out is to try...
RageInTheMachine9532
|
|
|
|
|
CWIZO wrote:
Why would you wan't to write IL code inside C# code?
C# (and all other high-level languages) supports only a subset of CIL capabilities.
|
|
|
|
|
C# gets translated, but not in a efficient way.
I want to reduce all those load/store instructions that occur at function calls. In a long loop I see quite big benefit...
|
|
|
|
|
I found the easiest is just to use ILDASM and then patch it. You can write a method patcher alternatively. An extended PE format is used that is quite easy to read/write.
|
|
|
|
|
all works well on my laptop but when i copy the exe and config and DLL to another pc it seems sqlserver wont let me in the config file holds the username and password to connect to the database. I get this error invalid token ID
|
|
|
|
|
You might want to try updating the MDAC components on the other machine. Get that here[^].
RageInTheMachine9532
|
|
|
|
|
|
The language is not dictating this. Your use of the SQL driver is. If the other machine doesn't have the appropriate drivers updated to a minimum level, specifically the SQL Server driver, communication with the server will be problematic.
RageInTheMachine9532
|
|
|
|
|
a thousand thankyous i will give it a try and let you know
|
|
|
|