Solved

system wide hook

Posted on 2001-06-03
4
226 Views
Last Modified: 2010-04-06
I am using a system wide hook (CBT, Keyboard, and mouse), and therefore I had to write a DLL. When I first wrote this DLL I was having all kind of problems in Windows 95 (that was 3 years ago) until someone told me to compile the DLL with Delphi 2 (instead of Delphi 3 at the time).

I tried this again in Delphi 5 and still the same problem - some MPREXE violation occurs.

I wiuld continue to compile the DLL with D2, but now I have a different error that occurs with the DLL compiled with D2, but not with D5.

When compiling the DLL with D5, is there anything special I need to set for a DLL used as a hook?
0
Comment
Question by:sharons
[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
4 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 6150851
Delphi compiled DLLs do some things during the initialization, which may not be good for hooking. I have written a little utility which can modify the entry point of a DLL, so that it points to your first own exported function (index 1) instead of to Delphi's initialization. This might cure your problems. However, this kills the initialization of all the units. So it makes sense only for ultra-short hooking dlls, which don't need any unit initialization. The utility is available here:

www.madshi.net/hackDll.zip

Perhaps it's worth a try (if your dll is not too complicated)...

Regards, Madshi.
0
 

Expert Comment

by:moonrise
ID: 6150937
Thank you - I have found the solution with

  Set8087cw($133f);

0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 8891054
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/refund of points

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Robert Marquardt
EE Cleanup Volunteer
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 8978800
Force accepted

** Mindphaser - Community Support Moderator **
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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

724 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