Skip to content

Commit

Permalink
add icon and separator to explorer context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gurnec committed Sep 5, 2016
1 parent 7ff1fc3 commit 81d0919
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 15 deletions.
22 changes: 20 additions & 2 deletions CHashCheck.cpp
Expand Up @@ -10,6 +10,14 @@
#include "HashCheckUI.h"
#include "HashCheckOptions.h"

CHashCheck::CHashCheck( )
{
InterlockedIncrement(&g_cRefThisDll);
m_cRef = 1;
m_hList = NULL;
m_hMenuBitmap = (HBITMAP)LoadImage(g_hModThisDll, MAKEINTRESOURCE(IDI_MENUBITMAP), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION);
}

STDMETHODIMP CHashCheck::QueryInterface( REFIID riid, LPVOID *ppv )
{
if (IsEqualIID(riid, IID_IUnknown))
Expand Down Expand Up @@ -105,10 +113,20 @@ STDMETHODIMP CHashCheck::QueryContextMenu( HMENU hmenu, UINT indexMenu, UINT idC
TCHAR szMenuText[MAX_STRINGMSG];
LoadString(g_hModThisDll, IDS_HS_MENUTEXT, szMenuText, countof(szMenuText));

if (InsertMenu(hmenu, indexMenu, MF_STRING | MF_BYPOSITION, idCmdFirst, szMenuText))
MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_BITMAP;
mii.fType = MFT_STRING;
mii.wID = idCmdFirst;
mii.dwTypeData = szMenuText;
mii.hbmpItem = m_hMenuBitmap;
if (! InsertMenuItem(hmenu, indexMenu, TRUE, &mii))
return(MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0));

if (! InsertMenu(hmenu, indexMenu + 1, MF_SEPARATOR | MF_BYPOSITION, 0, NULL))
return(MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 1));

return(MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0));
return(MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 2));
}

STDMETHODIMP CHashCheck::InvokeCommand( LPCMINVOKECOMMANDINFO pici )
Expand Down
5 changes: 3 additions & 2 deletions CHashCheck.hpp
Expand Up @@ -16,10 +16,11 @@ class CHashCheck : public IShellExtInit, IContextMenu, IShellPropSheetExt, IDrop
protected:
CREF m_cRef;
HSIMPLELIST m_hList;
HBITMAP m_hMenuBitmap;

public:
CHashCheck( ) { InterlockedIncrement(&g_cRefThisDll); m_cRef = 1; m_hList = NULL; }
~CHashCheck( ) { InterlockedDecrement(&g_cRefThisDll); SLRelease(m_hList); }
CHashCheck( );
~CHashCheck() { InterlockedDecrement(&g_cRefThisDll); SLRelease(m_hList); DeleteObject(m_hMenuBitmap); }

// IUnknown members
STDMETHODIMP QueryInterface( REFIID, LPVOID * );
Expand Down
Binary file added HashCheck.bmp
Binary file not shown.
1 change: 1 addition & 0 deletions HashCheck.rc
Expand Up @@ -144,5 +144,6 @@ IDD_OPTIONS DIALOGEX 10, 10, 200, 264

IDR_RT_MANIFEST RT_MANIFEST "HashCheck.manifest"
IDI_FILETYPE ICON "HashCheck.ico"
IDI_MENUBITMAP BITMAP "HashCheck.bmp"

#include "HashCheckTranslations.rc"
9 changes: 5 additions & 4 deletions HashCheckResources.h
Expand Up @@ -3,12 +3,13 @@
#define IDR_RT_MANIFEST ISOLATIONAWARE_MANIFEST_RESOURCE_ID

#define IDI_FILETYPE 100
#define IDI_MENUBITMAP 101

// Controls common to multiple dialogs
#define IDC_PROG_TOTAL 101
#define IDC_PROG_FILE 102
#define IDC_PAUSE 103
#define IDC_STOP 104
#define IDC_PROG_TOTAL 102
#define IDC_PROG_FILE 103
#define IDC_PAUSE 104
#define IDC_STOP 105
#define IDC_OK IDOK
#define IDC_CANCEL IDCANCEL

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
@@ -1,4 +1,4 @@
version: 2.4.0.42-beta
version: 2.4.0.46-beta

image: Visual Studio 2015

Expand Down
8 changes: 4 additions & 4 deletions installer/HashCheck.nsi
Expand Up @@ -6,7 +6,7 @@
Unicode true

Name "HashCheck"
OutFile "HashCheckSetup-v2.4.0.42-beta.exe"
OutFile "HashCheckSetup-v2.4.0.46-beta.exe"

RequestExecutionLevel admin
ManifestSupportedOS all
Expand Down Expand Up @@ -53,13 +53,13 @@ FunctionEnd
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Catalan"

VIProductVersion "2.4.0.42-beta"
VIProductVersion "2.4.0.46-beta"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "HashCheck Shell Extension"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "2.4.0.42-beta"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "2.4.0.46-beta"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Installer distributed from https://github.com/gurnec/HashCheck/releases"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright © 2008-2016 Kai Liu, Christopher Gurnee, Tim Schlueter, et al. All rights reserved."
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Installer (x86/x64) from https://github.com/gurnec/HashCheck/releases"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "2.4.0.42-beta"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "2.4.0.46-beta"

; With solid compression, files that are required before the
; actual installation should be stored first in the data block,
Expand Down
4 changes: 2 additions & 2 deletions version.h
Expand Up @@ -12,10 +12,10 @@
#define HASHCHECK_NAME_STR "HashCheck Shell Extension"

// Full version: MUST be in the form of major,minor,revision,build
#define HASHCHECK_VERSION_FULL 2,4,0,42
#define HASHCHECK_VERSION_FULL 2,4,0,46

// String version: May be any suitable string
#define HASHCHECK_VERSION_STR "2.4.0.42-beta"
#define HASHCHECK_VERSION_STR "2.4.0.46-beta"

#ifdef _USRDLL
// PE version: MUST be in the form of major.minor
Expand Down

0 comments on commit 81d0919

Please sign in to comment.