Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Getting the name of program/thread that called keyboard hook.

How do I go about finding out which program called my keyboard hook procedure?  What if there are no applications running, how does the OS (W98) identify itself?
0
Traal
Asked:
Traal
  • 2
  • 2
1 Solution
 
robert_marquardtCommented:
The hook DLL is docked to the program. The DLL is now part of this program. Use the standard Win32 function to get the exe name in the DLL. That works for me and a shell hook. There is always a program running. at least the system itself. Sometimes you will get a DLL name especially for an explorer window.
0
 
MadshiCommented:
Call GetModuleFileName(GetModuleHandle(0), ...).

Regards, Madshi.
0
 
robert_marquardtCommented:
GetModuleFileName(GetWindowLong(HWND(wPar),GWL_HINSTANCE),buf,256);

All hooks hand in a window handle.
0
 
MadshiCommented:
I prefer my suggestion, simply because you don't need a window handle for it. In keyboard hook dlls you often don't have a window handle.
0
 
hhamsterCommented:
following
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now