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

This function appends a new image to the GUI Page Sorter window created with IG_GUI_page_window_create().

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_GUI_page_file_append(
        HWND hwndPage, 
        const LPSTR lpcszFileName
);

Arguments:

Name Type Description
hwndPage HWND Windows handle to the GUI Page Sorter.
lpcszFileName const LPSTR Set to the path/filename of the image that you want to add to the GUI Page Sorter.

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++.

Sample:

Page

Example:

 
Copy Code
HIGEAR hIGear;    /* HIGEAR handle of image */
HWND hWnd, hWndPage;    /* Windows handles */
AT_ERRCOUNT  nErrCount; /* tally of IG errors on the stack */
UINT nCurrentPage; /* number of page currently active */
case ID_FILE_OPENDOCUMENT:
        if (GetOpenImageFileName(hWnd, szFile, sizeof(szFile)))
        {
        SetCursor(LoadCursor(NULL, IDC_WAIT));
        /* create the page sorter window, if it does not already exist*/
                if (!IsWindow(hwndPage))
                {
                nErrCount = IG_GUI_page_window_create(hWnd, IG_GRP_DEFAULT, 
                "Page Window", CW_USEDEFAULT, 
                CW_USEDEFAULT, 320, 200, &hwndPage);
                /* attach select, delete and order callbacks */
                IG_GUI_page_order_CB_register(hwndPage, 
                PageOrderProc, NULL);
                IG_GUI_page_select_CB_register(hwndPage, 
                PageSelectProc, NULL);
                IG_GUI_page_delete_CB_register(hwndPage, 
                PageDeleteProc, NULL);
                nCurrentPage = 0;
                }
                /* now add the full document to the page window */
                nErrCount = IG_GUI_page_file_append(hwndPage, szFile);
                /* set the initial page */
                if (!nCurrentPage)
                {
                nCurrentPage = 1;
                /* set the active page */
                IG_GUI_page_active_set(hwndPage, nCurrentPage);
                }
                else
                {
                /* get the new page */
                IG_GUI_page_active_get(hwndPage, &nCurrentPage);
                IG_GUI_page_handle_get(hwndPage, nCurrentPage, &hIGear);
                }
                /* change the title of the main window to reflect a filename 
                        change */
                wsprintf(szBuf, "%s Page:  %d", (LPVOID)szFile, nCurrentPage);
                SetWindowText(hWndMain, szBuf);
                /* tell windows to tell us to paint the new image */
                InvalidateRect(hWnd, NULL, FALSE);
                UpdateWindow(hWnd);
                SetCursor(LoadCursor(NULL, IDC_ARROW));
        }
break;

Remarks:

The image will be last in order of the images already displayed and will be assigned a page number equal to the last page number plus one, e.g., if the GUI Page Sorter contains five images, the image added with this function will be treated as page six.

To delete a page, use IG_GUI_page_remove() function.