MS Detours Library, detouring non win api function

Posted by flavour404 on Stack Overflow See other posts from Stack Overflow or by flavour404
Published on 2011-01-07T22:43:40Z Indexed on 2011/01/07 22:53 UTC
Read the original article Hit count: 242

Filed under:
|
|

Hi,

I want to use the windows detours library to detour a non win api function. The function is part of the Qt library (QtGui4.dll). I am wondering how I would set up the function signature for :

void QPainter::drawText ( const QPointF & position, const QString & text )

I had a go with this and it received my usual share of errors, a little explanation of requirements would be interesting as well:

void (QPainter * real_drawText)(const QPointF & position, const QString & text) = drawText

This is what they look like for TextOut, under the windows API:

BOOL (WINAPI * Real_TextOut)(HDC a0, int a1, int a2, LPCWSTR a3, int a4) = TextOutW;
BOOL WINAPI Mine_TextOut(HDC hdc,int X,int Y,LPCWSTR text,int textLen)
{
BOOL rv = Real_TextOut(hdc, X, Y, text, textLen);

HWND hWindow = WindowFromDC(hdc);

SendTextMessage(hWindow, text);

return rv;
}

Thanks.

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio-2008