我正面临着一个相当两难的境地。我已经将我的动态链接库注入到其他进程中,并从那里挂接了一些WinAPI调用,具体地说就是ExtTextOutW@GDI32,DrawTextExW@GDI32和AlphaBlend@Msimg32。现在的问题是,当另一个应用程序使用这两个GDI32函数编写内容时,我不知道它出现的确切位置。这是因为包含文本的DC将由AlphaBlend处理,这最终也会将其放入窗口的DC。
那么,我如何跟踪某些HDC呢?在伪代码中,下面是另一个应用程序如何将文本绘制到屏幕上:
HDC h = DrawTextW("STRING")
Do something with h. The "STRING" gets new HDC, say h2.
Pass h2 to AlphaBlend, which draws it to the screen.就像我说的,我没有跟踪到原来的h,因为字符串在AlphaBlend之前得到了新的DC。你知道如何从h> h2连接到某个字符串吗?
我不知道我是否能够正确地解释这个问题,请询问您是否有任何问题…
发布于 2010-02-20 20:16:28
static BOOL (WINAPI *AlphaBlend_t)(
HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
BLENDFUNCTION blendFunction
) = AlphaBlend;
BOOL MyAlphaBlend(
HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
BLENDFUNCTION blendFunction
)
{
// modify hdcDest to hdcDest2
return AlphaBlend_t(hdcDest2, ...);
}这应该能起到作用。在后一个函数中输入任何代码来修改HDC。
https://stackoverflow.com/questions/2302069
复制相似问题