Mutiple selections in Thumbnail Control

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
wd818
Posts: 22
Joined: Tue Oct 14 2008

Mutiple selections in Thumbnail Control

Post by wd818 » Mon Mar 16 2009

How to get selected pages in the Thumbnail control?
The only available function is get_SelectedPages(). The function get_SelectedPages returns a VARIANT. How to convert the variant to selected pages in C++?

David
Amyuni Team
Posts: 89
Joined: Mon Dec 18 2006

Re: Mutiple selections in Thumbnail Control

Post by David » Tue Mar 31 2009

Hello

The property get_SelectedPages() returns a COM array which is inside the VARIANT variable. This is a code snippet that demonstrates how to read a COM array in C++ :

Code: Select all

{
                  long  n, len;
                  HRESULT     hr;
                  VARIANT value;
                  hr = m_pdf->get_SelectedPages( &value );
                  if ( value.vt == (VT_VARIANT | VT_BYREF) )
                  {
                        value = *value.pvarVal;
                  }

                  ASSERT( value.vt == (VT_ARRAY | VT_I4) || value.vt == (VT_ARRAY | VT_UI4) );
                  SAFEARRAY * psa = value.parray;
                  hr = SafeArrayLock( psa );
                  hr = SafeArrayGetUBound( psa, 1, &len );
                  len++;

                  DWORD *values = (DWORD *) malloc( len * sizeof(DWORD) );

                  // read data here
                  for ( n = 0; n < len; n++ )
                        values[n] =  ((LPDWORD)psa->pvData)[n];

                  SafeArrayUnlock( psa );

}
Hope that helps?
David
Amyuni Custom Development
Do you need a specific PDF solution? Are you looking for expertise that will enable you to start or complete a PDF integration project?
http://www.amyuni.com/en/company/services.php

Post Reply