summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2014-12-25 00:30:09 +0000
committerRené Schümann <white06tiger@gmail.com>2014-12-25 00:30:09 +0000
commitf1854df3ba57b0358c893884d56d6826e25f344d (patch)
treec78083d6fc677729fc86f895ab4695c899ed86e3
parente5c1ba56b7f6ef24279b5e7cda3759b2e68e4c8d (diff)
SendSS:
* global.h is now more global removed Main.h dependency removed MODNAME define (just a dupe of SZ_SENDSS) hInst -> g_hSendSS myGlobals -> g_myGlobals hNetlibUser -> g_hNetlibUser * restructured Main.cpp by reordering functions to be more logically placed * Main.h now only holds DLL_EXPORT functions git-svn-id: http://svn.miranda-ng.org/main/trunk@11608 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp4
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp4
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp4
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp4
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp390
-rw-r--r--plugins/SendScreenshotPlus/src/Main.h37
-rw-r--r--plugins/SendScreenshotPlus/src/UAboutForm.cpp14
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.cpp20
-rw-r--r--plugins/SendScreenshotPlus/src/ctrl_button.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/dlg_msgbox.cpp30
-rw-r--r--plugins/SendScreenshotPlus/src/global.h9
-rw-r--r--plugins/SendScreenshotPlus/src/mir_icolib.h58
12 files changed, 263 insertions, 313 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index cc1e5d40c7..cd6aaa856c 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -382,7 +382,7 @@ void CSend::DB_EventAdd(WORD EventType)
void CSend::Error(LPCTSTR pszFormat, ...) {
TCHAR tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszMsg, SIZEOF(tszMsg),_T("%s - %s") ,_T(MODNAME), TranslateT("Error"));
+ mir_sntprintf(tszMsg, SIZEOF(tszMsg),_T("%s - %s") ,_T(SZ_SENDSS), TranslateT("Error"));
mir_free(m_ErrorTitle), m_ErrorTitle = mir_tstrdup(tszMsg);
va_list vl;
@@ -408,7 +408,7 @@ void CSend::Exit(unsigned int Result) {
switch(Result) {
case CSEND_DIALOG:
SkinPlaySound("FileDone");
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UResultForm),0, ResultDialogProc,(LPARAM)this);
+ DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_UResultForm),0, ResultDialogProc,(LPARAM)this);
err = false;
break;
case ACKRESULT_SUCCESS:
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
index d53a11c495..85b82fa348 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
@@ -41,7 +41,7 @@ CSendHost_ImageShack::~CSendHost_ImageShack(){
//---------------------------------------------------------------------------
int CSendHost_ImageShack::Send() {
- if(!hNetlibUser){ /// check Netlib
+ if(!g_hNetlibUser){ /// check Netlib
Error(SS_ERR_INIT, m_pszSendTyp);
Exit(ACKRESULT_FAILED);
return !m_bAsync;
@@ -70,7 +70,7 @@ int CSendHost_ImageShack::Send() {
void CSendHost_ImageShack::SendThread() {
/// send DATA and wait for m_nlreply
- NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&m_nlhr);
+ NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&m_nlhr);
HTTPFormDestroy(&m_nlhr);
if(reply){
if(reply->resultCode>=200 && reply->resultCode<300 && reply->dataLength){
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
index 77be71704f..830ce71454 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
@@ -28,7 +28,7 @@ CSendHost_Imgur::~CSendHost_Imgur()
//---------------------------------------------------------------------------
int CSendHost_Imgur::Send()
{
- if(!hNetlibUser){ /// check Netlib
+ if(!g_hNetlibUser){ /// check Netlib
Error(SS_ERR_INIT, m_pszSendTyp);
Exit(ACKRESULT_FAILED);
return !m_bAsync;
@@ -59,7 +59,7 @@ void CSendHost_Imgur::SendThread(void* obj)
{
CSendHost_Imgur* self=(CSendHost_Imgur*)obj;
/// send DATA and wait for m_nlreply
- NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&self->m_nlhr);
+ NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)g_hNetlibUser,(LPARAM)&self->m_nlhr);
self->HTTPFormDestroy(&self->m_nlhr);
if(reply){
if(reply->dataLength){
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
index a3a640b986..a19cfa3ced 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
@@ -28,7 +28,7 @@ CSendHost_UploadPie::~CSendHost_UploadPie()
//---------------------------------------------------------------------------
int CSendHost_UploadPie::Send()
{
- if(!hNetlibUser){ /// check Netlib
+ if(!g_hNetlibUser){ /// check Netlib
Error(SS_ERR_INIT, m_pszSendTyp);
Exit(ACKRESULT_FAILED);
return !m_bAsync;
@@ -64,7 +64,7 @@ void CSendHost_UploadPie::SendThread(void* obj)
{
CSendHost_UploadPie* self=(CSendHost_UploadPie*)obj;
/// send DATA and wait for m_nlreply
- NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&self->m_nlhr);
+ NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)g_hNetlibUser,(LPARAM)&self->m_nlhr);
self->HTTPFormDestroy(&self->m_nlhr);
if(reply){
if(reply->resultCode>=200 && reply->resultCode<300 && reply->dataLength){
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index 4a758d1c09..ebfea3f228 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -26,154 +26,69 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "global.h"
+#include "Main.h"
#include <m_hotkeys.h>
// Prototypes ///////////////////////////////////////////////////////////////////////////
-//LIST_INTERFACE li;
-FI_INTERFACE *FIP = 0;
-HINSTANCE hInst; //!< Global reference to the application
-MGLOBAL myGlobals;
-int hLangpack;
+HINSTANCE g_hSendSS;
+MGLOBAL g_myGlobals;
+HANDLE g_hNetlibUser=0;//!< Netlib Register User
+FI_INTERFACE* FIP=NULL;
+int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP()
-//Information gathered by Miranda, displayed in the plugin pane of the Option Dialog
-PLUGININFOEX pluginInfo={
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {ED39AF7C-BECD-404E-9499-4D04F711B9CB}
- {0xed39af7c, 0xbecd, 0x404e, {0x94, 0x99, 0x4d, 0x04, 0xf7, 0x11, 0xb9, 0xcb}}
-};
+HANDLE hFolderScreenshot=0;
+TCHAR* GetCustomPath() {
+ TCHAR* pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\Screenshots"));
+ if(hFolderScreenshot){
+ TCHAR szPath[1024]={0};
+ FoldersGetCustomPathT(hFolderScreenshot, szPath, 1024, pszPath);
+ mir_free(pszPath);
+ pszPath = mir_tstrdup(szPath);
+ }
+ if(!pszPath){
+ MessageBox(NULL, _T("Can not retrieve Screenshot path."), _T("Send Screenshot"), MB_OK | MB_ICONERROR | MB_APPLMODAL);
+ return 0;
+ }
+ int result = CreateDirectoryTreeT(pszPath);
+ if(result){
+ TCHAR szError[MAX_PATH];
+ mir_sntprintf(szError,MAX_PATH,TranslateT("Could not create Screenshot folder (error code: %d):\n%s\nDo you have write permissions?"),result,pszPath);
+ MessageBox(NULL, szError, _T("Send Screenshot"), MB_OK | MB_ICONERROR | MB_APPLMODAL);
+ mir_free(pszPath);
+ return 0;
+ }
+ return pszPath;
+}
+/// services
HANDLE hsvc_SendScreenshot=0;
HANDLE hsvc_SendDesktop=0;
HANDLE hsvc_EditBitmap=0;
HANDLE hsvc_Send2ImageShack=0;
-
-HANDLE hNetlibUser = 0; //!< Netlib Register User
-HANDLE hFolderScreenshot=0;
-
-// Functions ////////////////////////////////////////////////////////////////////////////
-
-/*---------------------------------------------------------------------------
-* DLL entry point - Required to store the instance handle
-*/
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- hInst=hinstDLL;
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------
-* Called by Miranda to get the information associated to this plugin.
-* It only returns the PLUGININFO structure, without any test on the version
-* @param mirandaVersion The version of the application calling this function
-*/
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- return &pluginInfo;
-}
-
-
-/*---------------------------------------------------------------------------
-* Initializes the services provided and the link to those needed
-* Called when the plugin is loaded into Miranda
-*/
-ATOM g_clsTargetHighlighter=0;
-HANDLE g_hookModulesLoaded=0;
-HANDLE g_hookSystemPreShutdown=0;
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
- INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
-
- if(FIP == NULL || result != S_OK) {
- MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. SendScreenshot will be disabled."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
- return 1;
+//---------------------------------------------------------------------------
+// Callback function of service for contact menu and main menu
+// wParam = contact handle
+// lParam = 0
+INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam){
+ TfrmMain* frmMain=new TfrmMain();
+ if(!frmMain) {
+ MessageBoxEx(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
+ return -1;
}
-
- // load icon library (use UserInfoEx icon Pack)
- IcoLib_LoadModule();
-
- g_hookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED, hook_ModulesLoaded);
- g_hookSystemPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN, hook_SystemPreShutdown);
-
- RegisterServices();
- AddMenuItems();
-
- //hotkey's
- HOTKEYDESC hkd={sizeof(hkd)};
- hkd.pszName="Open SendSS+";
- hkd.ptszDescription=LPGENT("Open SendSS+");
- hkd.ptszSection=_T("SendSS+");
- hkd.pszService=MS_SENDSS_OPENDIALOG;
- //hkd.DefHotKey=HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
- hkd.lParam=0xFFFF;
- hkd.dwFlags = HKD_TCHAR;
- Hotkey_Register(&hkd);
-
- HBRUSH brush=CreateSolidBrush(0x0000FF00);//owned by class
- WNDCLASS wndclass={CS_HREDRAW|CS_VREDRAW,DefWindowProc,0,0,hInst,NULL,NULL,brush,NULL,L"SendSSHighlighter"};
- g_clsTargetHighlighter=RegisterClass(&wndclass);
- return 0;
-}
-
-int hook_ModulesLoaded(WPARAM, LPARAM)
-{
- myGlobals.PopupExist = ServiceExists(MS_POPUP_ADDPOPUPT);
- myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
- myGlobals.PluginHTTPExist = ServiceExists(MS_HTTP_ACCEPT_CONNECTIONS);
- myGlobals.PluginFTPExist = ServiceExists(MS_FTPFILE_SHAREFILE);
- myGlobals.PluginDropboxExist = ServiceExists(MS_DROPBOX_SEND_FILE);
-
- // Netlib register
- NetlibInit();
-
- // load my button class / or use UInfoEx
- CtrlButtonLoadModule();
-
- // Folders plugin support
- hFolderScreenshot = FoldersRegisterCustomPathT(LPGEN("SendSS"), LPGEN("Screenshots"),
- _T(PROFILE_PATH)_T("\\")_T(CURRENT_PROFILE)_T("\\Screenshots"));
-
- return 0;
-}
-
-/*---------------------------------------------------------------------------
-* Prepare the plugin to stop
-* Called by Miranda when it will exit or when the plugin gets deselected
-*/
-
-extern "C" __declspec(dllexport) int Unload(void)
-{//as "ghazan" says, it's useless to unregister services or unhook events, let's still do it for now :P
- CallService(MS_HOTKEY_UNREGISTER,0,(LPARAM)"Open SendSS+");
- UnRegisterServices();
- if(g_hookModulesLoaded) UnhookEvent(g_hookModulesLoaded),g_hookModulesLoaded=0;
- if(g_hookSystemPreShutdown) UnhookEvent(g_hookSystemPreShutdown),g_hookSystemPreShutdown=0;
- if(g_clsTargetHighlighter) UnregisterClass((TCHAR*)g_clsTargetHighlighter,hInst),g_clsTargetHighlighter=0;
- return 0;
-}
-
-int hook_SystemPreShutdown(WPARAM wParam, LPARAM lParam)
-{
- TfrmAbout::Unload();//crashes if done from "Unload" because of dependencies
- TfrmMain::Unload();// "
-
- // Netlib unregister
- NetlibClose();
-
- // uninitialize classes
- CtrlButtonUnloadModule();
+ TCHAR* pszPath=GetCustomPath();
+ if(!pszPath){
+ delete frmMain;
+ return -1;
+ }
+ frmMain->Init(pszPath, wParam);
+ mir_free(pszPath);
+ if(lParam==0xFFFF){
+ frmMain->SetTargetWindow(NULL);
+ }
+ frmMain->Show();
return 0;
}
-
//---------------------------------------------------------------------------
// Netlib
HANDLE NetlibInit(void)
@@ -182,11 +97,41 @@ HANDLE NetlibInit(void)
nlu.szSettingsModule = __PLUGIN_NAME;
nlu.ptszDescriptiveName = TranslateT("SendSS HTTP connections");
nlu.flags = NUF_OUTGOING|NUF_HTTPCONNS|NUF_TCHAR; //|NUF_NOHTTPSOPTION;
- return hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ return g_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
}
void NetlibClose(void) {
- Netlib_CloseHandle(hNetlibUser);
+ Netlib_CloseHandle(g_hNetlibUser);
+}
+//---------------------------------------------------------------------------
+// Add SendSS menu item in contact menu
+void AddMenuItems(void)
+{
+ // Common
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
+ mi.hParentMenu = HGENMENU_ROOT;
+
+ // Add item to contact menu
+ mi.position = 1000000;
+ mi.ptszName = LPGENT("Send Screenshot");
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_SSWINDOW2);
+ mi.pszService = MS_SENDSS_OPENDIALOG;
+ Menu_AddContactMenuItem(&mi);
+
+ // Add item to contact menu
+ mi.position = 1000001;
+ mi.ptszName = LPGENT("Send desktop screenshot");
+// mi.hIcon = Skin_GetIcon(ICO_COMMON_SSWINDOW2);
+ mi.pszService = MS_SENDSS_SENDDESKTOP;
+ Menu_AddContactMenuItem(&mi);
+
+ // Add item to main menu
+ mi.position = 1000001;
+ mi.ptszName = LPGENT("Take a screenshot");
+// mi.hIcon = Skin_GetIcon(ICO_COMMON_SSWINDOW2);
+ mi.pszService = MS_SENDSS_OPENDIALOG;
+ Menu_AddMainMenuItem(&mi);
}
@@ -222,31 +167,6 @@ INT_PTR service_CaptureAndSendDesktop(WPARAM wParam, LPARAM lParam) {
frmMain->btnCaptureClick(); // this method will call Close()
return 0;
}
-
-//---------------------------------------------------------------------------
-// Callback function of service for contact menu and main menu
-// wParam = contact handle
-// lParam = 0
-INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam){
- TfrmMain* frmMain=new TfrmMain();
- if(!frmMain) {
- MessageBoxEx(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
- return -1;
- }
- TCHAR* pszPath=GetCustomPath();
- if(!pszPath){
- delete frmMain;
- return -1;
- }
- frmMain->Init(pszPath, wParam);
- mir_free(pszPath);
- if(lParam==0xFFFF){
- frmMain->SetTargetWindow(NULL);
- }
- frmMain->Show();
- return 0;
-}
-
//---------------------------------------------------------------------------
// Edit a in-memory bitmap on the edit window
// wParam = (SENDSSCB) callback function address to call when editing is done
@@ -268,7 +188,6 @@ INT_PTR service_EditBitmap(WPARAM wParam, LPARAM lParam) {
*/
return 0;
}
-
//---------------------------------------------------------------------------
// Callback function of service for sending image to imageshack.us
// wParam = (char*)filename
@@ -292,35 +211,63 @@ INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) {
return (INT_PTR)result;
}
-//---------------------------------------------------------------------------
-// Add SendSS menu item in contact menu
-void AddMenuItems(void)
+// Functions ////////////////////////////////////////////////////////////////////////////
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
- // Common
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
- mi.hParentMenu = HGENMENU_ROOT;
+ g_hSendSS=hinstDLL;
+ return TRUE;
+}
+PLUGININFOEX pluginInfo={
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ // {ED39AF7C-BECD-404E-9499-4D04F711B9CB}
+ {0xed39af7c, 0xbecd, 0x404e, {0x94, 0x99, 0x4d, 0x04, 0xf7, 0x11, 0xb9, 0xcb}}
+};
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+/// hooks
+HANDLE g_hookModulesLoaded=0;
+HANDLE g_hookSystemPreShutdown=0;
+int hook_ModulesLoaded(WPARAM, LPARAM)
+{
+ g_myGlobals.PopupExist = ServiceExists(MS_POPUP_ADDPOPUPT);
+ g_myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
+ g_myGlobals.PluginHTTPExist = ServiceExists(MS_HTTP_ACCEPT_CONNECTIONS);
+ g_myGlobals.PluginFTPExist = ServiceExists(MS_FTPFILE_SHAREFILE);
+ g_myGlobals.PluginDropboxExist = ServiceExists(MS_DROPBOX_SEND_FILE);
- // Add item to contact menu
- mi.position = 1000000;
- mi.ptszName = LPGENT("Send Screenshot");
- mi.hIcon = Skin_GetIcon(ICO_COMMON_SSWINDOW2);
- mi.pszService = MS_SENDSS_OPENDIALOG;
- Menu_AddContactMenuItem(&mi);
+ // Netlib register
+ NetlibInit();
- // Add item to contact menu
- mi.position = 1000001;
- mi.ptszName = LPGENT("Send desktop screenshot");
-// mi.hIcon = Skin_GetIcon(ICO_COMMON_SSWINDOW2);
- mi.pszService = MS_SENDSS_SENDDESKTOP;
- Menu_AddContactMenuItem(&mi);
+ // load my button class / or use UInfoEx
+ CtrlButtonLoadModule();
- // Add item to main menu
- mi.position = 1000001;
- mi.ptszName = LPGENT("Take a screenshot");
-// mi.hIcon = Skin_GetIcon(ICO_COMMON_SSWINDOW2);
- mi.pszService = MS_SENDSS_OPENDIALOG;
- Menu_AddMainMenuItem(&mi);
+ // Folders plugin support
+ hFolderScreenshot = FoldersRegisterCustomPathT(LPGEN("SendSS"), LPGEN("Screenshots"),
+ _T(PROFILE_PATH)_T("\\")_T(CURRENT_PROFILE)_T("\\Screenshots"));
+
+ return 0;
+}
+int hook_SystemPreShutdown(WPARAM wParam, LPARAM lParam)
+{
+ TfrmAbout::Unload();//crashes if done from "Unload" because of dependencies
+ TfrmMain::Unload();// "
+
+ // Netlib unregister
+ NetlibClose();
+
+ // uninitialize classes
+ CtrlButtonUnloadModule();
+ return 0;
}
//---------------------------------------------------------------------------
@@ -354,28 +301,53 @@ int UnRegisterServices(){
return 0;
}
-//---------------------------------------------------------------------------
-TCHAR* GetCustomPath() {
- TCHAR* pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\Screenshots"));
- if(hFolderScreenshot){
- TCHAR szPath[1024]={0};
- FoldersGetCustomPathT(hFolderScreenshot, szPath, 1024, pszPath);
- mir_free(pszPath);
- pszPath = mir_tstrdup(szPath);
- }
- if(!pszPath){
- MessageBox(NULL, _T("Can not retrieve Screenshot path."), _T("Send Screenshot"), MB_OK | MB_ICONERROR | MB_APPLMODAL);
- return 0;
+ATOM g_clsTargetHighlighter=0;
+extern "C" __declspec(dllexport) int Load(void)
+{
+ mir_getLP(&pluginInfo);
+ INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
+
+ if(FIP == NULL || result != S_OK) {
+ MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. SendScreenshot will be disabled."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
+ return 1;
}
- int result = CreateDirectoryTreeT(pszPath);
- if(result){
- TCHAR szError[MAX_PATH];
+ mir_sntprintf(szError,SIZEOF(szError),TranslateT("Could not create Screenshot folder (error code: %d):\n%s\nDo you have write permissions?"),result,pszPath);
+ // load icon library (use UserInfoEx icon Pack)
+ IcoLib_LoadModule();
- mir_sntprintf(szError, SIZEOF(szError), TranslateT("Could not create Screenshot folder (error code: %d):\n%s\nDo you have write permissions?"), result, pszPath);
- MessageBox(NULL, szError, _T("Send Screenshot"), MB_OK | MB_ICONERROR | MB_APPLMODAL);
- mir_free(pszPath);
- return 0;
- }
- return pszPath;
+ g_hookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED, hook_ModulesLoaded);
+ g_hookSystemPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN, hook_SystemPreShutdown);
+
+ RegisterServices();
+ AddMenuItems();
+
+ //hotkey's
+ HOTKEYDESC hkd={sizeof(hkd)};
+ hkd.pszName="Open SendSS+";
+ hkd.ptszDescription=LPGENT("Open SendSS+");
+ hkd.ptszSection=_T("SendSS+");
+ hkd.pszService=MS_SENDSS_OPENDIALOG;
+ //hkd.DefHotKey=HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
+ hkd.lParam=0xFFFF;
+ hkd.dwFlags = HKD_TCHAR;
+ Hotkey_Register(&hkd);
+
+ HBRUSH brush=CreateSolidBrush(0x0000FF00);//owned by class
+ WNDCLASS wndclass={CS_HREDRAW|CS_VREDRAW,DefWindowProc,0,0,g_hSendSS,NULL,NULL,brush,NULL,L"SendSSHighlighter"};
+ g_clsTargetHighlighter=RegisterClass(&wndclass);
+ return 0;
+}
+/*---------------------------------------------------------------------------
+* Prepare the plugin to stop
+* Called by Miranda when it will exit or when the plugin gets deselected
+*/
+extern "C" __declspec(dllexport) int Unload(void)
+{//as "ghazan" says, it's useless to unregister services or unhook events, let's still do it for now :P
+ CallService(MS_HOTKEY_UNREGISTER,0,(LPARAM)"Open SendSS+");
+ UnRegisterServices();
+ if(g_hookModulesLoaded) UnhookEvent(g_hookModulesLoaded),g_hookModulesLoaded=0;
+ if(g_hookSystemPreShutdown) UnhookEvent(g_hookSystemPreShutdown),g_hookSystemPreShutdown=0;
+ if(g_clsTargetHighlighter) UnregisterClass((TCHAR*)g_clsTargetHighlighter,g_hSendSS),g_clsTargetHighlighter=0;
+ return 0;
}
diff --git a/plugins/SendScreenshotPlus/src/Main.h b/plugins/SendScreenshotPlus/src/Main.h
index 17fc5add7e..4b84849e26 100644
--- a/plugins/SendScreenshotPlus/src/Main.h
+++ b/plugins/SendScreenshotPlus/src/Main.h
@@ -28,33 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef MainH
#define MainH
-
-//---------------------------------------------------------------------------
-
-extern ATOM g_clsTargetHighlighter;
-extern HANDLE hNetlibUser;
-
-//---------------------------------------------------------------------------
-
-HANDLE NetlibInit();
-void NetlibClose();
-
-void IcoLib_LoadModule();
-void AddMenuItems();
-int RegisterServices();
-int UnRegisterServices();
-
-int hook_ModulesLoaded(WPARAM, LPARAM);
-int hook_SystemPreShutdown(WPARAM wParam, LPARAM lParam);
-
-INT_PTR service_CaptureAndSendDesktop(WPARAM wParam, LPARAM lParam);
-INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam);
-INT_PTR service_EditBitmap(WPARAM wParam, LPARAM lParam);
-INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam);
-
-int OnSendScreenShot(WPARAM wParam, LPARAM lParam);
-
-TCHAR* GetCustomPath();
-
-//---------------------------------------------------------------------------
+#include "global.h"
+
+#define DLL_EXPORT __declspec(dllexport)
+extern "C"{
+DLL_EXPORT PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion);
+DLL_EXPORT int Load(void);
+DLL_EXPORT int Unload(void);
+}
#endif
diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
index e587697bdd..987b24c847 100644
--- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
@@ -107,9 +107,9 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM wParam, LPARAM lParam) {
{ mir_tcsadd(pszTitle ,_T(__COPYRIGHT));
mir_tcsadd(pszTitle ,_T("\r\n\r\n"));
- hResInfo = FindResource(hInst,MAKEINTRESOURCE(IDR_LICENSE),_T("TEXT"));
- ResSize = SizeofResource(hInst,hResInfo);
- pszMsg = (char*)LockResource(LoadResource(hInst,hResInfo));
+ hResInfo = FindResource(g_hSendSS,MAKEINTRESOURCE(IDR_LICENSE),_T("TEXT"));
+ ResSize = SizeofResource(g_hSendSS,hResInfo);
+ pszMsg = (char*)LockResource(LoadResource(g_hSendSS,hResInfo));
temp = mir_a2t(pszMsg);
temp [ResSize] = 0; //LockResource is not NULL terminatet !!
mir_tcsadd(pszTitle ,temp);
@@ -120,9 +120,9 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM wParam, LPARAM lParam) {
//Credit
{
- hResInfo = FindResource(hInst,MAKEINTRESOURCE(IDR_CREDIT),_T("TEXT"));
- ResSize = SizeofResource(hInst,hResInfo);
- pszMsg = (char*)LockResource(LoadResource(hInst,hResInfo));
+ hResInfo = FindResource(g_hSendSS,MAKEINTRESOURCE(IDR_CREDIT),_T("TEXT"));
+ ResSize = SizeofResource(g_hSendSS,hResInfo);
+ pszMsg = (char*)LockResource(LoadResource(g_hSendSS,hResInfo));
temp = mir_a2t(pszMsg);
temp [ResSize] = 0; //LockResource is not NULL terminatet !!
mir_tcsadd(pszTitle ,temp);
@@ -176,7 +176,7 @@ LRESULT TfrmAbout::wmClose(WPARAM wParam, LPARAM lParam) {
TfrmAbout::TfrmAbout(HWND Owner) {
m_hWndOwner = Owner;
// create window
- m_hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_UAboutForm),0, DlgTfrmAbout,(LPARAM)this);
+ m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UAboutForm),0, DlgTfrmAbout,(LPARAM)this);
//register object
_HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this));
//init page
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp
index b427e7c01a..eda4f7d95b 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp
@@ -217,7 +217,7 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
/// Add a tab for each of the three child dialog boxes.
itab.tcih.pszText = TranslateT("Window");
// itab.tcih.iImage = 0;
- itab.hwndTabPage = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_UMain_CaptureWindow),m_hWnd,DlgProc_CaptureTabPage,IDD_UMain_CaptureWindow);
+ itab.hwndTabPage = CreateDialogParam(g_hSendSS,MAKEINTRESOURCE(IDD_UMain_CaptureWindow),m_hWnd,DlgProc_CaptureTabPage,IDD_UMain_CaptureWindow);
TabCtrl_InsertItem(m_hwndTab,0,&itab);
/// get tab boundaries (required after 1st tab)
GetClientRect(m_hwndTab,&rcTab);
@@ -231,7 +231,7 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
itab.tcih.pszText = TranslateT("Desktop");
// itab.tcih.iImage = 1;
- itab.hwndTabPage = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_UMain_CaptureDesktop),m_hWnd,DlgProc_CaptureTabPage,IDD_UMain_CaptureDesktop);
+ itab.hwndTabPage = CreateDialogParam(g_hSendSS,MAKEINTRESOURCE(IDD_UMain_CaptureDesktop),m_hWnd,DlgProc_CaptureTabPage,IDD_UMain_CaptureDesktop);
TabCtrl_InsertItem(m_hwndTab,1,&itab);
SetWindowPos(itab.hwndTabPage,HWND_TOP,rcTab.left,rcTab.top,rcTab.right,rcTab.bottom,0);
@@ -254,7 +254,7 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
itab.tcih.pszText = TranslateT("File");
// itab.tcih.iImage = 2;
- itab.hwndTabPage = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_UMain_CaptureFile),m_hWnd,DlgProc_CaptureTabPage,IDD_UMain_CaptureFile);
+ itab.hwndTabPage = CreateDialogParam(g_hSendSS,MAKEINTRESOURCE(IDD_UMain_CaptureFile),m_hWnd,DlgProc_CaptureTabPage,IDD_UMain_CaptureFile);
TabCtrl_InsertItem(m_hwndTab,2,&itab);
SetWindowPos(itab.hwndTabPage,HWND_TOP,rcTab.left,rcTab.top,rcTab.right,rcTab.bottom,0);
@@ -295,12 +295,12 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
if(m_hContact){
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("File Transfer")),SS_FILESEND);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("E-mail")) ,SS_EMAIL);
- if (myGlobals.PluginHTTPExist) {
+ if (g_myGlobals.PluginHTTPExist) {
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, _T("HTTP Server")) ,SS_HTTPSERVER);
}else if(m_opt_cboxSendBy == SS_HTTPSERVER) {
m_opt_cboxSendBy = SS_IMAGESHACK;
}
- if (myGlobals.PluginFTPExist) {
+ if (g_myGlobals.PluginFTPExist) {
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("FTP File")) ,SS_FTPFILE);
}else if(m_opt_cboxSendBy == SS_FTPFILE) {
m_opt_cboxSendBy = SS_IMAGESHACK;
@@ -308,7 +308,7 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
}else if(m_opt_cboxSendBy == SS_FILESEND || m_opt_cboxSendBy == SS_EMAIL || m_opt_cboxSendBy == SS_HTTPSERVER || m_opt_cboxSendBy == SS_FTPFILE) {
m_opt_cboxSendBy = SS_IMAGESHACK;
}
- if (myGlobals.PluginDropboxExist) {
+ if (g_myGlobals.PluginDropboxExist) {
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, _T("Dropbox")), SS_DROPBOX);
}else if(m_opt_cboxSendBy == SS_DROPBOX) {
m_opt_cboxSendBy = SS_IMAGESHACK;
@@ -504,11 +504,11 @@ void TfrmMain::SetTargetWindow(HWND hwnd){
edtSizeUpdate(m_hTargetWindow,m_opt_chkClientArea,m_hwndTabPage,ID_edtSize);
}
void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam){
- if (wParam == ID_imgTarget){// Timer for Target selector
+ if(wParam==ID_imgTarget){// Timer for Target selector
static int primarymouse;
if(!m_hTargetHighlighter){
primarymouse=GetSystemMetrics(SM_SWAPBUTTON)?VK_RBUTTON:VK_LBUTTON;
- m_hTargetHighlighter=CreateWindowEx(WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW,(TCHAR*)g_clsTargetHighlighter,NULL,WS_POPUP,0,0,0,0,NULL,NULL,hInst,NULL);
+ m_hTargetHighlighter=CreateWindowEx(WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW,(TCHAR*)g_clsTargetHighlighter,NULL,WS_POPUP,0,0,0,0,NULL,NULL,g_hSendSS,NULL);
if(!m_hTargetHighlighter) return;
SetLayeredWindowAttributes(m_hTargetHighlighter,0,123,LWA_ALPHA);
SetSystemCursor(CopyCursor(Skin_GetIcon(ICO_COMMON_SSTARGET)),OCR_NORMAL);
@@ -557,7 +557,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam){
}
return;
}
- if (wParam == ID_chkTimed){// Timer for Screenshot
+ if(wParam==ID_chkTimed){// Timer for Screenshot
#ifdef _DEBUG
OutputDebugStringA("SS Bitmap Timer Start\r\n" );
#endif
@@ -767,7 +767,7 @@ void TfrmMain::Init(TCHAR* DestFolder, MCONTACT Contact) {
m_hContact = Contact;
// create window
- m_hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_UMainForm),0,DlgTfrmMain,(LPARAM)this);
+ m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UMainForm),0,DlgTfrmMain,(LPARAM)this);
//register object
_HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this));
diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
index c42f35fa2e..eff1b3f963 100644
--- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp
+++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
@@ -629,7 +629,7 @@ void CtrlButtonUnloadModule()
if(!g_init) return;
g_init=false;
DeleteCriticalSection(&csTips);
- UnregisterClass(UINFOBUTTONCLASS, hInst);
+ UnregisterClass(UINFOBUTTONCLASS, g_hSendSS);
}
void CtrlButtonLoadModule()/// @fixme : compatibility with UInfoEx is everything but perfect... we get a huge problem if UInfoEx is unloaded...
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
index 2014dfb8d5..65df1437a5 100644
--- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
+++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
@@ -109,53 +109,53 @@ static void MakePopupAction(POPUPACTION &pa, int id)
switch (id) {
case IDOK:
pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/Ok");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Ok");
break;
case IDCLOSE:
case IDCANCEL:
pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/Cancel");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Cancel");
break;
case IDABORT:
pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/Abort");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Abort");
break;
case IDRETRY:
pa.lchIcon = Skin_GetIcon(ICO_BTN_UPDATE);
- mir_strcpy(pa.lpzTitle, MODNAME"/Retry");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Retry");
break;
case IDIGNORE:
pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/Ignore");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Ignore");
break;
case IDYES:
pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/Yes");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Yes");
break;
case IDNO:
pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/No");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/No");
break;
case IDHELP:
pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/Help");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/Help");
break;
case IDALL:
pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/All");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/All");
break;
case IDNONE:
pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/None");
+ mir_strcpy(pa.lpzTitle, SZ_SENDSS"/None");
}
}
@@ -628,12 +628,12 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
// Shall the MessageBox displayed as popup?
if (!(pMsgBox->uType & (MB_INFOBAR|MB_NOPOPUP)) && // message box can be a popup?
ServiceExists(MS_POPUP_ADDPOPUPT) && // popups exist?
- myGlobals.PopupActionsExist == 1 && // popup support ext stuct?
+ g_myGlobals.PopupActionsExist == 1 && // popup support ext stuct?
(db_get_dw(NULL, "Popup","Actions", 0) & 1) && // popup++ actions on?
- db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
- return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
+ db_get_b(NULL, SZ_SENDSS, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
+ return DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
- return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
+ return DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
}
return -1;
}
@@ -674,7 +674,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszTitle, SIZEOF(tszMsg),_T("%s - %s") ,_T(MODNAME), TranslateT("Error"));
+ mir_sntprintf(tszTitle, SIZEOF(tszMsg),_T("%s - %s") ,_T(SZ_SENDSS), TranslateT("Error"));
va_list vl;
va_start(vl, pszFormat);
diff --git a/plugins/SendScreenshotPlus/src/global.h b/plugins/SendScreenshotPlus/src/global.h
index 9c822d3f98..c0d6c2d965 100644
--- a/plugins/SendScreenshotPlus/src/global.h
+++ b/plugins/SendScreenshotPlus/src/global.h
@@ -83,7 +83,6 @@ using namespace std;
#include "dlg_msgbox.h"
#include "resource.h"
#include "version.h"
-#include "main.h"
#include "CSend.h"
#include "CSendEmail.h"
#include "CSendFile.h"
@@ -120,11 +119,11 @@ typedef struct _MGLOBAL {
// Miranda Database Key
#define SZ_SENDSS "SendSS"
-#define MODNAME "SendSS"
-extern HINSTANCE hInst;
-extern MGLOBAL myGlobals;
-extern HANDLE hNetlibUser;
+extern ATOM g_clsTargetHighlighter;
+extern HINSTANCE g_hSendSS;
+extern MGLOBAL g_myGlobals;
+extern HANDLE g_hNetlibUser;
#define PtrIsValid(p) (((p)!=0)&&(((HANDLE)(p))!=INVALID_HANDLE_VALUE))
#define MIR_FREE(p) {if (PtrIsValid(p)){mir_free((void*)p);(p)=NULL;}}
diff --git a/plugins/SendScreenshotPlus/src/mir_icolib.h b/plugins/SendScreenshotPlus/src/mir_icolib.h
index bb0c8ce642..883b78350e 100644
--- a/plugins/SendScreenshotPlus/src/mir_icolib.h
+++ b/plugins/SendScreenshotPlus/src/mir_icolib.h
@@ -25,38 +25,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define _UINFOEX_ICONS_H_INCLUDED_ 1
// sections
-#define SECT_COMMON MODNAME
-#define SECT_BUTTONS MODNAME"/"LPGEN("Buttons")
-#define SECT_OVERLAY MODNAME"/"LPGEN("Overlays")
+#define SECT_COMMON SZ_SENDSS
+#define SECT_BUTTONS SZ_SENDSS"/"LPGEN("Buttons")
+#define SECT_OVERLAY SZ_SENDSS"/"LPGEN("Overlays")
// icons
-#define ICO_COMMON_SSWINDOW1 MODNAME"_plug_SSwindow1"
-#define ICO_COMMON_SSWINDOW2 MODNAME"_plug_SSwindow2"
-#define ICO_COMMON_SSMONITOR MODNAME"_plug_SSmonitor"
-#define ICO_COMMON_SSDEFAULT MODNAME"_plug_SSdefault"
-#define ICO_COMMON_SSTARGET MODNAME"_plug_SSTarget"
-#define ICO_COMMON_SSHELP MODNAME"_plug_SSHelp"
-#define ICO_COMMON_SSFOLDERO MODNAME"_plug_SSFolderOpen"
-#define ICO_COMMON_ARROWL MODNAME"_plug_SSArrowL"
-#define ICO_COMMON_ARROWR MODNAME"_plug_SSArrowR"
-#define ICO_COMMON_SSDESKOFF MODNAME"_plug_SSDeskOff"
-#define ICO_COMMON_SSDESKON MODNAME"_plug_SSDeskOn"
-#define ICO_COMMON_SSDELOFF MODNAME"_plug_SSDelOff"
-#define ICO_COMMON_SSDELON MODNAME"_plug_SSDelOn"
-#define ICO_DLG_DETAILS MODNAME"_dlg_details"
-#define ICO_BTN_UPDATE MODNAME"_plug_update"
-#define ICO_BTN_OK MODNAME"_plug_ok"
-#define ICO_BTN_CANCEL MODNAME"_plug_cancel"
-//#define ICO_BTN_APPLY MODNAME"_plug_apply"
-#define ICO_BTN_EDIT MODNAME"_plug_edit"
-#define ICO_BTN_EDITON MODNAME"_plug_editOn"
-#define ICO_BTN_COPY MODNAME"_plug_copy"
-#define ICO_BTN_BBC MODNAME"_plug_bbc"
-#define ICO_BTN_BBC2 MODNAME"_plug_bbclnk"
-#define ICO_BTN_DOWNARROW MODNAME"_plug_downarrow"
+#define ICO_COMMON_SSWINDOW1 SZ_SENDSS"_plug_SSwindow1"
+#define ICO_COMMON_SSWINDOW2 SZ_SENDSS"_plug_SSwindow2"
+#define ICO_COMMON_SSMONITOR SZ_SENDSS"_plug_SSmonitor"
+#define ICO_COMMON_SSDEFAULT SZ_SENDSS"_plug_SSdefault"
+#define ICO_COMMON_SSTARGET SZ_SENDSS"_plug_SSTarget"
+#define ICO_COMMON_SSHELP SZ_SENDSS"_plug_SSHelp"
+#define ICO_COMMON_SSFOLDERO SZ_SENDSS"_plug_SSFolderOpen"
+#define ICO_COMMON_ARROWL SZ_SENDSS"_plug_SSArrowL"
+#define ICO_COMMON_ARROWR SZ_SENDSS"_plug_SSArrowR"
+#define ICO_COMMON_SSDESKOFF SZ_SENDSS"_plug_SSDeskOff"
+#define ICO_COMMON_SSDESKON SZ_SENDSS"_plug_SSDeskOn"
+#define ICO_COMMON_SSDELOFF SZ_SENDSS"_plug_SSDelOff"
+#define ICO_COMMON_SSDELON SZ_SENDSS"_plug_SSDelOn"
+#define ICO_DLG_DETAILS SZ_SENDSS"_dlg_details"
+#define ICO_BTN_UPDATE SZ_SENDSS"_plug_update"
+#define ICO_BTN_OK SZ_SENDSS"_plug_ok"
+#define ICO_BTN_CANCEL SZ_SENDSS"_plug_cancel"
+//#define ICO_BTN_APPLY SZ_SENDSS"_plug_apply"
+#define ICO_BTN_EDIT SZ_SENDSS"_plug_edit"
+#define ICO_BTN_EDITON SZ_SENDSS"_plug_editOn"
+#define ICO_BTN_COPY SZ_SENDSS"_plug_copy"
+#define ICO_BTN_BBC SZ_SENDSS"_plug_bbc"
+#define ICO_BTN_BBC2 SZ_SENDSS"_plug_bbclnk"
+#define ICO_BTN_DOWNARROW SZ_SENDSS"_plug_downarrow"
-//#define ICO_BTN_OVERLAYOFF MODNAME"_plug_SSOverlayOff"
-//#define ICO_BTN_OVERLAYON MODNAME"_plug_SSOverlayOn"
+//#define ICO_BTN_OVERLAYOFF SZ_SENDSS"_plug_SSOverlayOff"
+//#define ICO_BTN_OVERLAYON SZ_SENDSS"_plug_SSOverlayOn"
void IcoLib_LoadModule();