From 8bfb987717dc3994bae1aaa78ece779c97340850 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 29 Aug 2015 09:33:23 +0000 Subject: AddToStartMenu functianally moved to Toaster git-svn-id: http://svn.miranda-ng.org/main/trunk@15083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddToStartMenu/AddToStartMenu.vcxproj | 57 -------- .../AddToStartMenu/AddToStartMenu.vcxproj.filters | 4 - plugins/AddToStartMenu/res/version.rc | 38 ------ plugins/AddToStartMenu/src/main.cpp | 143 --------------------- plugins/AddToStartMenu/src/stdafx.cxx | 18 --- plugins/AddToStartMenu/src/stdafx.h | 26 ---- plugins/AddToStartMenu/src/version.h | 14 -- plugins/Dropbox/src/stdafx.h | 2 +- plugins/Toaster/src/main.cpp | 8 +- plugins/Toaster/src/stdafx.h | 11 ++ 10 files changed, 14 insertions(+), 307 deletions(-) delete mode 100644 plugins/AddToStartMenu/AddToStartMenu.vcxproj delete mode 100644 plugins/AddToStartMenu/AddToStartMenu.vcxproj.filters delete mode 100644 plugins/AddToStartMenu/res/version.rc delete mode 100644 plugins/AddToStartMenu/src/main.cpp delete mode 100644 plugins/AddToStartMenu/src/stdafx.cxx delete mode 100644 plugins/AddToStartMenu/src/stdafx.h delete mode 100644 plugins/AddToStartMenu/src/version.h (limited to 'plugins') diff --git a/plugins/AddToStartMenu/AddToStartMenu.vcxproj b/plugins/AddToStartMenu/AddToStartMenu.vcxproj deleted file mode 100644 index d1067f1ec1..0000000000 --- a/plugins/AddToStartMenu/AddToStartMenu.vcxproj +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - AddToStartMenu - {2954e74f-57f3-421a-980c-681b54810c9a} - - - - - - $(VC_IncludePath);$(WindowsSdk_IncludePath); - $(VC_LibraryPath_x86);$(WindowsSdk_LibraryPath_x86); - - - $(VC_IncludePath);$(WindowsSdk_IncludePath); - $(VC_LibraryPath_x64);$(WindowsSdk_LibraryPath_x64); - - - $(VC_IncludePath);$(WindowsSdk_IncludePath); - $(VC_LibraryPath_x64);$(WindowsSdk_LibraryPath_x64); - - - $(VC_IncludePath);$(WindowsSdk_IncludePath); - $(VC_LibraryPath_x86);$(WindowsSdk_LibraryPath_x86); - - - - runtimeobject.lib;%(AdditionalDependencies) - - - - - MultiThreaded - - - /PDBALTPATH:%_PDB% - - - \ No newline at end of file diff --git a/plugins/AddToStartMenu/AddToStartMenu.vcxproj.filters b/plugins/AddToStartMenu/AddToStartMenu.vcxproj.filters deleted file mode 100644 index de5ad9f66c..0000000000 --- a/plugins/AddToStartMenu/AddToStartMenu.vcxproj.filters +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/plugins/AddToStartMenu/res/version.rc b/plugins/AddToStartMenu/res/version.rc deleted file mode 100644 index 5bfbab4754..0000000000 --- a/plugins/AddToStartMenu/res/version.rc +++ /dev/null @@ -1,38 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "afxres.h" -#include "..\src\version.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __FILEVERSION_STRING - PRODUCTVERSION __FILEVERSION_STRING - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x0L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "FileDescription", __DESCRIPTION - VALUE "InternalName", __PLUGIN_NAME - VALUE "LegalCopyright", __COPYRIGHT - VALUE "OriginalFilename", __FILENAME - VALUE "ProductName", __PLUGIN_NAME - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END diff --git a/plugins/AddToStartMenu/src/main.cpp b/plugins/AddToStartMenu/src/main.cpp deleted file mode 100644 index 6b3a86ebaa..0000000000 --- a/plugins/AddToStartMenu/src/main.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include "stdafx.h" - -using namespace Microsoft::WRL; - -int hLangpack; -HINSTANCE g_hInst; - -PLUGININFOEX pluginInfo = -{ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {61D5BB60-2249-4E3D-B23E-8FB86F04ED40} - { 0x61d5bb60, 0x2249, 0x4e3d, { 0xb2, 0x3e, 0x8f, 0xb8, 0x6f, 0x4, 0xed, 0x40 } } - -}; - -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) -{ - g_hInst = hInstance; - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) -{ - if (IsWinVer7Plus()) - return &pluginInfo; - return NULL; -} - -extern "C" int __declspec(dllexport) Load(void) -{ - mir_getLP(&pluginInfo); - - CreateServiceFunction(MODULENAME "/Add", Service); - - if (!ShortcutExists()) - { - CMenuItem mi; - mi.position = -0x7FFFFFFF; - //mi.hIcolibItem = icon.hIcolib; - mi.name.a = LPGEN("Add to start menu"); - mi.pszService = MODULENAME "/Add"; - Menu_AddMainMenuItem(&mi); - } - - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - return 0; -} - -INT_PTR Service(WPARAM, LPARAM) -{ - return (INT_PTR)TryCreateShortcut(); -} - -wchar_t* GetShortcutPath() -{ - wchar_t shortcutPath[MAX_PATH]; - GetEnvironmentVariable(_T("APPDATA"), shortcutPath, MAX_PATH); - wcscat_s(shortcutPath, ARRAYSIZE(shortcutPath), L"\\Microsoft\\Windows\\Start Menu\\Programs\\Miranda NG.lnk"); - - return mir_wstrdup(shortcutPath); -} - -HRESULT ShortcutExists() -{ - HRESULT hr; - DWORD attributes = GetFileAttributes(ptrW(GetShortcutPath())); - bool fileExists = attributes < 0xFFFFFFF; - - if (!fileExists) - { - hr = S_OK; - } - else - { - hr = S_FALSE; - } - return hr; -} - -HRESULT TryCreateShortcut() -{ - if (!ShortcutExists()) - return InstallShortcut(ptrW(GetShortcutPath())); - return S_FALSE; -} - -HRESULT InstallShortcut(_In_z_ wchar_t *shortcutPath) -{ - wchar_t exePath[MAX_PATH]; - GetModuleFileName(NULL, exePath, MAX_PATH); - - ComPtr shellLink; - HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); - if (SUCCEEDED(hr)) - { - hr = shellLink->SetPath(exePath); - if (SUCCEEDED(hr)) - { - hr = shellLink->SetArguments(L""); - if (SUCCEEDED(hr)) - { - ComPtr propertyStore; - hr = shellLink.As(&propertyStore); - if (SUCCEEDED(hr)) - { - PROPVARIANT appIdPropVar; - hr = InitPropVariantFromString(AppUserModelID, &appIdPropVar); - if (SUCCEEDED(hr)) - { - hr = propertyStore->SetValue(PKEY_AppUserModel_ID, appIdPropVar); - if (SUCCEEDED(hr)) - { - hr = propertyStore->Commit(); - if (SUCCEEDED(hr)) - { - ComPtr persistFile; - hr = shellLink.As(&persistFile); - if (SUCCEEDED(hr)) - { - hr = persistFile->Save(shortcutPath, TRUE); - } - } - } - PropVariantClear(&appIdPropVar); - } - } - } - } - } - return hr; -} diff --git a/plugins/AddToStartMenu/src/stdafx.cxx b/plugins/AddToStartMenu/src/stdafx.cxx deleted file mode 100644 index 6fb37564b7..0000000000 --- a/plugins/AddToStartMenu/src/stdafx.cxx +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "stdafx.h" \ No newline at end of file diff --git a/plugins/AddToStartMenu/src/stdafx.h b/plugins/AddToStartMenu/src/stdafx.h deleted file mode 100644 index 439407cffe..0000000000 --- a/plugins/AddToStartMenu/src/stdafx.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include "Version.h" - -DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5); - -const wchar_t AppUserModelID[] = _T("MirandaNG"); - -#define MODULENAME "AddToStartMenu" - -extern HINSTANCE g_hInst; - - -INT_PTR Service(WPARAM, LPARAM); -HRESULT ShortcutExists(); -wchar_t* GetShortcutPath(); -HRESULT TryCreateShortcut(); -HRESULT InstallShortcut(_In_z_ wchar_t *shortcutPath); diff --git a/plugins/AddToStartMenu/src/version.h b/plugins/AddToStartMenu/src/version.h deleted file mode 100644 index 6245eaaa1a..0000000000 --- a/plugins/AddToStartMenu/src/version.h +++ /dev/null @@ -1,14 +0,0 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 0 -#define __RELEASE_NUM 1 -#define __BUILD_NUM 0 - -#include - -#define __PLUGIN_NAME "AddToStartMenu" -#define __FILENAME "AddToStartMenu.dll" -#define __DESCRIPTION "Add portable miranda shortcut to windows start menu." -#define __AUTHOR "MikalaiR" -#define __AUTHOREMAIL "" -#define __AUTHORWEB "http://miranda-ng.org/p//" -#define __COPYRIGHT "© 2015 Miranda NG Team" diff --git a/plugins/Dropbox/src/stdafx.h b/plugins/Dropbox/src/stdafx.h index cf14580de3..d301bd55d9 100644 --- a/plugins/Dropbox/src/stdafx.h +++ b/plugins/Dropbox/src/stdafx.h @@ -41,7 +41,7 @@ class CDropbox; #define DROPBOX_API_URL "https://api.dropbox.com/" DROPBOX_API_VER #define DROPBOX_APICONTENT_URL "https://api-content.dropbox.com/" DROPBOX_API_VER -#define DROPBOX_APP_KEY "fa8du7gkf2q8xzg" +#define DROPBOX_APP_KEY "9x3rhyxfmhhzgtc" #include "..\..\..\miranda-private-keys\Dropbox\secret_key.h" #include "dropbox_dialogs.h" diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index 15bef82d99..ccfedcefa1 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -45,13 +45,9 @@ extern "C" int __declspec(dllexport) Load(void) if (IsWinVer8Plus() && !IsWinVer10Plus()) { - if (ServiceExists("AddToStartMenu/Add")) + if (FAILED(TryCreateShortcut())) { - CallService("AddToStartMenu/Add"); - } - else - { - MessageBox(NULL, TranslateT("In Windows8 desktop application must have a shortcut on the Start menu. Please, install \"AddToStartMenu\" plugin."), _T(MODULE), MB_OK | MB_ICONERROR); + MessageBox(NULL, TranslateT("Failed create shortcut"), _T(MODULE), MB_OK | MB_ICONERROR); } } diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h index a0dc262a7d..2e2e59cd1c 100644 --- a/plugins/Toaster/src/stdafx.h +++ b/plugins/Toaster/src/stdafx.h @@ -5,6 +5,8 @@ #include #include +#include +#include #include #include @@ -23,6 +25,7 @@ typedef void(__cdecl *pEventHandler)(void*); const wchar_t AppUserModelID[] = _T("MirandaNG"); +DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5); #include "string_reference_wrapper.h" #include "toast_event_handler.h" @@ -43,4 +46,12 @@ extern HINSTANCE g_hInstance; void InitServices(); int OnPreShutdown(WPARAM, LPARAM); + +INT_PTR Service(WPARAM, LPARAM); +HRESULT ShortcutExists(); +wchar_t* GetShortcutPath(); +HRESULT TryCreateShortcut(); +HRESULT InstallShortcut(_In_z_ wchar_t *shortcutPath); + + #endif //_COMMON_H_ -- cgit v1.2.3