Share via


Figure 7

Figure 7 HTT Environment Variables

Variable
Description
%THISDIRPATH%
Contains the full name of the current folder, including drive information and any parent folder.
%THISDIRNAME%
Contains only the name of the current folder.
%TEMPLATEDIR%
Contains the fully qualified path name of the system's template folder. Normally this directory is c:\winnt\web.

Figure 8 Windows 2000 Hypertext Templates

Template Name
Description
classic.htt
One of the standard templates to choose for directories (Classic). Displays only icons.
controlp.htt
Template for the Control Panel folder.
default.htt
Used by special folders like My Documents, My Briefcase, and Temporary Internet Files.
dialup.htt
Template for the Dialup Networking folder.
folder.htt
The default template for directories.
imgview.htt
Template for the My Pictures folder.
nethood.htt
Template for the My Network Places folder.
printers.htt
Template for the Printers folder.
recycle.htt
Template for the Recycle Bin folder.
schedule.htt
Template for the Scheduled Tasks folder.
standard.htt
One of the standard templates for directories (Standard).
starter.htt
One of the standard templates for directories (Simple).

Figure 10 Registry Setting to Expose a Web View

Figure 10 Registry Setting to Expose a Web View

Figure 11 folder.htt

  
<!--
 * Copyright 1999 Microsoft Corporation.  All rights reserved.
 -->

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <style>
        body        {margin: 0; font: menu; color: black}
        #Panel      {position: absolute; width: 200px; height: 100%; visibility: hidden; overflow: auto}
        #Corner     {padding-left: 12px; padding-top: 11px}
        #FolderIcon {width: 32px; height: 32px}
        #FolderName {margin-top: 8px; font: 13pt/13pt menu; font-weight: bold}
        #LogoLine   {width: 100%; height: 2px; margin-top: 4px; vertical-align: top}
        #Details    {padding-left: 12px; margin-top: 8px}
        #Locked     {vertical-align: baseline}
        .Divider    {width: 100%; color: #C0C0C0; height: 1px}
        #Thumbnail  {width: 120px; height: 120px}
        .Legend     {margin-left: 8px}
        #Brand      {position: absolute; left: 200px; width: 100%; height: 100%; padding-left: 12px}
        p           {margin-top: 12px}
        p.Half      {margin-top: 4px}
        button      {font: 8pt Tahoma; margin-left: 12px; background: white; color: black}
        .Message    {width: 100%; frameBorder: 0; background: infobackground; color: infotext; border: 1px solid lightgrey}
        #CSCPlusMin {width: 17px}
        #CSCText    {}
        #CSCDetail  {}
        #CSCButton  {}

        #FileList   {position:absolute; width:0; height:100%; border=0}
    </style>
    <body scroll=no>
        <div id=Panel style="background: white URL(wvleft.bmp) no-repeat">
            <div id=Corner>
                <object id=FolderIcon classid="clsid:844F4806-E8A8-11d2-9652-00C04FC30871" tabIndex=-1>
                    <param name="scale" value=100>
                </object>
                <br>
                <div id=FolderName>
                    %THISDIRNAME%
                </div>
            </div>
            <img id=LogoLine src="wvline.gif">
            <div id=Details>
                <span id=CSC>
                    <div tabIndex=2 id=CSCHotTrack>
                    <span id=CSCPlusMin>
                    </span>
                    <span id=CSCText>
                    </span>
                    </div>
                    <div id=CSCDetail>
                    </div>
                    <span id=CSCButton>
                    </span>
                    <hr CLASS=Divider NOSHADE>
                </span>
                <span id=Info>
                </span>

                <br>
                <span id=MediaPlayerSpan>
                </span>

                <object id=Thumbnail classid="clsid:71650000-E8A8-11d2-9652-00C04FC30871" tabIndex=-1>
                </object>
                <label id=ThumbnailLabel for="Thumbnail" style="display: none">
                </label>

                <span id=Links>
                </span>
            </div>
        </div>
        <object id=FileList classid="clsid:1820FED0-473E-11D0-A96C-00C04FD705A2" tabIndex=1>
        </object>
        <object id=WVCoord classid="clsid:BCFD624E-705A-11d2-A2AF-00C04FC30871">
        </object>
    </body>
</html>

Figure 13 ExecCommand

  
STDMETHODIMP CExec::ExecCommand(BSTR curFolderName, BSTR bstrCmd, 
    BSTR *pbstrResults)
{
    USES_CONVERSION;

    TCHAR szCommand[MAX_PATH] = _T("");
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    // Prepare the temp file name
    TCHAR szTempFile[MAX_PATH];
    lstrcpy(szTempFile, OLE2T(curFolderName));
    PathAddBackslash(szTempFile);
    lstrcat(szTempFile, TEMPFILE);

    // Prepare the command 
    wsprintf(szCommand, _T("%s /c %s>\"%s\""), m_szCommand, 
        OLE2T(bstrCmd), szTempFile); 

    // Create the process
    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    si.wShowWindow = SW_HIDE;
    si.dwFlags = STARTF_USESHOWWINDOW;
    BOOL b = CreateProcess( NULL,
                            szCommand,
                            NULL,
                            NULL,
                            FALSE,
                            NORMAL_PRIORITY_CLASS,
                            NULL,
                            OLE2T(curFolderName),
                            &si,
                            &pi);
    if (b)
        WaitForSingleObject(pi.hProcess, INFINITE); 

    // Read back and then delete the file
    LPTSTR szBuf = NULL;
    HFILE hFile = _lopen(szTempFile, 0);
    if (hFile == HFILE_ERROR) {
        szBuf = new TCHAR[50];
        lstrcpy(szBuf, _T("Invalid command"));
    }
    else {
        long nSize = _llseek(hFile, 0, FILE_END);
        _llseek(hFile, 0, FILE_BEGIN);

        szBuf = new TCHAR[nSize+1];
        _lread(hFile, szBuf, nSize);
        _lclose (hFile);
        DeleteFile(szTempFile);
    }

    // Return the output
    CComBSTR temp;
    temp.Append(szBuf);
    *pbstrResults = temp.Copy();
    
    temp.Detach();
    delete [] szBuf;

    return S_OK;
}

Figure 17 Image Extractor

  
// IExtractImageImpl.h
//
//////////////////////////////////////////////////////////////////////
#include <AtlCom.h>
#include <ShlObj.h>


class ATL_NO_VTABLE IExtractImageImpl : public IExtractImage
{
public:
    // IUnknown
    //
    STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) = 0;
    _ATL_DEBUG_ADDREF_RELEASE_IMPL(IExtractImageImpl)


    // IExtractImage 
    //

    // IExtractImage::GetLocation
    STDMETHOD(GetLocation)(LPWSTR pszPathBuffer,
                           DWORD cchMax,
                           DWORD *pdwPriority,
                           const SIZE *prgSize,
                           DWORD dwRecClrDepth,
                           DWORD *pdwFlags)
    {
        return E_PENDING; 
    }

    // IExtractImage::Extract
    STDMETHOD(Extract)(HBITMAP* phBmpThumbnail)
    { 
        phBmpThumbnail = NULL;
        return NOERROR; 
    }
};


//////////////////////////////////////////////////////////////////////
// IconExtractor.h : Declaration of the CIconExtractor

#ifndef __ICONEXTRACTOR_H_
#define __ICONEXTRACTOR_H_

#include "resource.h"               // main symbols
#include <shlguid.h>                // shell GUIDs
#include "IExtractImageImpl.h"      // IExtractImage
#include "IPersistFileImpl.h"       // IPersistFile


/////////////////////////////////////////////////////////////////////////
// CIconExtractor
class ATL_NO_VTABLE CIconExtractor : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CIconExtractor, &CLSID_IconExtractor>,
    public IExtractImageImpl,
    public IPersistFileImpl
{
public:
    CIconExtractor()
    {
    }

DECLARE_REGISTRY_RESOURCEID(IDR_ICONEXTRACTOR)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CIconExtractor)
    COM_INTERFACE_ENTRY(IPersistFile)
    COM_INTERFACE_ENTRY_IID(IID_IExtractImage, CIconExtractor)
END_COM_MAP()

// IIconExtractor
public:

    STDMETHOD(GetLocation)(LPWSTR pszPathBuffer,
                           DWORD cchMax,
                           DWORD *pdwPriority,
                           const SIZE *prgSize,
                           DWORD dwRecClrDepth,
                           DWORD *pdwFlags);
    STDMETHOD(Extract)(HBITMAP*);
};

#endif //__ICONEXTRACTOR_H_



//////////////////////////////////////////////////////////////////////
// IconExtractor.cpp : Implementation of CIconExtractor

#include "stdafx.h"
#include "IcoView.h"
#include "IconExtractor.h"
#include <shlobj.h>

/////////////////////////////////////////////////////////////////////////
// CIconExtractor

HRESULT CIconExtractor::GetLocation(LPWSTR pszPathBuffer,
    DWORD cchMax, DWORD *pdwPriority,
    const SIZE *prgSize, DWORD dwRecClrDepth,
    DWORD *pdwFlags)
{
    if (*pdwFlags & IEIFLAG_ASYNC)
        return E_PENDING; 
    else
        return NOERROR;
}

    // IExtractImage::Extract
HRESULT CIconExtractor::Extract(HBITMAP* phBmpThumbnail)
{ 
    HICON hi = ExtractIcon(NULL, m_szFile, 0);
    ICONINFO ii;
    GetIconInfo(hi, &ii);

    *phBmpThumbnail = ii.hbmColor;
    
    DestroyIcon(hi);
    return NOERROR; 
}