Home|Download|Buy online|Affiliates|Search|Feedback|Site Map|Forum|ReviewsUse our online RSS & XML news feeds to get the latest news about our products delivered to your desktop... RSS feed    03.09.2010
Home»Print preView Library
Find out more how to use BestView...
SDK
Tips and tricks

Tips and Tricks

ATTENTION!
The library has been superseded by our new product, BestView library. BestView offers a lot of new features, such as multilanguage support, new exact coordinate system, dynamic pages and so on.
Find a minute and visit BestView home page.

1. Short introduction

There are three stages that users have to pass.

1.1. Initialization

This is the first step. During an application initialization the user calls function pvlRegisterClasses (or pvlRegisterClasses2 ) and pass there HINSTANCE of the application. Library initializes its internal structures. If the call of this function succeeded then everything is OK.

1.2. Working with library

Here the user is working with the library.

1.3. Completion

At the end of work the application has to call the pvlUnregisterClasses function to clean up all internal resources that have been allocated by the library.

2. Useful notes

All work with the library passes on the stage two. Here are some important particular qualities:

  • The first is the call order of the callback functions. The order is following:

    1. fnPrepareDC - the function is called when a preview window is creating or user changes printer or its properties.
    2. fnInit - the function is called immediately after fnPrepareDC. The user has to build the content of all pages during this call.
    3. fnGetNumPages -the function is called to get the number of pages in the content.
    4. fnDrawPage - the function is called every time when the page needs to be drawn.
    5. fnCanBeClosed - the function is called when user tries to close the preview window.
    6. fnWindowCutOff - the function is called once when the preview window is closing, to perform cleanup.
  • Second is working with PVL_CALLBACK structure. To help to work with this structure there is a helper C++ class, PVL_CALLBACK_WRAPPER, declared in pvl.h. To work with this class the users have to inherit their own class from this one and implement the functions below(see examples):

    1. virtual HRESULT PrepareDC(HWND,DEVMODEA *,LONG);
    2. virtual HRESULT Init(HWND,HDC,const DEVMODEA *);
    3. virtual HRESULT GetNumPages(HWND,const DEVMODEA *,LONG*);
    4. virtual HRESULT DrawPage(HWND,HDC,DWORD,DWORD);
    5. virtual HRESULT CanBeClosed(HWND,LONG*);
    6. virtual HRESULT WindowCutOff(HWND);
    7. virtual HRESULT PrintDisabled(HWND);
  • The control has an absolute coordinate system. It utilizes pixels as units; So, when fnInit is called, that is a good place to get all metrics of the device context that has been creating, save them and use the ones during the all life cycle of the preview window.
Valid HTML 4.01 Transitional© PVL team, 2004-2010, all rights reserved. This Web site and its entire contents are for personal use only and may not be copied, reproduced, modified, published or distributed in any way,without PVL team's prior written permission.