ImageGear for C and C++ on Windows v19.4 - Updated
IG_GUI_page_thumbnail_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > GUI Functions > GUI Page Functions > IG_GUI_page_thumbnail_get

This function returns the bitmap representation of a page in the page browser window and also the palette, if it has one.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_GUI_page_thumbnail_get(
        HWND hwndPage, 
        UINT nPage, 
        BITMAP FAR* lpBitmap, 
        HPALETTE FAR* lpPalette
);

Arguments:

Name Type Description
hwndPage HWND Windows handle to the GUI page sorter window.
nPage UINT Set to the number of the page (thumbnail) in the GUI Page Sorter window for which you would like to receive the bitmap and palette.
lpBitmap BITMAP FAR* Returns the bitmap of the currently selected thumbnail.
lpPalette HPALETTE FAR* Returns the palette of the currently selected thumbnail. If there is no palette, this returns a NULL.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

(Return value is in HBITMAP - compatible format.)

Sample:

None

Example:

 
Copy Code
/* This example demonstrates retrieving the screen bitmap of page 1 and drawing a rectangle
around it */
AT_ERRCOUNT  nErrcount;
HIGEAR hIGear;
HBITMAP hBitmap, hPriorBitmap;
HPALETTE                hPalette, hPriorPalette;
HWND hwndPage;
HDC hmemDC;
INT nWidth, nHeight;
IG_GUI_page_thumbnail_get(hwndPage, 1, &hBitmap, &hPalette);
IG_GUI_page_thumbnail_size_get(hwndPage, &nWidth, &nHeight);
hmemDC = CreateCompatibleDC(NULL);
hPriorBitmap = SelectBitmap(hmemDC, hBitmap);
hPriorPalette = SelectPalette(hmemDC, hPalette, FALSE);
RealizePalette(hmemDC);
Rectangle(hmemDC, 0, 0, nWidth, nHeight);
SelectPalette(hmemDC, hPriorPalette, FALSE);
SelectBitmap(hmemDC, hPriorBitmap);
DeleteDC(hmemDC);

Remarks:

The purpose of this function is to allow you to manipulate the screen representation of the page. For example, if a page contains annotations, you could indicate this by making the page's screen bitmap have a red tint.

The bitmap and palette returned should never be deleted using the Window's DeleteObject() function. When the page is deleted via the Page Sorter Window, the bitmap will be automatically destroyed for you. To destroy and regenerate all screen bitmaps (pages) call IG_GUI_page_document_update(); to destroy and regenerate a single screen bitmap, call IG_GUI_page_document_refresh().

See also other IG_GUI_page_...() functions.