On-Screen Keyboard

I am trying to write a program similar to the Windows On-Screen Keyboard.

Background: Using System::Windows::Forms

TopMost has been set to true.

I notice that On-Screen Keyboard appears to be able to monitor keystrokes. How is monitoring keystrokes for a different window?

I am familiar with KeyDown, etc. But maybe not familiar enough.

Thanks!
closed account (Dy7SLyTq)
are you asking how to grab keystrokes no matter what window your in? because i could pm you the source for a key logger i made that does that and you can have it run in the background of your program
Keyloggers are fairly simple to create look at Global Hooks, these are very useful.

Source of a Global Hook:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<Windows.h>
#include <stdio.h>

HHOOK hHock = NULL;

LRESULT CALLBACK MyLowLevelHook ( int nCode , WPARAM wParam , LPARAM lParam)
{
    printf("Key press\n");
    return CallNextHookEx(hHock , nCode ,wParam , lParam);
}

int main()
{
    MSG msg;
    hHock = SetWindowsHookEx(WH_KEYBOARD_LL , MyLowLevelHook , NULL,NULL);

    while(!GetMessage(&msg, NULL, NULL, NULL)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    UnhookWindowsHookEx(hHock);
} 
}


All you do now is to capture Key-Strokes which is very basic.


Of course put the entry point as a DWORD then call it as a thread using CreateThread() then make the function read the return values and such in order to log and show keystrokes in a Visual perspective.

GL
closed account (Dy7SLyTq)
is it going to be flagged by av?
To DTSCode,

I would greatly appreciate the code! If there is a built-in way here to pm me, please do that. If not, let me know.
To SpaceWorm,

Now that I see that code, I think I, at minimum, read about it back in the Windows 3.1 days. TY
To DTSCode,

Is it going to be flagged by Anti-Virus software? If so, it isn't a problem. The software will only be used on my machine and my AV software will allow me to exclude checks on specified programs.

ty
To SpaceWorm,

That code isn't compatible with /clr:pure. Let me know if you have any ideas. Or, I will try to figure something out.

ty
Why the hell are you using windows forms to write a simple DLL ? Use C or C++ to write it using a shared memory segment, this way you get your hjook DLL automatically injected into every process running on the system.
To DTSCode,

I would greatly appreciate the code! I have enabled pm's.

ty
SpaceWorm,

That was very helpful. TY very much.
Topic archived. No new replies allowed.