THUMBNAIL_EVENT message

Description

The thumbnail browser generates this event during image loading several times. The browser sends message in the following section of loading:

Preload            send the name of last found file (user can get file information)

Info loaded     send image information from image before generate thumbnail.

Generated       send handler for generated thumbnail image

Skipped           send message if skipped thumbnail generating during loading

Error                send message if error generated during thumbnail generating

Notes

At the end of the body of the method a user has to call FinishEventHandling function to destroy dynamically allocated resources.

A user has to destroy bitmap handles that messages send to the application by calling DestroyBitmapHandler function.

Sample

MyDlg.h

-------

 

#include "BiThumbnail.h"

 

...

 

afx_msg LRESULT OnThumbnailEventHandler(WPARAM wParam, LPARAM lParam);

afx_msg LRESULT OnThumbnailStopBrowsingEventHandler(WPARAM wParam, LPARAM lParam);

 

...

 

BiThumbnail m_biThumb;

 

 

 

MyDlg.cpp

---------

 

const UINT ID_THUMBNAIL_REGISTERED_MESSAGE = RegisterWindowMessage(ID_THUMBNAIL_EVENT_STR);

const UINT ID_THUMBNAIL_STOPBROWSING_REGISTERED_MESSAGE = RegisterWindowMessage(ID_THUMBNAIL_EVENT_STOPBROWSING_STR);

 

 

BEGIN_MESSAGE_MAP(CMyDlg, CDialog)

ON_REGISTERED_MESSAGE(

ID_THUMBNAIL_REGISTERED_MESSAGE, OnThumbnailEventHandler)

END_MESSAGE_MAP()

 

...

 

BOOL CMyDlg::OnInitDialog()

{

            ...

 

            // TODO: Add extra initialization here

            m_biThumb.SetParentWnd(m_hWnd);

 

            ...

}

 

...

 

m_biThumb.BrowseInDirectory("C:\\tmp");

 

...

 

LRESULT CMyDlg::OnThumbnailEventHandler(WPARAM wParam, LPARAM lParam)

{

            // it must be call

            BiThumbnailInfo* info = reinterpret_cast<BiThumbnailInfo*>(lParam);

           

            // add your code here

 

            switch(info->eventType){

            case ET_PRELOAD:

                        {

                                    // add your code here

                                    break;

                        }

 

            case ET_INFOLOADED:

                        {

                                    // add your code here

                                    break;

                        }

 

            case ET_SKIPPED:

                        {

                                    // add your code here

                                    break;

                        }

 

            case ET_GENERATED:

                        {

                                    // add your code here

                                    break;

                        }

 

            case ET_ERROR:

                        {

                                    // add your code here

                                    break;

                        }

            }

 

            // it must be call

            m_biThumb.FinishEventHandling(info);

 

            return 0;

}

 

LRESULT CMyDlg::OnThumbnailStopBrowsingEventHandler(WPARAM wParam, LPARAM lParam)

{

            BiThumbnail* thumb = reinterpret_cast<BiThumbnail*>(lParam);

 

            ...

 

            return 0;

}