473,513 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global Hook for Window Painting

I am trying to modify another application's window (Google Talk) to
insert some UI of my own. I think the best method would be to install a
remote local hook in gtalk's thread that intercepts the paint message
and injects the custom UI. From the reading I've done, it is possible
to install a system hook with an unmanaged stub that passes execution
off to a managed C# delegate
(http://www.codeproject.com/csharp/GlobalSystemHook.asp), but some
types of hooks don't work, including WH_GETMESSAGE, which seems like
the hook I would use to intercept the paint message. So I need some
advice:

- Are the rules for remote local hooks different from those for system
hooks?
- Is WH_GETMESSAGE the right hook type?
- Is there in fact a way to install all types of system hooks with
managed code?
- Is the paint message the right thing to hook?
- Are hooks even the answer to this problem?

I am venturing into unknown territory and any assistance would be
greatly appreciated.

May 28 '06 #1
2 4667
Lunchtimemama <lu***********@gmail.com> wrote:
I am trying to modify another application's window (Google Talk)
to insert some UI of my own. I think the best method would be
to install a remote local hook in gtalk's thread that intercepts the
paint message and injects the custom UI.


I'm not an expert on interop but I know enough of win32 to
tell you this: WM_PAINT is not the thing to hook.

The handler for WM_PAINT goes something like:

DeviceContext graphics;
BeginPaint(out canvas);
PaintHeaven(canvas);
PaintFlyingPig(canvas);
// if you want spots on the pig, do it here
EndPaint(canvas);

There is no easy way to do that. When hooking, you will
have a go before or after the app's own handle, but the
canvas will not be available.

You should consider putting your UI stuff in a separate
window and put it on top of the app.

HTH/Ole N.

May 29 '06 #2
Thanks for the advice. Q: What is the best way to monitor the target
window's creation/relocation/minimization/etc.?

May 30 '06 #3

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

Similar topics

3
12570
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...
0
2725
by: sharp | last post by:
I've done enough reading through the groups to know that a Global Keyboard hook is not possible via C# (.NET) itself. From what I have seen proposed is that you need to write a global hook in a...
3
4942
by: James | last post by:
Does anyone know if it is possible, in C#, to use a customized window frame? For example, programs like Winamp and AdAware do not use the standard box window frame, but a customized design. ...
0
1840
by: gekoscan | last post by:
Hello, http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/ I don't know if any of you are familiar with Dino Esposito article in MSDN magazine on .NET Hooks but I used the class he...
3
8398
by: june | last post by:
Hi, I am coding for an application with dialog window. I need intercept mouse input. I need catch raw input, pretty much everything for WM_INPUT: such as Left/Middle/Right button down/up,...
4
2187
by: msnews.micorsoft.com | last post by:
i want to receive a message when a window was activated. I use the WH_CBT type hook to process,the code is following: LRESULT CALLBACK CBTProc(int nCode,WPARAM wParam, LPARAM lParam) { HWND hWnd;...
0
2477
by: zeng.hui.stephen | last post by:
I download the demo http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/. I inherite the demo, and write my code. I want to use Hook to monitor C++ Edit change. I use a C# form...
0
2610
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...
2
2821
by: Alistair George | last post by:
Hi. Can assign global hotkeys, but I desire to have middle mouse button a global event, which instantiates a menu. However, Firefox, and a few other programs use the same button as well. I would...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
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
7535
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...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5085
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
3232
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
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.