Capture event for fingerprint reader in no active application - c#

I have an application that validates users through a fingerprint reader. The validation is done in a method that i subscribed to manage the event, it looks like this.
FingerprintVerificationControl.OnComplete+=new DPFP.Gui.Verification.VerificationControl._OnComplete(FingerprintVerificationControl_OnComplete);
Everything goes well while i'm woriking with the application, i mean, when it has the focus, but, i have put it in the system tray using a notifyicon control and associating it with a contextmenu control to restore and close the app; so when it is in the system tray (is not the active application) i have no response from the fingerprint to manage the validation; the event of read the finger of the user does not fires.
My question is, what is the best way to manage that? Is it possible?. I found that i can do it if i make a windows service, other sites say that with Win32 API, others have examples but with keyboard events like presss key and so on. Any idea? any idea would be thank.

I have found that making a Windows Service is the best way to do stuff like that. However I don't any about the windows32 API cause I've been able to do everything I can without it.
As for the keyboard events, I have tried those and have found that they only work when the application has focus therefore, they are unusable. And services are just useful in general. You can try to talk to your application from your service via the local network so you don't have to rework the entire application.
I hope this is helpful.

Related

How can I capture G-Key input using Logitech G-Key Macro SDK without focus?

I have implemented a check for G-Keys being pressed in a Windows Forms Application (C#) using the Logitech G-Key Macro SDK. Specifically using a wrapper class and the supplied LogitechGkeyEnginesWrapper.dll exactly as it suggests in the documentation (included in the SDK).
This works perfectly when my application has focus, and when any child windows have focus. I can check via a callback or an update call (as suggested in the docs) but neither work when my application does not have focus.
I am hoping to capture this input (of the G-Keys only) outside of application focus (global). I do not believe these keys send a scan code and the G-Key Macro SDK is required to get the state of this keyboard/mouse key.
Any help would be greatly appreciated. I have sent an email to Logitech Dev Support regarding this, but have not received anything back at this time.
Link to Logitech Developers page:
http://gaming.logitech.com/en-au/developers
After contacting Logitech G Developer support, they responded with the following:
You are correct in that the G-keys do not function when the application loses focus. There is currently no way around this, as our design rationale is that a third-party application should not be able to read the keystrokes of the current app in question.
So the scope of G-keys data is, by design, tied to the application in focus.

How to launch my C# application when any application starts in Windows 8?

I want to launch my application, like the windows security prompt, before any application is launched in Windows 8.
Is there any event handler, which gets notified whenever any application is launched?
My use Case : I want an App similar to a child lock(Lets call it myCustomApp).
When any user runs a game(say Solitare), i want myCustomApp to check the process name, and kill the process immediately.
P.S. : i am quite new to programming.
Thanks in advance!
Is there any event handler, which gets notified whenever any application is launched?
Yes: you get use WMI events to detect new instances of Win32_Process.
But these are created with process creation, not before.
Doing something between the call to ProcessCreate that creates the new process, and the process actually being created is going to be, at best hard (you might need to do it in the kernel), but quite possibly impossible.
Why do you want to do this? What problem are you trying to solve? This really does sound like an X-Y problem.
Edit:
The term you need to use is hook: the interception of some operation on windows. Eg. "Is it possible to hook the creation of windows globally so I can control where the windows are placed on the screen?"
There is a direct way in the kernel: PsSetCreateProcessNotifyRoutine
There are helpers in user mode (eg. EasyHook), but these require injected your code into each process (which anti-malware tools are likely to object to).
But you should still start out by looking for better approaches to you underlying problem.

How to Receive click location from another process with C#?

My C# application needs to receive a click position from another process, I then need to show on my app. But I don't know how I would implement it.
Could someone help me figure out how to do this?
Thanks so much
What you need is called a "Hook". Windows allows you to hook both the keyboard and mouse events. Basically windows works by injecting the appropriate movements and clicks of the mouse (and keys typed) into the application that has focus.
However using the hook, you receive all of the events, not just those relevant to your app. Once you have the hook established you can then do what you want with the information.
Note that you are going down to the windows OS and if you do the wrong thing here, you can leak the handles and you can also cause windows to get into a bad state.
There is a great tutorial here from MS Technet that describes how to do this in C#.

Capturing KeyPress Event in WIndow Service

I am trying to create a window service to create a small keylogger application. I am new to Windows services and my sole purpose is to learn.
How can I obtain all the events that are available in Winforms, but in a Windows service?
I've tried searching on Google, but I'm unable to find out how to do this. I'm getting many references to keyhook DLLs.
Windows Services are not form based therefore you cannot do it that way.... Have a look here for an example of how to create a Windows Service that kills other windows.
A window service is not an ideal spot to place a form on... think of a daemon under Linux/Unix variants - they do not have a graphical display nor interact with the user as such and hence would be 'headless' for want a word for it as there's no interaction whatsoever, and furthermore, a service would be running under a system service account....
Speaking of Keyloggers, it does not work like that - you need to hook into the global keyboard hook and intercept the keys, an example of such a thing is here.
But then the question will arise for what purpose, gather data, etc - possibly AV's will flag them as malware... If you are doing it for yourself - that's good...but to maliciously place it on another computer without that user knowing about it is very iffy and could end up in court for invasion of privacy, in terms of local laws etc.

Send keys to WPF Browser control

Can I programatically send [UserID]{TAB}[Password]{CARRIAGE RETURN} to a webbrowser control which has a userID, password and Sign-in button there. I wanted to use my own virtual keyboard in my application. Any tips here?
Sorry for the late answer but I've just finished a similar project and as part of the work am in the process of open sourcing two projects to Codeplex.
The first is the Windows Input Simulator which is a simple .NET wrapper around the Win32 SendInput written in C#.
The second is a very customisable on screen keyboard or touch screen keyboard control and toolkit called WpfKB and will be available as an initial release tomorrow. Hope these are of help to you or anyone else who comes across the projects.
I recently had to implement automatic authentication through a WPF browser control, and I looked into simulating keystrokes. I didn't need a full virtual keyboard so interacting with the DOM of the login page through IHTMLDocument2 ended up being the best approach, but I looked into keystroke automation before making that decision and found a few options.
You can raise the appropriate routed events on the control as described in Simulating basic keyboard events and Simulating text input. I don't know of any specific problems with this approach but I opted against it simply because I wasn't comfortable simulating input without looking at how the CLR handles the actual input, and without at least raising the complete lifetime (PreviewKeyDown, KeyDown, PreviewKeyUp, KeyUp) I was wary of unintended consequences.
Take a look at WOSK on CodePlex. It's a good example of how to invoke Win32 keybd_event and SendInput functions to generate the low-level input messages via Managed Windows API to simulate input. There's some unnecessary fluff (eg transparency) and some odd WPF usage, such as using a CommandParameter with a Click event instead of a Command on the buttons, but the general approach is sane and it's reasonably complete.
You can also invoke the windows on-screen keyboard as alluded to by Jeroen. I didn't try this because I didn't need a virtual keyboard, but if you're going to call into Win32 anyway, you might as well follow the WOSK model and build the UI the way you want it.

Categories