Which API Microsoft Word (Office 2013) is using the paint the screen

旧街凉风 提交于 2019-12-11 19:39:48

问题


I have an Office plug-in (native C++) which is fairly involving with Office. One of the thing I'm doing is finding the HWND of the main window, and subclass that window. On various occasions I also GetDC that window, and paint my own stuff on top of the Office document.

I'm also using IAT hooking (fairly standard) of various Windows API.

I've a 'Decorate' function that draw on the HDC directly. Until Office 2010, I called my method immediately after Office handled WM_PAINT, and also after WM_KEYUP. That was working fine.

Starting with Office 2013, WinWord pains the client area in times I failed to track. Moreover, I cannot even find any GDI API that Office is using when repainting it's client area. I'm putting a hook on DrawText (gdi), or DrawString (gdi+).

As far as I can tell, WinWord will repaint the client area (and hence - delete my decoration) even without calling GetDC, BeginPaint, or ReleaseDC!

I'm almost out of ideas. I'll appreciate any idea that Office could use to touch the screen? I'm setup to hook any function, and/or Windows message - just can't find what has to be hooked. Any other idea (no need for complete solution - just an direction will be fine). Any tool that can be used (e.g. is there anything similar to FileMon for GDI methods?) will be appreciated.


回答1:


Office 2013 is using DirectWrite, Direct2D and DXGI for putting ink on the screen. As they do that, they almost entirely avoid using GDI, hence GetDC/BeginPaint/etc. never been called.

See this blog:

http://blogs.msdn.com/b/murrays/archive/2012/07/29/office-adopts-new-windows-display-technology.aspx



来源:https://stackoverflow.com/questions/18124048/which-api-microsoft-word-office-2013-is-using-the-paint-the-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!