Solved

system wide hook

Posted on 2001-06-03
4
223 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
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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 183
Run video youtube webbrowse 10 73
shape, triangle, dbctrlgrid 3 31
FMX TEdit KeyUp handler detecting  "enter" key 4 35
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 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