1

Windows detours ライブラリを使用して、win 以外の API 関数を迂回したいと考えています。この関数は Qt ライブラリ (QtGui4.dll) の一部です。の関数シグネチャをどのように設定するのか疑問に思っています:

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

私はこれを試してみましたが、いつものようにエラーが発生しました。要件の少しの説明も興味深いでしょう:

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

これは、Windows API での TextOut の場合の外観です。

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;
}

だから、私が試したジーンの提案に続いて:

typedef void (QPainter::* Real_qp_drawText)(const QPointF & position, const QString & text);

void Mine_drawText(const QPointF & position, const QString & text)
{

    Real_qp_drawText(position,text);

}

しかし、「組み込み型への関数スタイルの変換では、1 つのパラメーターしか使用できない」というエラーが発生しました。

とにかく、公の場で少し屈辱を与えるのは魂に良いと彼らは言う、私の魂は最高の時間を過ごしているに違いない...

ありがとう。

4

2 に答える 2

1

非静的メンバー関数はthis、迂回時に宣言する必要がある暗黙のポインターをパラメーターとして取得することに注意してください。

于 2011-01-07T23:09:37.987 に答える
1

The type of your functions is FnType:

typedef void (QPainter::*FnType)(const QPointF &, const QString &);

but it looks like what they expect is a WINIAPI = __stdcall C function instead. You might think if you can wrap your function into a C function.

于 2011-01-07T22:52:07.323 に答える