From 9ee9547340e785ca4eb38294d975d6e1a3a567f2 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Thu, 5 Jul 2012 10:15:32 +0000 Subject: AutoRun: changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@766 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoRun/autorun-translation.txt | 10 -- plugins/AutoRun/autorun.h | 23 ----- plugins/AutoRun/autorun.rc | 82 --------------- plugins/AutoRun/autorun.txt | 50 ---------- plugins/AutoRun/autorun.vcxproj | 8 +- plugins/AutoRun/autorun.vcxproj.filters | 8 +- plugins/AutoRun/docs/autorun-translation.txt | 10 ++ plugins/AutoRun/docs/autorun.txt | 50 ++++++++++ plugins/AutoRun/main.cpp | 144 --------------------------- plugins/AutoRun/res/autorun.rc | 82 +++++++++++++++ plugins/AutoRun/resource.h | 17 ---- plugins/AutoRun/src/autorun.h | 23 +++++ plugins/AutoRun/src/main.cpp | 144 +++++++++++++++++++++++++++ plugins/AutoRun/src/resource.h | 17 ++++ 14 files changed, 334 insertions(+), 334 deletions(-) delete mode 100644 plugins/AutoRun/autorun-translation.txt delete mode 100644 plugins/AutoRun/autorun.h delete mode 100644 plugins/AutoRun/autorun.rc delete mode 100644 plugins/AutoRun/autorun.txt create mode 100644 plugins/AutoRun/docs/autorun-translation.txt create mode 100644 plugins/AutoRun/docs/autorun.txt delete mode 100644 plugins/AutoRun/main.cpp create mode 100644 plugins/AutoRun/res/autorun.rc delete mode 100644 plugins/AutoRun/resource.h create mode 100644 plugins/AutoRun/src/autorun.h create mode 100644 plugins/AutoRun/src/main.cpp create mode 100644 plugins/AutoRun/src/resource.h (limited to 'plugins') diff --git a/plugins/AutoRun/autorun-translation.txt b/plugins/AutoRun/autorun-translation.txt deleted file mode 100644 index 4dcc7415b2..0000000000 --- a/plugins/AutoRun/autorun-translation.txt +++ /dev/null @@ -1,10 +0,0 @@ -; Common strings that belong to many files -;[] - -; ../../plugins/AutoRun/autorun.rc -;[Autorun] -;[Launch Miranda IM at system startup] -;[Note: At startup Miranda IM will use current profile] - -; ../../plugins/AutoRun/main.cpp -;[Plugins] diff --git a/plugins/AutoRun/autorun.h b/plugins/AutoRun/autorun.h deleted file mode 100644 index 4d0900fcf0..0000000000 --- a/plugins/AutoRun/autorun.h +++ /dev/null @@ -1,23 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#define MIRANDA_VER 0x0A00 - -#include - -#include -#include -#include -#include -#include - -#include "resource.h" - -#define SUB_KEY _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run") -#define ModuleName "Autorun" - -// Plugin UUID for New plugin loader -// req. 0.7.18+ core -// {EB0465E2-CEEE-11DB-83EF-C1BF55D89593} - -#define MIID_AUTORUN {0xeb0465e2, 0xceee, 0x11db, { 0x83, 0xef, 0xc1, 0xbf, 0x55, 0xd8, 0x95, 0x93}} - -HKEY ROOT_KEY = HKEY_CURRENT_USER; diff --git a/plugins/AutoRun/autorun.rc b/plugins/AutoRun/autorun.rc deleted file mode 100644 index de10b17a40..0000000000 --- a/plugins/AutoRun/autorun.rc +++ /dev/null @@ -1,82 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -#ifdef _WIN32 -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_AUTORUN DIALOGEX 0, 0, 200, 90 -STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX "Autorun",0,3,3,193,60 - CONTROL "Launch Miranda IM at system startup",IDC_AUTORUN,"Button", - BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,15,20,165,10 - LTEXT "Note: At startup Miranda IM will use current profile", - IDC_STATIC,15,35,165,20,NOT WS_GROUP -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""autorun.h""\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/AutoRun/autorun.txt b/plugins/AutoRun/autorun.txt deleted file mode 100644 index cec7052075..0000000000 --- a/plugins/AutoRun/autorun.txt +++ /dev/null @@ -1,50 +0,0 @@ -Autorun 0.1.0.0 - -Written by and copyright (c) Sergey V. Gershovich a.k.a. Jazzy$, March 2003 - e-mail: jazzy@arcticsu.ru - -This plugin is a simple way to enable/disable to launch Miranda IM -with system startup. - - -***** DISCLAIMER OF WARRANTY ***** - -This software and the accompanying files are presented "AS IS" and without -warranties whether expressed or implied. Use it at your own risk. - -********************************** - -Usage ------- -Goto: Options->Plugins->Autorun - - -Version history ----------------------- -0.1.0.0: - Preparation for 0.8.x.x plugin loader - MIID_AUTORUN {EB0465E2-CEEE-11DB-83EF-C1BF55D89593} -0.0.0.3: - Decrease size of plugin to 3 kb - - Change image base address to: 0x30040000 - - Miranda IM v0.3alpha build 040303 or higher is required! - - Language strings updated - -0.0.0.2: - Some bugfix with long path & DB-filename - -0.0.0.1: - Initial release - - -Translation ------------ -"Autorun" can be translated with the Miranda IM language files - - -;; == Autorun v0.0.0.3 == - -;Name of plugin -;[Autorun] - -;Options page string -;[Launch Miranda IM at system startup] - -;Options page string -;[Note: At startup Miranda IM will use current profile] \ No newline at end of file diff --git a/plugins/AutoRun/autorun.vcxproj b/plugins/AutoRun/autorun.vcxproj index be6764f7ae..9d265fc3d4 100644 --- a/plugins/AutoRun/autorun.vcxproj +++ b/plugins/AutoRun/autorun.vcxproj @@ -173,14 +173,14 @@ - - + + - + - + diff --git a/plugins/AutoRun/autorun.vcxproj.filters b/plugins/AutoRun/autorun.vcxproj.filters index 15118eb49e..e0a1e8b887 100644 --- a/plugins/AutoRun/autorun.vcxproj.filters +++ b/plugins/AutoRun/autorun.vcxproj.filters @@ -15,20 +15,20 @@ - + Header Files - + Header Files - + Resource Files - + Source Files diff --git a/plugins/AutoRun/docs/autorun-translation.txt b/plugins/AutoRun/docs/autorun-translation.txt new file mode 100644 index 0000000000..4dcc7415b2 --- /dev/null +++ b/plugins/AutoRun/docs/autorun-translation.txt @@ -0,0 +1,10 @@ +; Common strings that belong to many files +;[] + +; ../../plugins/AutoRun/autorun.rc +;[Autorun] +;[Launch Miranda IM at system startup] +;[Note: At startup Miranda IM will use current profile] + +; ../../plugins/AutoRun/main.cpp +;[Plugins] diff --git a/plugins/AutoRun/docs/autorun.txt b/plugins/AutoRun/docs/autorun.txt new file mode 100644 index 0000000000..cec7052075 --- /dev/null +++ b/plugins/AutoRun/docs/autorun.txt @@ -0,0 +1,50 @@ +Autorun 0.1.0.0 + +Written by and copyright (c) Sergey V. Gershovich a.k.a. Jazzy$, March 2003 + e-mail: jazzy@arcticsu.ru + +This plugin is a simple way to enable/disable to launch Miranda IM +with system startup. + + +***** DISCLAIMER OF WARRANTY ***** + +This software and the accompanying files are presented "AS IS" and without +warranties whether expressed or implied. Use it at your own risk. + +********************************** + +Usage +------ +Goto: Options->Plugins->Autorun + + +Version history +---------------------- +0.1.0.0: - Preparation for 0.8.x.x plugin loader + MIID_AUTORUN {EB0465E2-CEEE-11DB-83EF-C1BF55D89593} +0.0.0.3: - Decrease size of plugin to 3 kb + - Change image base address to: 0x30040000 + - Miranda IM v0.3alpha build 040303 or higher is required! + - Language strings updated + +0.0.0.2: - Some bugfix with long path & DB-filename + +0.0.0.1: - Initial release + + +Translation +----------- +"Autorun" can be translated with the Miranda IM language files + + +;; == Autorun v0.0.0.3 == + +;Name of plugin +;[Autorun] + +;Options page string +;[Launch Miranda IM at system startup] + +;Options page string +;[Note: At startup Miranda IM will use current profile] \ No newline at end of file diff --git a/plugins/AutoRun/main.cpp b/plugins/AutoRun/main.cpp deleted file mode 100644 index 36eebd47f2..0000000000 --- a/plugins/AutoRun/main.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "autorun.h" - -HINSTANCE hInst; -HANDLE hHookOptionInit = NULL; -int hLangpack; - -PLUGININFOEX pluginInfoEx= -{ // about plugin - sizeof(PLUGININFOEX), - "Autorun", - PLUGIN_MAKE_VERSION(0,1,0,1), - "This plugin is a simple way to enable/disable to launch Miranda IM with system startup.", - "Sergey V. Gershovich a.k.a. Jazzy$ (fixed by Wolfram3D)", - "", - "Copyright © 2002-2007 Sergey V. Gershovich a.k.a. Jazzy$", - "http://miranda-im.org/download/index.php?action=viewfile&id=285", - UNICODE_AWARE, - MIID_AUTORUN -}; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - hInst = hinstDLL; - return TRUE; -} -void GetProfilePath(TCHAR *res) -{ - TCHAR dbname[MAX_PATH], dbpath[MAX_PATH], exename[MAX_PATH]; - CallService(MS_DB_GETPROFILENAMET, SIZEOF(dbname), (LPARAM)(TCHAR*) dbname); - CallService(MS_DB_GETPROFILEPATHT, SIZEOF(dbpath), (LPARAM)(TCHAR*) dbpath); - GetModuleFileName(NULL,exename, SIZEOF(exename)); - lstrcat(dbpath, _T("\\")); - lstrcpyn(dbpath + lstrlen(dbpath), dbname, lstrlen(dbname)-3); - lstrcat(dbpath, _T("\\")); - lstrcat(dbpath, dbname); // path + profile name - mir_sntprintf(res, lstrlen(exename) + lstrlen(dbpath) + 5, _T("\"%s\" \"%s\""), exename, dbpath); -} - -static void SetAutorun(BOOL autorun) -{ - HKEY hKey; - DWORD dw; - switch (autorun) - { - case TRUE: - if (RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) - { - TCHAR result[MAX_PATH]; - GetProfilePath(result); - RegSetValueEx(hKey, _T("MirandaIM"), 0, REG_SZ, (BYTE*)result, lstrlen(result)+1); - RegCloseKey(hKey); - break; - } - case FALSE: - if (RegOpenKey(ROOT_KEY, SUB_KEY, &hKey) == ERROR_SUCCESS) - { - RegDeleteValue(hKey, _T("MirandaIM")); - RegCloseKey(hKey); - break; - } - } -} - -static BOOL CmpCurrentAndRegistry() -{ - HKEY hKey; - DWORD dwBufLen = MAX_PATH; - TCHAR result[MAX_PATH], dbpath[MAX_PATH]; - GetProfilePath(result); - - if (RegOpenKeyEx(ROOT_KEY, SUB_KEY, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) - { - if (RegQueryValueEx(hKey, _T("MirandaIM"), NULL, NULL, (LPBYTE)dbpath, &dwBufLen) == ERROR_SUCCESS) - { - return (lstrcmpi(result,dbpath) == 0 ? TRUE : FALSE); - } - else - return FALSE; - } - else - return FALSE; -} - -static INT_PTR CALLBACK DlgProcAutorunOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg,IDC_AUTORUN,CmpCurrentAndRegistry()); // Check chekbox if Registry value exists - return TRUE; - case WM_COMMAND: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); // Send message to activate "Apply" button - return TRUE; - break; - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: // if "Apply" pressed then... - SetAutorun(IsDlgButtonChecked(hwndDlg,IDC_AUTORUN)); //Save changes to registry; - return TRUE; - } - break; - } - break; - } - return FALSE; -} - -static int AutorunOptInitialise(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = 100100000; - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTORUN); - odp.pszTitle = LPGEN(ModuleName); - odp.pszGroup = LPGEN("Plugins"); - odp.pfnDlgProc = DlgProcAutorunOpts; - odp.flags = ODPF_BOLDGROUPS; - Options_AddPage(wParam, &odp); - return 0; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfoEx; -} - -extern "C" __declspec(dllexport) int Load(void) -{ - mir_getLP(&pluginInfoEx); - hHookOptionInit = HookEvent(ME_OPT_INITIALISE, AutorunOptInitialise); - return 0; -} - -extern "C" __declspec(dllexport) int Unload(void) -{ - if (hHookOptionInit) - UnhookEvent(hHookOptionInit); - return 0; -} \ No newline at end of file diff --git a/plugins/AutoRun/res/autorun.rc b/plugins/AutoRun/res/autorun.rc new file mode 100644 index 0000000000..75a2458f55 --- /dev/null +++ b/plugins/AutoRun/res/autorun.rc @@ -0,0 +1,82 @@ +//Microsoft Developer Studio generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Russian resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) +#ifdef _WIN32 +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_AUTORUN DIALOGEX 0, 0, 200, 90 +STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Autorun",0,3,3,193,60 + CONTROL "Launch Miranda IM at system startup",IDC_AUTORUN,"Button", + BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,15,20,165,10 + LTEXT "Note: At startup Miranda IM will use current profile", + IDC_STATIC,15,35,165,20,NOT WS_GROUP +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "..\src\resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""autorun.h""\r\n" + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Russian resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/AutoRun/resource.h b/plugins/AutoRun/resource.h deleted file mode 100644 index 75fd39b582..0000000000 --- a/plugins/AutoRun/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by autorun.rc -// -#define IDD_OPT_AUTORUN 101 -#define IDC_AUTORUN 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/AutoRun/src/autorun.h b/plugins/AutoRun/src/autorun.h new file mode 100644 index 0000000000..4d0900fcf0 --- /dev/null +++ b/plugins/AutoRun/src/autorun.h @@ -0,0 +1,23 @@ +#define _CRT_SECURE_NO_WARNINGS +#define MIRANDA_VER 0x0A00 + +#include + +#include +#include +#include +#include +#include + +#include "resource.h" + +#define SUB_KEY _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run") +#define ModuleName "Autorun" + +// Plugin UUID for New plugin loader +// req. 0.7.18+ core +// {EB0465E2-CEEE-11DB-83EF-C1BF55D89593} + +#define MIID_AUTORUN {0xeb0465e2, 0xceee, 0x11db, { 0x83, 0xef, 0xc1, 0xbf, 0x55, 0xd8, 0x95, 0x93}} + +HKEY ROOT_KEY = HKEY_CURRENT_USER; diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp new file mode 100644 index 0000000000..36eebd47f2 --- /dev/null +++ b/plugins/AutoRun/src/main.cpp @@ -0,0 +1,144 @@ +#include "autorun.h" + +HINSTANCE hInst; +HANDLE hHookOptionInit = NULL; +int hLangpack; + +PLUGININFOEX pluginInfoEx= +{ // about plugin + sizeof(PLUGININFOEX), + "Autorun", + PLUGIN_MAKE_VERSION(0,1,0,1), + "This plugin is a simple way to enable/disable to launch Miranda IM with system startup.", + "Sergey V. Gershovich a.k.a. Jazzy$ (fixed by Wolfram3D)", + "", + "Copyright © 2002-2007 Sergey V. Gershovich a.k.a. Jazzy$", + "http://miranda-im.org/download/index.php?action=viewfile&id=285", + UNICODE_AWARE, + MIID_AUTORUN +}; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst = hinstDLL; + return TRUE; +} +void GetProfilePath(TCHAR *res) +{ + TCHAR dbname[MAX_PATH], dbpath[MAX_PATH], exename[MAX_PATH]; + CallService(MS_DB_GETPROFILENAMET, SIZEOF(dbname), (LPARAM)(TCHAR*) dbname); + CallService(MS_DB_GETPROFILEPATHT, SIZEOF(dbpath), (LPARAM)(TCHAR*) dbpath); + GetModuleFileName(NULL,exename, SIZEOF(exename)); + lstrcat(dbpath, _T("\\")); + lstrcpyn(dbpath + lstrlen(dbpath), dbname, lstrlen(dbname)-3); + lstrcat(dbpath, _T("\\")); + lstrcat(dbpath, dbname); // path + profile name + mir_sntprintf(res, lstrlen(exename) + lstrlen(dbpath) + 5, _T("\"%s\" \"%s\""), exename, dbpath); +} + +static void SetAutorun(BOOL autorun) +{ + HKEY hKey; + DWORD dw; + switch (autorun) + { + case TRUE: + if (RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) + { + TCHAR result[MAX_PATH]; + GetProfilePath(result); + RegSetValueEx(hKey, _T("MirandaIM"), 0, REG_SZ, (BYTE*)result, lstrlen(result)+1); + RegCloseKey(hKey); + break; + } + case FALSE: + if (RegOpenKey(ROOT_KEY, SUB_KEY, &hKey) == ERROR_SUCCESS) + { + RegDeleteValue(hKey, _T("MirandaIM")); + RegCloseKey(hKey); + break; + } + } +} + +static BOOL CmpCurrentAndRegistry() +{ + HKEY hKey; + DWORD dwBufLen = MAX_PATH; + TCHAR result[MAX_PATH], dbpath[MAX_PATH]; + GetProfilePath(result); + + if (RegOpenKeyEx(ROOT_KEY, SUB_KEY, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + { + if (RegQueryValueEx(hKey, _T("MirandaIM"), NULL, NULL, (LPBYTE)dbpath, &dwBufLen) == ERROR_SUCCESS) + { + return (lstrcmpi(result,dbpath) == 0 ? TRUE : FALSE); + } + else + return FALSE; + } + else + return FALSE; +} + +static INT_PTR CALLBACK DlgProcAutorunOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg,IDC_AUTORUN,CmpCurrentAndRegistry()); // Check chekbox if Registry value exists + return TRUE; + case WM_COMMAND: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); // Send message to activate "Apply" button + return TRUE; + break; + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: // if "Apply" pressed then... + SetAutorun(IsDlgButtonChecked(hwndDlg,IDC_AUTORUN)); //Save changes to registry; + return TRUE; + } + break; + } + break; + } + return FALSE; +} + +static int AutorunOptInitialise(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.position = 100100000; + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTORUN); + odp.pszTitle = LPGEN(ModuleName); + odp.pszGroup = LPGEN("Plugins"); + odp.pfnDlgProc = DlgProcAutorunOpts; + odp.flags = ODPF_BOLDGROUPS; + Options_AddPage(wParam, &odp); + return 0; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfoEx; +} + +extern "C" __declspec(dllexport) int Load(void) +{ + mir_getLP(&pluginInfoEx); + hHookOptionInit = HookEvent(ME_OPT_INITIALISE, AutorunOptInitialise); + return 0; +} + +extern "C" __declspec(dllexport) int Unload(void) +{ + if (hHookOptionInit) + UnhookEvent(hHookOptionInit); + return 0; +} \ No newline at end of file diff --git a/plugins/AutoRun/src/resource.h b/plugins/AutoRun/src/resource.h new file mode 100644 index 0000000000..75fd39b582 --- /dev/null +++ b/plugins/AutoRun/src/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by autorun.rc +// +#define IDD_OPT_AUTORUN 101 +#define IDC_AUTORUN 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.2.3