Since the question is "Is there a way to get in which application the user is typing the captured key strokes?" I'd say use HWND WINAPI GetForegroundWindow(void);
For example:
char cWindow[MAX_PATH];
GetWindowTextA(GetForegroundWindow(), cWindow, sizeof(cWindow));
In cWindow you get the title of the window in which the user is typing.