//---------------------------------------------------------------------------------------
//
// user defined message for callback function
//
#define user_wm_notifyicon wm_user + 0x001
//
// user defined message for display icon on statue bar of windows
//
#define user_wm_showappiconic wm_user + 0x002
//
// user defined message for file change notification
//
#define wm_user_thread_file_changed wm_user + 0x003
//
// the structure was defined for the input of thread function parameters
//
typedef struct tagthreadparam
{
hwnd hwnd;
cevent *pevent;
}threadparam;
//
// worker thread function declare
//
uint threadfunction(lpvoid pparam);
//---------------------------------------------------------------------------------------
//
// comments: message map of cmainwindow class
//
//---------------------------------------------------------------------------------------
begin_message_map (cmainwindow, cwnd)
on_wm_create()
on_message(user_wm_notifyicon,onmyiconnotify)
on_message(user_wm_showappiconic,onshowappiconic)
on_wm_syscommand()
on_wm_close()
on_bn_clicked(idc_browse,onbrowsebutonclicked)
on_en_change(ide_obj_path,onobjectpathchanged)
on_bn_clicked(idc_ok,onokbuttonclicked)
on_bn_clicked(ide_obj_path,onobjectpathchanged)
on_bn_clicked(idc_exit_fi,onexitbuttonclicked)
on_message(wm_user_thread_file_changed,onfilechanged)
end_message_map ()
//
// defination of application object
//
cmyapp myapp;
//---------------------------------------------------------------------------------------
//
// function: bool cmyapp::initinstance ()
// purpose: cmyapp member functions
// comments:
//
//---------------------------------------------------------------------------------------
bool cmyapp::initinstance ()
{
m_pmainwnd = new cmainwindow;
m_pmainwnd->showwindow (m_ncmdshow);
m_pmainwnd->updatewindow ();
//
// send mywm_showappiconic so that the window can be
// hide after programe runed and the icon should be
// displayed on the statue area of task bar
//
m_pmainwnd -> postmessage( user_wm_showappiconic );
return true;
}
//---------------------------------------------------------------------------------------
//
// function: cmainwindow::cmainwindow ()
// purpose: the constructor of the cmainwindow class
// comments:
//
//---------------------------------------------------------------------------------------
cmainwindow::cmainwindow ():
m_eventstopwatch(false,true)
{
//
// register a wndclass.
//
cstring strwndclass = afxregisterwndclass (
cs_dblclks, // class style
afxgetapp ()->loadstandardcursor (idc_arrow), // class cursor
(hbrush) (color_3dface + 1), // background brush
afxgetapp ()->loadicon( idr_file_inspector) // class icon
);
//
// create a window.
//
createex (0, strwndclass, _t ("file/folder supervisor"),
ws_overlapped | ws_sysmenu | ws_caption | ws_minimizebox,
cw_usedefault, cw_usedefault, cw_usedefault, cw_usedefault,
null, null);
//
// size the window.
//
crect rect (80,70, 452, 400);
calcwindowrect (&rect);
setwindowpos (null, 0, 0, rect.width (), rect.height (),