Solved

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

Posted on 2000-04-26
5
157 Views
Last Modified: 2010-04-04
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
Comment
Question by:Traal
  • 2
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 20 total points
ID: 2754245
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
 
LVL 20

Expert Comment

by:Madshi
ID: 2754286
Call GetModuleFileName(GetModuleHandle(0), ...).

Regards, Madshi.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 2754638
GetModuleFileName(GetWindowLong(HWND(wPar),GWL_HINSTANCE),buf,256);

All hooks hand in a window handle.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2754646
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
 
LVL 2

Expert Comment

by:hhamster
ID: 2756895
following
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now