Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello i am trying to implement a global system hook into my app(its to monitor keyboard input system wide, and to just experiment with hooking).
i am following this article: Using Window Messages to Implement Global System Hooks in C#[^]
now my problem is that when i run the sample application i get 3 errors in the output box saying:

1.Error 3 error LNK1123: failure during conversion to COFF: file invalid or corrupt C:\Users\dainen\Downloads\SystemHooks\SystemHookCore\LINK SystemHookCore

I am trying to build this on Windows 7 Ultimate X-64 platform, I am also using Visual Studio 2010 Premium.
i have read that there could be a processor mismatch in the build configs for both projects so i have set all of the projects to X86 and that did not solve the problem, so then i set all the projects to X64, that didn't fix it either so whats wrong?
sorry if i am not very clear.
thanks for all of your help in advance.
Posted
Updated 18-Dec-14 5:23am
v5

1 solution

I hope this response will help you along the way, although I can't promise you it will address the problem.

First, some general advice about re-using code from CodeProject articles:

1. first download the author's sample demo (if the article has one), and source code; confirm the sample demo runs on your OS version/machine without error.

2. open a Project using the author's source: confirm it will build and run on your OS/machine.

3. then verify the author's source will build and run if you change settings like 32/64, or re-compile in the version of Visual Studio you want to use.

If all of the above are okay, then adapt the author's code, add your own, test, debug.

If you didn't get this far, then go back to the article, read the comments carefully: there is a very good chance someone else may have posted a similar problem, and the author, or others, may have replied with good suggestions.

In your case, take a look at this comment thread on the article: [^], which I think may be relevant to your problem.

And do post your own comment, or response to other comments: it never hurts to ask !

Finally, if you just can't get it to work, and can't get help, consider looking around in CodeProject for other solutions of the same type: there are several GlobalHook articles here. The one I recommend is by George Mamaladze (just search).

Unfortunately, when you are working with Global Hooks you are "coding outside the box" of .NET, using API's, and debugging is going to be a problem.
 
Share this answer
 
Comments
MasterCodeon 18-Dec-14 11:17am    
i found the article you where talking about but how would i get all the messages that applications are sending(like Spy++ but using a Global Hook)
the article works for my by the way.
thank you!
MasterCodeon 18-Dec-14 11:22am    
i have tried the demo app from the article that i was trying to use and it didn't work.
when i clicked the button to initialize the hook it would say it activated the hook but it wouldn't receive any messages(maybe i don't quite understand what the hook does? or what kind of messages its supposed to recive?)
so whats going wrong?
BillWoodruff 18-Dec-14 12:33pm    
It can't hurt to post a question on the article, although if you see there's been no response to questions for a long time, your chance for any answer may be small.

I know that George Mamaladze has been a real example of someone who has supported his (GlobalHook) code for years; I used his code a few years ago, but have not used it since.
MasterCodeon 18-Dec-14 12:44pm    
ok i shall do so, but the last question asked on the article was june of this year so i don't think i am going to get a response anytime soon.
thanks for your help,
MasterCodeon
BillWoodruff 20-Dec-14 1:07am    
Consider trying Mamaladze's GlobalHook, and post a question on his article if you encounter the same problem ?

cheers, Bill

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900