Remote Reboot Shell Extension
By Matthew Wilson, August 01, 2003
If you work on multiple machines in a distributed environment, shutting down or rebooting remote machines can be a hassle. Rather than logging on to pcAnywhere or deploying the sneaker net, it would be nice to handle this task with a simple mouse click. Here is a shell extension that provides shutdown/reboot of a remote host via an Explorer shortcut. This article will describe the main technical aspects of this utility--the Remote Reboot context menu handler shell extension--and highlight some issues one must consider when creating such shell extensions using ATL, STL, and WTL.
Remote Reboot Shell Extension
Listing 10 Using WTLSTL's SimpleHelpWindow<>
class COptionsDialog
: public CDialogImpl<COptionsDialog>
, public SimpleHelpWindow<COptionsDialog, true>
{
typedef SimpleHelpWindow<COptionsDialog, true> help_window_class_type;
public:
enum { IDD = IDD_OPTIONS };
BEGIN_MSG_MAP(COptionsDialog)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
CHAIN_MSG_MAP(help_window_class_type)
END_MSG_MAP()
// Message handlers
private:
LRESULT OnInitDialog(UINT uMsg, . . .);
LRESULT OnSysCommand(UINT uMsg, . . .);
LRESULT OnCloseCmd(WORD wNotifyCode, . . .);
. . .
};