c# - How to draw graphics/text on top of another application -


I want to extend an application, but no 3: e-party API is available. So basically the idea is to draw graphics / text at the top of the application window.

There are problems in giving zoom order, clearing and mouse clicks to my application or other applications.

What is a great way to do this?

The example image here is a business application where my application wants to add additional information in the window of the trading application. [Url =

There are no good ways to do this, but an approach that works for you To add GetMsgProc to hook the application in question using SetWindowsHookEx (...), which draws your overlays in response to WM_PAINT messages. The basic idea is that you are ending your drawing app immediately after portraying your graphic.

In your main app:

  .... HMODULE hDllInstance = LoadLibrary ("myFavoriteDll"); Hookpark Powerloo Hook = (Hokaprosey) Getproof Acadder (H.Delence, "Overlay Hook"); SetWindowsHookEx (WH_GETMESSAGE, pOverlayHook, HDL instance, thread ID);  

Somewhere in a DLL:

  Try the LRESULT callback overlay hook (int code, VARAM WPARM, LAPRAM LPARM) and try Reply WM_PAINT messages; // Of course, if any other application tries that all these bets are closed then LRESULT retCode = CallNextHookEx (NULL, code, wParam, lParam); // GetMsgProc documentation, do not fancy anything if (code & lt; 0) return retcode; // Assume that the target application is retraced only when WM_PAINT messages are extracted from the // Input queue (wParam == PM_NOREMOVE); MSG * Message = (MSG *) ElPiram; // If there is no paint request, then do not ignore everything (message-> Message! = WM_PAINT) Return the return count; Paint pspaint; StartPant (Message-> HWND, and PeacePoint); // Draw your overlay here ... endpaint (message-> hwnd, and peeppaint); Return ratecode; }  

This is all Win32, so your C # code will be P / Invov and accordingly will be quite ugly. Your DLL should also be unmanaged (if you want to be injected into a process other than your own), then it will also create a bad solution.

This will solve your problem with z-order and clipping issues. You are rendering yourself in the window However, if you are targeting, then WM_PAINT to answer things outside of WinProc The diagram also falls apart; This is not a completely unusual phenomenon.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -