Solved

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

Posted on 2000-04-26
5
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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