473,473 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hooks with C#

Hi,

I was looking at a sample for hooks -
http://www.codeproject.com/system/hooksys.asp, in particular at the part
where one .exe injects the code from a .dll into an external process. It
swaps the mouse buttons when clicking on windows "Start" button.

I'm trying to do install the hook from a C# program but it doesn't work. The
target program keeps dying and then I have to reboot windows because the
crash is pretty bad.

Has anyone done this before? Any pointers?
Apr 2 '07 #1
2 1740
>Has anyone done this before? Any pointers?
You can't implement global hooks in managed code (with the exception
of lowlevel keyboard and mouse hooks).
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 2 '07 #2
That is an article about using hooks with C++, not with C#. Here are a
couple of others:

http://www.codeproject.com/csharp/globalsystemhook.asp
http://www.codeproject.com/csharp/NetWin32Hooks.asp

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Oleg Mustiazza" <.wrote in message
news:eI**************@TK2MSFTNGP02.phx.gbl...
Hi,

I was looking at a sample for hooks -
http://www.codeproject.com/system/hooksys.asp, in particular at the part
where one .exe injects the code from a .dll into an external process. It
swaps the mouse buttons when clicking on windows "Start" button.

I'm trying to do install the hook from a C# program but it doesn't work.
The target program keeps dying and then I have to reboot windows because
the crash is pretty bad.

Has anyone done this before? Any pointers?

Apr 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: paul francis | last post by:
Hi Please help because I'm really stuck: I'm trying to write an application in C# which can be used to track the mouse pointer position on any window. I'm trying to use a Global mouse hook to...
5
by: Jim Hubbard | last post by:
I don't think you can hook system events outside your application in .Net without using an unmanaged DLL, but I thought I'd ask. Jim Hubbard
9
by: Chris Tacke, eMVP | last post by:
I'm not sure whether this is a C# or C++ question, so I'm asking in both groups. Here's my scenario: I need to get all text added to a ListBox that is in another process that I have no control...
0
by: yaktipper | last post by:
WH_JOURNALPLAYBACK and WH_JOURNALRECORD These hooks are difficult to get working in C#, but after much piecing together of various code snippets from different language examples across the Net,...
1
by: Jigar mehta | last post by:
Hye, How to create systemwide hooks for keyboard for keys like WIN, ALT+TAB, CTRL+ALT+DEL even when the application does not have the focus on it... Thanks,
3
by: cichy83 | last post by:
Hi! I have a problem with global hooks under these two OS. I'm using three following types of hooks: CBT Hokk, Keyboard Hook, Mouse Hooks. I'm using BCB 6, under Win XP everything works fine...
13
by: Hema | last post by:
hello all, I am working on a project related to Internet Explorer. I want my application to be invoked by a keypress( single key stroke or a combination). But this must get invoked only when the...
6
by: Mythran | last post by:
Is it possible to attach Windows WndProc hooks into a Console application window? Thanks, Mythran
0
by: effone | last post by:
I have two addins installed in my Outlook 2003, both have their specific functionality, I would like to integrate the functionality of both thru global mouse hooks, here is my senerio 1) Lets say...
0
by: ramon.talavera | last post by:
Hello, I am trying to read rawinput as I have to distinguish between two devices (mice), I have found several examples and I am able to detect Raw Input in the local window, but cannot...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.