Click here to Skip to main content
15,886,258 members
Articles / Web Development / HTML

Mouse Gestures for Internet Explorer

Rate me:
Please Sign up or sign in to vote.
4.84/5 (99 votes)
21 Sep 200514 min read 1.3M   13.4K   235  
Adding mouse gesture recognition to Internet Explorer.
///////////////////////////////////////////////////////////////
//
// WindowHelper.cpp
//
// Created: 20/07/2003
// Copyright (c) 2003 Ralph Hare (ralph.hare@ysgyfarnog.co.uk)
// All rights reserved.
//
// The code and information is provided "as-is" without
// warranty of any kind, either expressed or implied.
//
///////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "WindowHelper.h"
#include <vector>

#pragma comment( lib, "version" )

namespace
{
    const size_t    CLASS_NAME_SIZE = 128;
}

namespace WindowHelper
{
    tstring GetClassName( HWND hWnd )
    {
        TCHAR   className[ CLASS_NAME_SIZE ];
        ::GetClassName( hWnd, className, CLASS_NAME_SIZE );

        return className;
    }

    bool GetWindowModuleVersion( HWND hWnd, VersionInfo &versionInfo )
    {
        TCHAR   fileName[ _MAX_PATH ];
        if( ::GetWindowModuleFileName( hWnd, fileName, _MAX_PATH ) == 0 )
        {
            return false;
        }

        DWORD   dummy;
        DWORD   cbInfo = ::GetFileVersionInfoSize( fileName, &dummy );
        if( cbInfo == 0 )
        {
            return false;
        }

        std::vector< BYTE >     buffer( cbInfo );
        if( ::GetFileVersionInfo( fileName, 0, cbInfo, &buffer[ 0 ] ) == FALSE )
        {
            return false;
        }

        void    *pValue;
        size_t  cbValue;
        if( ::VerQueryValue( 
                        &buffer[ 0 ],
                        _T( "\\" ), 
                        &pValue, 
                        &cbValue 
                        ) == FALSE )
        {
            return false;
        }

        VS_FIXEDFILEINFO    *pInfo = reinterpret_cast< VS_FIXEDFILEINFO * >( pValue );

        memcpy( &versionInfo, &( pInfo->dwFileVersionMS ), sizeof( VersionInfo ) );

        return true;
    }

} // WindowHelper

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
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions