Click here to Skip to main content
12,299,775 members (58,638 online)
Click here to Skip to main content

Stats

30.3K views
712 downloads
35 bookmarked
Posted

Shell Extension with Keyboard Hook

, 31 Aug 2008 CPOL
Shell Extension with Keyboard Hook
ATLSmartMove - Copy
ATLSmartMove.suo
ATLSmartMove
ATLSmartMove.aps
ATLSmartMove.def
ATLSmartMove.rgs
ATLSmartMove.vcproj.joj-PC.joj.user
ATLSmartMove.vcproj.vspscc
ATLSmartMoveps.def
ATLSmartMovePS.vcproj.joj-PC.joj.user
ATLSmartMovePS.vcproj.vspscc
Debug
ATLSmartMove.dll
Release
ATLSmartMove.dll
ShellExtension.rgs
// ShellExtension.h : Declaration of the CShellExtension

#pragma once
#include "resource.h"       // main symbols

#include "ATLSmartMove_i.h"
#include <shlobj.h>

#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif

const int NEWFOLDERKEY = VK_F12;
const TCHAR GRAPHICFILES[49] = TEXT("*.png;*.bmp;*.jpg;*.gif;*.jpeg;*.pcd;*.pcx;*.svg");
const TCHAR VIDEOFILES[87] = TEXT("*.avi;*.mpeg;*.mpg;*.flv;*.swf;*.fla;*.wmv;*.3gp;*.divx;*.rm;*.rmvb;*.srt;*.xvid;*.vid");
const TCHAR MUSICFILES[124] = TEXT("*.aac;*.aif;*.aiff;*.aud;*.m3u;*.mid;*.midi;*.mp1;*.mp2;*.mp3;*.mpa;*.mpga;;*.ogg;*.omf;*.omg;*.ra;*.r1m;*.wav;*.wave;*.wma");

// CShellExtension

class ATL_NO_VTABLE CShellExtension :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CShellExtension, &CLSID_ShellExtension>,
	public IObjectWithSiteImpl<CShellExtension>,
	public IShellExtension
{
public:
	CShellExtension();
	~CShellExtension();

DECLARE_REGISTRY_RESOURCEID(IDR_SHELLEXTENSION)

DECLARE_NOT_AGGREGATABLE(CShellExtension)

BEGIN_COM_MAP(CShellExtension)
	COM_INTERFACE_ENTRY(IShellExtension)
	COM_INTERFACE_ENTRY(IObjectWithSite)
END_COM_MAP()



	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}

	void FinalRelease()
	{
	}

public:
	STDMETHOD(SubclassExplorer) (bool SubClass);
	STDMETHOD(SetSite) (IUnknown *pUnkSite);

private:
	bool m_Subclassed;

	static BOOL CALLBACK WndEnumProc(HWND, LPARAM);
	static LRESULT CALLBACK KeyboardProc(int, WPARAM, LPARAM);

	static VOID MoveSelectedFiles(bool);
	static BOOL FindIShellView(HWND, IShellView**);

	static void AddFileToArray(LPCWSTR, LPWSTR, IFileOperation*, bool);
};

OBJECT_ENTRY_AUTO(__uuidof(ShellExtension), CShellExtension)

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

joaquinjares
Software Developer (Senior) Independent
Argentina Argentina
I have been working as a developer for 15 years now, starting with gwbasic, moving to C and VB and then to VB.Net and later C#. I've used many languages, as languages is what I really like.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 31 Aug 2008
Article Copyright 2008 by joaquinjares
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid