Inject Dll, handle WM_PAINT...
Hi,
I need to inject dll into some application and then handle WM_PAINT message of some window (or replace ::OnDraw with another). The application is compiled with VC++ 6 MFC (static lib)
The reason I want to do so is to wrap ::OnDraw with another ::OnDraw function which will resides in the injected dll and will provide double buffering (flicker free painting) of that window / CView
in dll (pseudo code):
Code:
DLLInit()
{
// find original OnDraw function of target CView
// or
// Replace WndProc and Handle WM_PAINT of targer window
// ... in both cases also handle WM_ERASEBKGND message and
// return TRUE;
}
void CSomeView::OnDraw(CDC* pDC)
{
CMemDC dc(pDC);
orgCView.OnDraw(&dc);
// destructor of CMemDC whill render the dc obj to original pDC (bitblt)
}
// or
void thiscall__ OnDraw(CDC* pDC) // (this in ECX)
{
CMemDC dc(pDC);
OriginalOnDraw(ECX,&dc);
// destructor of CMemDC whill render the dc obj to original pDC (bitblt)
}
I dont really need dll injection because the targer application is designed to load EVERY dll which resides in its startup folder.
The question is: Is this possible at all and if the answer is true is there anyone that can help me with this?
Tnank you.