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 1 Context menu handler shell extension interfaces
interface IShellExtInit
: public IUnknown
{
STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,
LPDATAOBJECT lpdobj,
HKEY hkeyProgID) = 0;
};
interface IContextMenu
: public IUnknown
{
STDMETHOD(QueryContextMenu)(HMENU hmenu,
UINT indexMenu,
UINT idCmdFirst,
UINT idCmdLast,
UINT uFlags) = 0;
STDMETHOD(InvokeCommand)( LPCMINVOKECOMMANDINFO lpici) = 0;
STDMETHOD(GetCommandString)(UINT idCmd,
UINT uType,
UINT * pwReserved,
LPSTR pszName,
UINT cchMax) = 0;
};