GDI resource leak caused by VpeSetupPrinter

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

GDI resource leak caused by VpeSetupPrinter

Postby czhu » Thu Jun 23, 2005 9:58 pm

Hello,

We are using VPE 3.50. The VpeSetupPrinter method call is causing GDI leak. Is this a bug in VPE?

When the following code is executed in an application, the gdi objects count
in the window task manager will increase 4 every time. However, if the
EnableWindow(FALSE) is commented out, no gdi leak is reported.

Code: Select all
// Disable the application window as suggested by FQA.
CWnd* pWnd = AfxGetApp()->GetMainWnd();
pWnd->EnableWindow(FALSE);

long hDoc = ::VpeOpenDoc(GetSafeHwnd(), "",
           VPE_NO_STATUSSEG + VPE_NO_RULERS);
::VpeLicense(hDoc, "VPE-XXXXX-XXXX", "XXXX-XXXX");
::VpeSetPrintOptions(hDoc, PRINT_ALL + PRINT_NO_AUTO_PAGE_DIMS);

CString str = _T("c:\\temp\\print.prs");
::VpeSetupPrinter(hDoc, str, PRINTDLG_ALWAYS);
::VpeCloseDoc(hDoc);
pWnd->EnableWindow();


Thanks,
czhu
czhu
 
Posts: 2
Joined: Thu Jun 23, 2005 9:38 pm

Postby IDEAL Software Support » Fri Jun 24, 2005 10:46 am

We have tested your code and can not confirm the problem in general.

Our test results are as follows:

1. The problem is caused by printer drivers.

2. On our test machine no printer driver is causing GDI leaks.

3. We found printer drivers, which are causing Windows handle leaks. Disabling the parent window has no effect on those leaks, they do occur always.

4. This is limited to some drivers, but not all printer drivers have this problem in general. The drivers causing handle leaks have a bug. It is really interesting, how many faulty printer drivers are shipped by their manufacturers, even from companies from which you wouldn't expect it.

Solution:
Try to obtain a newer version of your printer driver, or try to use a different compatible driver.

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 4 guests

cron