Implementation of the User32.PrintWindow
Hi, As next of the discussion on the bug 18772 (http://bugs.winehq.org/show_bug.cgi?id=18772), I send here the implemenation for User32.PrintWindow function I've tested it with an application that was crashing because of this unimplemented function. Regards Jos
Josselin Bardet wrote: > Hi, > > As next of the discussion on the bug 18772 > (http://bugs.winehq.org/show_bug.cgi?id=18772), I send here the > implemenation for User32.PrintWindow function > > I've tested it with an application that was crashing because of this > unimplemented function. > > Regards > Jos As I already said in bugzilla: - use SendMessageW - add FIXME for unused flags or use them - no need for brackets around SendMessage - add a simple test (if native send this message - you can check it easily with Spy in Windows)
Nikolay Sivov a écrit :
As I already said in bugzilla: - use SendMessageW - add FIXME for unused flags or use them - no need for brackets around SendMessage - add a simple test (if native send this message - you can check it easily with Spy in Windows)
After testing on a real windows, it looks like native PrintWindow do not send WM_PRINT message, so we have to guess manually which flags to set. Do you think PW_CLIENTONLY means PRF_CLIENT | PRF_ERASEBKGND, or PW_CLIENTONLY means PRF_CLIENT | PRF_ERASEBKGND | PRF_CHILDREN | PRF_OWNED (only removed PRF_NONCLIENT)? And with no flag PW_CLIENTONLY means PRF_CLIENT | PRF_ERASEBKGND | PRF_CHILDREN | PRF_OWNED | PRF_NONCLIENT ? This was the one I tested on the application
Nikolay Sivov a écrit :
As I already said in bugzilla: - use SendMessageW - add FIXME for unused flags or use them - no need for brackets around SendMessage - add a simple test (if native send this message - you can check it easily with Spy in Windows)
Proposed implementation: Adding in include/winuser.h /* PrintWindow() flags */ #define PW_CLIENTONLY 0x00000001 _________________________________________ Adding in dlls/user32/user32.spec @ stdcall PrintWindow(long long long) _________________________________________ Adding in dlls/user32/painting.c /************************************************************************* * PrintWindow (USER32.@) * */ BOOL WINAPI PrintWindow( HWND hwnd, HDC hdcBlt, UINT nFlags) { UINT flags = PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_OWNED; if (nFlags & PW_CLIENTONLY == 0) flags |= PRF_NONCLIENT; return SendMessageW( hwnd, WM_PRINT, (WPARAM)hdcBlt, (LPARAM)flags ); } _________________________________________ I can remake a patch if you think it's good
Josselin Bardet wrote:
Nikolay Sivov a écrit :
As I already said in bugzilla: - use SendMessageW - add FIXME for unused flags or use them - no need for brackets around SendMessage - add a simple test (if native send this message - you can check it easily with Spy in Windows)
Proposed implementation: Adding in include/winuser.h
if (nFlags & PW_CLIENTONLY == 0) flags |= PRF_NONCLIENT; It's better to use !(nFlags & PW_CLIENTONLY) for me.
Post updated version anyway.
participants (2)
-
Josselin Bardet -
Nikolay Sivov