#if !defined(__CSpcFileDialog__)
#define __CSpcFileDialog__

#define SPCHOOK_CONTROL_ID 30000

class CSpcFileDialog : public CFileDialog
{
public:
    BOOL m_bWM_INITDIALOG;
    BOOL m_bWM_DESTROY;
public:
    DWORD m_dwStyle;
    UINT m_uID;
    HINSTANCE m_hInstance;
    CStr m_strCustFilter;
protected:
    CStr m_strWindowText;
public:
    static UINT DoOldProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

    CSpcFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL);
    void SetTitle(const char* pcszTitle);
    void SetWorkingDir(const char* pcszWorkingDir);
    void SetFilterIndex(int nFilterIndex); // 1-based index, 0 = user-defined filter
    int GetFilterIndex() const; // 1-based index, 0 = user-defined filter
    void SetCustomFilter(const char* pcszName = NULL, const char* pcszExt = NULL);
    void EnableHook(const char* pcszWindowText, DWORD dwStyle = (DWORD)(-1));

    virtual BOOL DoMessage(HWND hParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bRet);
    virtual int DoOveride(HWND hParent, CRect& r);
    virtual void DoDestroy();
};

class CSelFileDialog : public CSpcFileDialog
{
public:
    int m_nSEL;
    CComboBox m_Combo;
    CStrArray m_aSELs;
public:
    CSelFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL);
    int GetSEL() const;
    virtual BOOL OnFileNameOK();
    virtual int DoOveride(HWND hParent, CRect& r);
    virtual void DoDestroy();
};

#endif // !defined(__CSpcFileDialog__)
