473,796 Members | 2,712 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 4711
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(can vas);
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
12603
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 do this but with limited success. According to the documentation (as I understand it) you can only do Global hooks in ..Net if the delegate procedure passed to SetWindowsHookEx is external.
0
2757
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 C++ dll and PInvoke that dll. Well, I'm not a C++ dev but need to get a global hook from C#. Are there any samples anywhere on how to write the C++ hook and use it from C#?
3
4968
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. I'm guessing that this is a bitmap that is somehow applied with an API call? Thanks!
0
1869
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 created named LocalWindowsHook that imports the below API calls protected static extern IntPtr SetWindowsHookEx(HookType code, HookProc func,
3
8431
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, srcoll/wheel, pull and drag, device source. I checked SetWindowsHookEx, it seems it can't catch so much infor, only LButton RButton Down/Up? What function should I use or maybe I should ask how to hook Dialog box message Proc? Thanks
4
2200
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; if(nCode < 0) return CallNextHookEk(hHook,nCode,wParam,lParam); if(nCode == HCBT_ACTIVATE) {
0
2494
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 containing a Edit(textbox) and button to test at first. When I change text in Edit or press button to setText value, I want to monitor the change event. But the event code always return 0, why?
0
2667
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 intecept raw input messages in other windows, so I cannot track the mouse as soon as another window catches the mouse focus.
2
2831
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 like to be able to check if the current visible form (not my program) is using this key/button and if so, the event is not hooked by myprogram. Any pointers? Thanks, Alistair.
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.