Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339772

Summary: Browser.print() image is black on Windows 7 Service Pack 1
Product: [Eclipse Project] Platform Reporter: e fergus <efergus>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: efergus
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
test snippet none

Description e fergus CLA 2011-03-11 18:44:48 EST
Build Identifier: I20100608-0911

Run the attached code on Windows 7 Service Pack 1.  The call to Browser.print(gc) results in a black image.  This happens only on Windows 7 Service Pack 1, not Windows 7 without Service Pack 1 or XP.

Reproducible: Always

Steps to Reproduce:
1. Run the attached code snippet (based on Snippet 292 but changed the Group widget to a Browser widget)
2. Click the "Snapshot" button to see the image

RESULT - browser area of image is a black box
Comment 1 e fergus CLA 2011-03-11 18:45:59 EST
Created attachment 191034 [details]
test snippet

test code snippet, based on snippet 292 with the tree replaced with a browser
Comment 2 e fergus CLA 2011-03-15 15:32:29 EDT
tried on the latest integration build and this is still an issue: Eclipse SDK Version 3.7.0, Build id: I20110310-1119
Comment 3 e fergus CLA 2011-03-15 19:16:36 EDT
Hi again,

I did some poking around, it seems if you wrap the browser in a GC handle, the printWindow API call works as expected:

int handle = hwnd;
if(this instanceof Browser)
{
   handle = new GC(this).handle;
}
success = OS.PrintWindow(handle, hdc, 0);

A straight call to WM_PRINT also works, which I'm currently using as a work around.
Comment 4 Lars Vogel CLA 2019-11-08 04:38:49 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant please remove the stalebug whiteboard tag.