Click here to Skip to main content
15,893,588 members
Articles / Desktop Programming / WTL

A Developer's Survival Guide to IE Protected Mode

Rate me:
Please Sign up or sign in to vote.
4.91/5 (51 votes)
20 May 200719 min read 432.7K   1.9K   125  
Busted features? APIs failing? Use this guide to get your IE plugin up and running again in protected mode!
// BandDialog.h : Declaration of the CBandDialog

#ifndef __BANDDIALOG_H_
#define __BANDDIALOG_H_

/////////////////////////////////////////////////////////////////////////////
// CBandDialog

class CBandDialog : public CDialogImpl<CBandDialog>,
                    public CWinDataExchange<CBandDialog>,
                    public CDialogResize<CBandDialog>
{
public:
    enum { IDD = IDD_BANDDIALOG };

    // Construction
    CBandDialog() { }
    ~CBandDialog() { }

    // Maps
    BEGIN_MSG_MAP(CBandDialog)
        MSG_WM_INITDIALOG(OnInitDialog)
        COMMAND_ID_HANDLER_EX(IDC_OPEN_MUTEX1, OnOpenMutex1)
        COMMAND_ID_HANDLER_EX(IDC_OPEN_MUTEX2, OnOpenMutex2)
        COMMAND_ID_HANDLER_EX(IDC_RUN_EXE1, OnRunExe1)
        COMMAND_ID_HANDLER_EX(IDC_RUN_EXE2, OnRunExe2)
        COMMAND_ID_HANDLER_EX(IDC_SEND_MESSAGE1, OnSendMessage1)
        COMMAND_ID_HANDLER_EX(IDC_SEND_MESSAGE2, OnSendMessage2)
        COMMAND_ID_HANDLER_EX(IDC_SAVE_LOG, OnSaveLog)
        COMMAND_ID_HANDLER_EX(IDC_CLEAR_LOG, OnClearLog)
        CHAIN_MSG_MAP(CDialogResize<CBandDialog>)
    END_MSG_MAP()

    BEGIN_DLGRESIZE_MAP(CBandDialog)
        DLGRESIZE_CONTROL(IDC_LOG, DLSZ_SIZE_X|DLSZ_SIZE_Y)
    END_DLGRESIZE_MAP()

    BEGIN_DDX_MAP(CBandDialog)
        DDX_CONTROL_HANDLE(IDC_LOG, m_cLog)
    END_DDX_MAP()

    // Message handlers
    BOOL OnInitDialog ( HWND hwndFocus, LPARAM lParam );

    // Command handlers
    void OnOpenMutex1 ( UINT uCode, int nID, HWND hwndCtrl );
    void OnOpenMutex2 ( UINT uCode, int nID, HWND hwndCtrl );
    void OnRunExe1 ( UINT uCode, int nID, HWND hwndCtrl );
    void OnRunExe2 ( UINT uCode, int nID, HWND hwndCtrl );
    void OnSendMessage1 ( UINT uCode, int nID, HWND hwndCtrl );
    void OnSendMessage2 ( UINT uCode, int nID, HWND hwndCtrl );
    void OnSaveLog ( UINT uCode, int nID, HWND hwndCtrl );
    void OnClearLog ( UINT uCode, int nID, HWND hwndCtrl );

protected:
    // DDX vars
    CListViewCtrl m_cLog;

    // Other methods/data
    void Log ( LPCSTR szFormat, ... );
    HRESULT WriteLogFile ( LPCTSTR szFilename );

    UINT m_uRegisteredMsg1, m_uRegisteredMsg2;
};

#endif //__BANDDIALOG_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) VMware
United States United States
Michael lives in sunny Mountain View, California. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at VMware.

He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.

Mike was a VC MVP from 2005 to 2009.

Comments and Discussions