Solved

system wide hook

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Delphi Mdi application Child forms get behind control 7 270
find a node in VST 2 70
scroll down TListBox component in Delphi 1 19
Microsoft Access 97 and Delphi XE2 9 53
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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