diff options
Diffstat (limited to 'plugins/SendScreenshotPlus')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendEmail.cpp | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendEmail.h | 107 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 184 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendFTPFile.h | 101 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.h | 9 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendImageShack.cpp | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendImageShack.h | 10 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Main.cpp | 16 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Main.h | 2 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UAboutForm.cpp | 8 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.cpp | 34 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.h | 10 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Utils.cpp | 82 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Utils.h | 25 |
15 files changed, 295 insertions, 307 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp index 9b6498ecb8..1b1e681c31 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp +++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp @@ -53,7 +53,7 @@ CSendEmail::~CSendEmail(){ void CSendEmail::Send() { mir_freeAndNil(m_pszFileName); - m_pszFileName = (LPSTR)GetFileName(m_pszFile, DBVT_ASCIIZ); + m_pszFileName = GetFileNameA(m_pszFile); mir_freeAndNil(m_pszFileA); m_pszFileA = mir_t2a(m_pszFile); @@ -146,7 +146,7 @@ void CSendEmail::SendThread() { int res = lpMAPISendMail(NULL, NULL, &Msg, MAPI_LOGON_UI|MAPI_DIALOG, 0); ::FreeLibrary(hMAPILib); - LPTSTR err; + TCHAR* err; switch (res) { case SUCCESS_SUCCESS: //The call succeeded and the message was sent. diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.h b/plugins/SendScreenshotPlus/src/CSendEmail.h index 5406ad08d4..b24a2e9753 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.h +++ b/plugins/SendScreenshotPlus/src/CSendEmail.h @@ -1,54 +1,53 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-09 Miranda ICQ/IM project,
-
-This file is part of Send Screenshot Plus, a Miranda IM plugin.
-Copyright (c) 2010 Ing.U.Horn
-
-Parts of this file based on original sorce code
-(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++)
-
-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; either version 2
-of the License, or (at your option) any later version.
-
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef _CSEND_EMAIL_H
-#define _CSEND_EMAIL_H
-
-//---------------------------------------------------------------------------
-class CSendEmail : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendEmail(HWND Owner, MCONTACT hContact, bool bFreeOnExit);
- ~CSendEmail();
-
- void Send();
-
- protected:
- LPSTR m_pszFileA;
- LPSTR m_pszFileName;
- LPSTR m_Email;
- LPSTR m_FriendlyName;
- LPSTR m_Subject;
- void SendThread();
- static void SendThreadWrapper(void * Obj);
-
-};
-
-//---------------------------------------------------------------------------
-
-#endif
+/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-09 Miranda ICQ/IM project, + +This file is part of Send Screenshot Plus, a Miranda IM plugin. +Copyright (c) 2010 Ing.U.Horn + +Parts of this file based on original sorce code +(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) + +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; either version 2 +of the License, or (at your option) any later version. + +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, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _CSEND_EMAIL_H +#define _CSEND_EMAIL_H + +//--------------------------------------------------------------------------- +class CSendEmail : public CSend { + public: + // Deklaration Standardkonstruktor/Standarddestructor + CSendEmail(HWND Owner, MCONTACT hContact, bool bFreeOnExit); + ~CSendEmail(); + + void Send(); + + protected: + char* m_pszFileA; + char* m_pszFileName; + char* m_Email; + char* m_FriendlyName; + char* m_Subject; + void SendThread(); + static void SendThreadWrapper(void * Obj); +}; + +//--------------------------------------------------------------------------- + +#endif diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index ac2d7cef02..61e8a1f289 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -1,92 +1,92 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-09 Miranda ICQ/IM project,
-
-This file is part of Send Screenshot Plus, a Miranda IM plugin.
-Copyright (c) 2010 Ing.U.Horn
-
-Parts of this file based on original sorce code
-(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++)
-
-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; either version 2
-of the License, or (at your option) any later version.
-
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-//---------------------------------------------------------------------------
-#include "global.h"
-
-
-//---------------------------------------------------------------------------
-CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool bFreeOnExit)
-: CSend(Owner, hContact, bFreeOnExit){
- m_EnableItem = NULL ; //SS_DLG_DESCRIPTION| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND;
- m_pszSendTyp = LPGENT("FTPFile transfer");
- m_pszFileName = NULL;
- m_URL = NULL;
-}
-
-CSendFTPFile::~CSendFTPFile(){
- mir_free(m_pszFileName);
- mir_free(m_URL);
-}
-
-//---------------------------------------------------------------------------
-void CSendFTPFile::Send() {
-
- /*********************************************************************************************
- * Send file (files) to the FTP server and copy file URL
- * to message log or clipboard (according to plugin setting)
- * wParam = (HANDLE)hContact
- * lParam = (char *)filename
- * Filename format is same as GetOpenFileName (OPENFILENAME.lpstrFile) returns,
- * see http://msdn2.microsoft.com/en-us/library/ms646839.aspx
- * Returns 0 on success or nonzero on failure
- * if (!wParam || !lParam) return 1
- ********************************************************************************************/
- mir_freeAndNil(m_pszFileName);
- m_pszFileName = (LPSTR)GetFileName(m_pszFile, DBVT_ASCIIZ);
- size_t size = sizeof(char)*(strlen(m_pszFileName)+2);
- m_pszFileName = (LPSTR) mir_realloc(m_pszFileName, size);
- m_pszFileName[size-1] = NULL;
-
- //start Send thread
- m_bFreeOnExit = TRUE;
- mir_forkthread(&CSendFTPFile::SendThreadWrapper, this);
-}
-
-void CSendFTPFile::SendThread() {
- mir_freeAndNil(m_URL);
-
- INT_PTR ret = FTPFileUploadA(m_hContact, FNUM_DEFAULT, FMODE_RAWFILE, &m_pszFileName,1);
- if (ret != 0) {
- Error(TranslateT("%s (%i):\nCould not add a share to the FTP File plugin."),TranslateTS(m_pszSendTyp),ret);
- Exit(ret);
- }
-
- //Can't delete the file since FTP File plugin will use it
- m_bDeleteAfterSend = false;
-
- if (m_URL && m_URL[0]!= NULL) {
- m_ChatRoom ? svcSendChat(m_URL) : svcSendMsg(m_URL);
- }
-}
-
-void CSendFTPFile::SendThreadWrapper(void * Obj) {
- reinterpret_cast<CSendFTPFile*>(Obj)->SendThread();
-}
-
-//---------------------------------------------------------------------------
+/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-09 Miranda ICQ/IM project, + +This file is part of Send Screenshot Plus, a Miranda IM plugin. +Copyright (c) 2010 Ing.U.Horn + +Parts of this file based on original sorce code +(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) + +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; either version 2 +of the License, or (at your option) any later version. + +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, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +//--------------------------------------------------------------------------- +#include "global.h" + + +//--------------------------------------------------------------------------- +CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool bFreeOnExit) +: CSend(Owner, hContact, bFreeOnExit){ + m_EnableItem = NULL ; //SS_DLG_DESCRIPTION| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; + m_pszSendTyp = LPGENT("FTPFile transfer"); + m_pszFileName = NULL; + m_URL = NULL; +} + +CSendFTPFile::~CSendFTPFile(){ + mir_free(m_pszFileName); + mir_free(m_URL); +} + +//--------------------------------------------------------------------------- +void CSendFTPFile::Send() { + + /********************************************************************************************* + * Send file (files) to the FTP server and copy file URL + * to message log or clipboard (according to plugin setting) + * wParam = (HANDLE)hContact + * lParam = (char *)filename + * Filename format is same as GetOpenFileName (OPENFILENAME.lpstrFile) returns, + * see http://msdn2.microsoft.com/en-us/library/ms646839.aspx + * Returns 0 on success or nonzero on failure + * if (!wParam || !lParam) return 1 + ********************************************************************************************/ + mir_freeAndNil(m_pszFileName); + m_pszFileName = GetFileNameA(m_pszFile); + size_t size = sizeof(char)*(strlen(m_pszFileName)+2); + m_pszFileName = (char*)mir_realloc(m_pszFileName, size); + m_pszFileName[size-1] = NULL; + + //start Send thread + m_bFreeOnExit = TRUE; + mir_forkthread(&CSendFTPFile::SendThreadWrapper, this); +} + +void CSendFTPFile::SendThread() { + mir_freeAndNil(m_URL); + + INT_PTR ret = FTPFileUploadA(m_hContact, FNUM_DEFAULT, FMODE_RAWFILE, &m_pszFileName,1); + if (ret != 0) { + Error(TranslateT("%s (%i):\nCould not add a share to the FTP File plugin."),TranslateTS(m_pszSendTyp),ret); + Exit(ret); + } + + //Can't delete the file since FTP File plugin will use it + m_bDeleteAfterSend = false; + + if (m_URL && m_URL[0]!= NULL) { + m_ChatRoom ? svcSendChat(m_URL) : svcSendMsg(m_URL); + } +} + +void CSendFTPFile::SendThreadWrapper(void * Obj) { + reinterpret_cast<CSendFTPFile*>(Obj)->SendThread(); +} + +//--------------------------------------------------------------------------- diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.h b/plugins/SendScreenshotPlus/src/CSendFTPFile.h index 99901a862b..9b30d0ec2d 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.h +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.h @@ -1,51 +1,50 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-09 Miranda ICQ/IM project,
-
-This file is part of Send Screenshot Plus, a Miranda IM plugin.
-Copyright (c) 2010 Ing.U.Horn
-
-Parts of this file based on original sorce code
-(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++)
-
-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; either version 2
-of the License, or (at your option) any later version.
-
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef _CSEND_FTP_FILE_H
-#define _CSEND_FTP_FILE_H
-
-//---------------------------------------------------------------------------
-class CSendFTPFile : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendFTPFile(HWND Owner, MCONTACT hContact, bool bFreeOnExit);
- ~CSendFTPFile();
-
- void Send();
-
- protected:
- LPSTR m_pszFileName;
- LPSTR m_URL;
- void SendThread();
- static void SendThreadWrapper(void * Obj);
-
-};
-
-//---------------------------------------------------------------------------
-
-#endif
+/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-09 Miranda ICQ/IM project, + +This file is part of Send Screenshot Plus, a Miranda IM plugin. +Copyright (c) 2010 Ing.U.Horn + +Parts of this file based on original sorce code +(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) + +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; either version 2 +of the License, or (at your option) any later version. + +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, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _CSEND_FTP_FILE_H +#define _CSEND_FTP_FILE_H + +//--------------------------------------------------------------------------- +class CSendFTPFile : public CSend { + public: + // Deklaration Standardkonstruktor/Standarddestructor + CSendFTPFile(HWND Owner, MCONTACT hContact, bool bFreeOnExit); + ~CSendFTPFile(); + + void Send(); + + protected: + char* m_pszFileName; + char* m_URL; + void SendThread(); + static void SendThreadWrapper(void * Obj); +}; + +//--------------------------------------------------------------------------- + +#endif diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index 155ad79393..df8c3953bb 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -60,7 +60,7 @@ void CSendHTTPServer::Send() { } if (!m_pszFileName) { - m_pszFileName = (LPSTR)GetFileName(m_pszFile, DBVT_ASCIIZ); + m_pszFileName = GetFileNameA(m_pszFile); } mir_freeAndNil(m_fsi_pszSrvPath); mir_stradd(m_fsi_pszSrvPath, "/"); @@ -89,7 +89,7 @@ void CSendHTTPServer::SendThread() { //patched plugin version ret = CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); if (!ret) { - m_URL = (LPSTR)CallService(MS_HTTP_GET_LINK, (WPARAM)m_fsi.pszSrvPath, NULL); + m_URL = (char*)CallService(MS_HTTP_GET_LINK, (WPARAM)m_fsi.pszSrvPath, NULL); } } else { diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h index 85ad17c8d6..782ec1c14a 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h @@ -39,11 +39,11 @@ class CSendHTTPServer : public CSend { void Send(); protected: - LPSTR m_pszFileName; - LPSTR m_URL; + char* m_pszFileName; + char* m_URL; STFileShareInfo m_fsi; - LPSTR m_fsi_pszSrvPath; - LPSTR m_fsi_pszRealPath; + char* m_fsi_pszSrvPath; + char* m_fsi_pszRealPath; void SendThread(); static void SendThreadWrapper(void * Obj); @@ -51,7 +51,6 @@ class CSendHTTPServer : public CSend { static CContactMapping _CContactMapping; // static INT_PTR MyCallService(const char *name, WPARAM wParam, LPARAM lParam); - }; //--------------------------------------------------------------------------- diff --git a/plugins/SendScreenshotPlus/src/CSendImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendImageShack.cpp index 2af40a8740..d99c858f4d 100644 --- a/plugins/SendScreenshotPlus/src/CSendImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendImageShack.cpp @@ -58,7 +58,7 @@ void CSendImageShack::Send() { return; } if (!m_pszFileName) { - m_pszFileName = (LPSTR)GetFileName(m_pszFile, DBVT_ASCIIZ); + m_pszFileName = GetFileNameA(m_pszFile); } if (!m_pszContentType) GetContentType(); @@ -201,7 +201,7 @@ void CSendImageShack::SendThread() { m_ChatRoom ? svcSendChat(URL) : svcSendMsg(URL); return; }else{//check error mess from server - LPTSTR err = mir_a2t(GetTagContent(m_nlreply->pData, "<error ", "</error>")); + TCHAR* err = mir_a2t(GetTagContent(m_nlreply->pData, "<error ", "</error>")); if (!err || !*err){//fallback to server response mess mir_freeAndNil(err); err = mir_a2t(m_nlreply->pData); @@ -239,7 +239,7 @@ void CSendImageShack::MFDR_Reset() { void CSendImageShack::GetContentType() { if (m_pszContentType) mir_freeAndNil(m_pszContentType); - LPSTR FileExtension = (LPSTR)GetFileExt(m_pszFile, DBVT_ASCIIZ); + char* FileExtension = GetFileExtA(m_pszFile); if ((strcmp(FileExtension, ".jpeg")==0) || (strcmp(FileExtension, ".jpe")==0) || (strcmp(FileExtension ,".jpg")==0)) m_pszContentType="image/jpeg"; diff --git a/plugins/SendScreenshotPlus/src/CSendImageShack.h b/plugins/SendScreenshotPlus/src/CSendImageShack.h index b8f3623d61..bf8b6afbbb 100644 --- a/plugins/SendScreenshotPlus/src/CSendImageShack.h +++ b/plugins/SendScreenshotPlus/src/CSendImageShack.h @@ -38,18 +38,18 @@ class CSendImageShack : public CSend { void Send(); void SendSync(bool Sync) {m_SendSync = Sync;}; - LPSTR GetURL(){return m_Url;}; - LPSTR GetError(){return mir_t2a(m_ErrorMsg);}; + char* GetURL(){return m_Url;}; + char* GetError(){return mir_t2a(m_ErrorMsg);}; protected: - LPSTR m_pszFileName; + char* m_pszFileName; NETLIBHTTPREQUEST m_nlhr; NETLIBHTTPREQUEST* m_nlreply; char m_nlheader_ContentType[64]; - LPSTR m_Url; + char* m_Url; void AppendToData(const char *pszVal); //append to netlib DATA - LPSTR m_pszContentType; //hold mimeType (does not need free) + char* m_pszContentType; //hold mimeType (does not need free) void GetContentType(); //get mimeType const char * GetTagContent(char * pszSource, const char * pszTagStart, const char * pszTagEnd); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 1324766388..13135cebe8 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -114,7 +114,7 @@ extern "C" __declspec(dllexport) int Load(void) HOTKEYDESC hkd={sizeof(hkd)}; hkd.pszName="Open SendSS+"; hkd.ptszDescription=LPGENT("Open SendSS+"); - hkd.ptszSection=L"SendSS+"; + hkd.ptszSection=_T("SendSS+"); hkd.pszService=MS_SENDSS_OPENDIALOG; //hkd.DefHotKey=HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam=0xFFFF; @@ -158,7 +158,7 @@ extern "C" __declspec(dllexport) int Unload(void) UnRegisterServices(); if(g_hookModulesLoaded) UnhookEvent(g_hookModulesLoaded),g_hookModulesLoaded=0; if(g_hookSystemPreShutdown) UnhookEvent(g_hookSystemPreShutdown),g_hookSystemPreShutdown=0; - if(g_clsTargetHighlighter) UnregisterClass((LPTSTR)g_clsTargetHighlighter,hInst),g_clsTargetHighlighter=0; + if(g_clsTargetHighlighter) UnregisterClass((TCHAR*)g_clsTargetHighlighter,hInst),g_clsTargetHighlighter=0; return 0; } @@ -205,13 +205,13 @@ INT_PTR service_CaptureAndSendDesktop(WPARAM wParam, LPARAM lParam) { MessageBoxEx(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); return -1; } - LPTSTR pszPath=GetCustomPath(); + TCHAR* pszPath=GetCustomPath(); if(!pszPath){ delete frmMain; return -1; } MCONTACT hContact = (MCONTACT) wParam; - LPSTR pszProto = GetContactProto(hContact); + char* pszProto = GetContactProto(hContact); bool bChatRoom = db_get_b(hContact, pszProto, "ChatRoom", 0) != 0; frmMain->m_opt_chkTimed = false; frmMain->m_opt_tabCapture = 1; @@ -234,7 +234,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam){ MessageBoxEx(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); return -1; } - LPTSTR pszPath=GetCustomPath(); + TCHAR* pszPath=GetCustomPath(); if(!pszPath){ delete frmMain; return -1; @@ -275,7 +275,7 @@ INT_PTR service_EditBitmap(WPARAM wParam, LPARAM lParam) { // wParam = (char*)filename // lParam = (HANDLE)contact (can be null) INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) { - LPSTR result = NULL; + char* result = NULL; CSendImageShack* cSend = new CSendImageShack(NULL, lParam, false); cSend->m_pszFile = mir_a2t((char*)wParam); cSend->m_bDeleteAfterSend = FALSE; @@ -358,8 +358,8 @@ int UnRegisterServices(){ } //--------------------------------------------------------------------------- -LPTSTR GetCustomPath() { - LPTSTR pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\Screenshots")); +TCHAR* GetCustomPath() { + TCHAR* pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\Screenshots")); if(hFolderScreenshot){ TCHAR szPath[1024]={0}; FoldersGetCustomPathT(hFolderScreenshot, szPath, 1024, pszPath); diff --git a/plugins/SendScreenshotPlus/src/Main.h b/plugins/SendScreenshotPlus/src/Main.h index 87276a9794..17fc5add7e 100644 --- a/plugins/SendScreenshotPlus/src/Main.h +++ b/plugins/SendScreenshotPlus/src/Main.h @@ -54,7 +54,7 @@ INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam); int OnSendScreenShot(WPARAM wParam, LPARAM lParam); -LPTSTR GetCustomPath(); +TCHAR* GetCustomPath(); //--------------------------------------------------------------------------- #endif diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index 399992f384..65225104dd 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -93,11 +93,11 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM wParam, LPARAM lParam) { HRSRC hResInfo; DWORD ResSize; TCHAR oldTitle[256], newTitle[256]; - LPTSTR temp = NULL; - LPTSTR pszTitle = NULL; + TCHAR* temp = NULL; + TCHAR* pszTitle = NULL; // Headerbar - LPTSTR pszPlug = mir_a2t(__PLUGIN_NAME); - LPTSTR pszVer = mir_a2t(__VERSION_STRING_DOTS); + TCHAR* pszPlug = mir_a2t(__PLUGIN_NAME); + TCHAR* pszVer = mir_a2t(__VERSION_STRING_DOTS); GetDlgItemText( m_hWnd, IDC_HEADERBAR, oldTitle, SIZEOF( oldTitle )); mir_sntprintf( newTitle, SIZEOF(newTitle), oldTitle, pszPlug, pszVer ); mir_freeAndNil(pszPlug); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 60eb365011..bfdca1b1e4 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -188,14 +188,14 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { //Taskbar and Window icon SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIcon(ICO_COMMON_SSWINDOW1,1)); SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIcon(ICO_COMMON_SSWINDOW2)); - LPTSTR pt = mir_a2t(__PLUGIN_NAME); + TCHAR* pt = mir_a2t(__PLUGIN_NAME); SetWindowText(m_hWnd, pt); mir_freeAndNil(pt); // Headerbar - pt = mir_tstrdup((LPTSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)m_hContact, (LPARAM)GCDNF_TCHAR)); + pt = mir_tstrdup((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)m_hContact, (LPARAM)GCDNF_TCHAR)); if (pt && (m_hContact != 0)) { - LPTSTR lptString = NULL; + TCHAR* lptString = NULL; mir_tcsadd(lptString , TranslateT("Send screenshot to\n")); mir_tcsadd(lptString , pt); SetDlgItemText(m_hWnd, IDC_HEADERBAR, lptString); @@ -479,12 +479,12 @@ void TfrmMain::SetTargetWindow(HWND hwnd){ } m_hTargetWindow=hwnd; int len=GetWindowTextLength(m_hTargetWindow)+1; - LPTSTR lpTitle; + TCHAR* lpTitle; if(len>1){ - lpTitle=(LPTSTR)mir_alloc(len*sizeof(TCHAR)); + lpTitle=(TCHAR*)mir_alloc(len*sizeof(TCHAR)); GetWindowText(m_hTargetWindow,lpTitle,len); }else{//no WindowText present, use WindowClass - lpTitle=(LPTSTR)mir_alloc(64*sizeof(TCHAR)); + lpTitle=(TCHAR*)mir_alloc(64*sizeof(TCHAR)); RealGetWindowClass(m_hTargetWindow,lpTitle,64); } SetDlgItemText(m_hwndTabPage,ID_edtCaption,lpTitle); @@ -496,7 +496,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam){ 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,(LPTSTR)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,hInst,NULL); if(!m_hTargetHighlighter) return; SetLayeredWindowAttributes(m_hTargetHighlighter,0,123,LWA_ALPHA); SetSystemCursor(CopyCursor(Skin_GetIcon(ICO_COMMON_SSTARGET)),OCR_NORMAL); @@ -736,7 +736,7 @@ void TfrmMain::LoadOptions(void) { m_opt_chkEditor = db_get_b(NULL, SZ_SENDSS, "Preview", 0); m_opt_btnDesc = db_get_b(NULL, SZ_SENDSS, "AutoDescription", 1); - m_opt_btnDeleteAfterSend = db_get_b(NULL, SZ_SENDSS, "DelAfterSend", 1); + m_opt_btnDeleteAfterSend = db_get_b(NULL, SZ_SENDSS, "DelAfterSend", 1)!=0; m_opt_chkOpenAgain = db_get_b(NULL, SZ_SENDSS, "OpenAgain", 0); } @@ -765,7 +765,7 @@ void TfrmMain::SaveOptions(void) { } //--------------------------------------------------------------------------- -void TfrmMain::Init(LPTSTR DestFolder, MCONTACT Contact) { +void TfrmMain::Init(TCHAR* DestFolder, MCONTACT Contact) { m_FDestFolder = mir_tstrdup(DestFolder); m_hContact = Contact; if(!m_hContact) m_opt_cboxSendBy = SS_JUSTSAVE; @@ -918,10 +918,10 @@ void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl) { INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { //generate File name FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - LPTSTR ret; - LPTSTR path = NULL; - LPTSTR pszFilename = NULL; - LPTSTR pszFileDesc = NULL; + TCHAR* ret; + TCHAR* path = NULL; + TCHAR* pszFilename = NULL; + TCHAR* pszFileDesc = NULL; if (!dib) return 1; //error unsigned FileNumber=db_get_dw(NULL,SZ_SENDSS,"FileNumber",0)+1; if(FileNumber>99999) FileNumber=1; @@ -930,7 +930,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { if (path[_tcslen(path)-1] != _T('\\')) mir_tcsadd(path, _T("\\")); mir_tcsadd(path, _T("shot%.5u"));//on format change, adapt "len" below size_t len=_tcslen(path)+2; - pszFilename = (LPTSTR)mir_alloc(sizeof(TCHAR)*(len)); + pszFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len)); mir_sntprintf(pszFilename,len,path,FileNumber); mir_free(path); @@ -1010,7 +1010,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { case 3: //TIFF (miranda freeimage interface do not support save tiff, we udse GDI+) { - LPTSTR pszFile = NULL; + TCHAR* pszFile = NULL; mir_tcsadd(pszFile, pszFilename); mir_tcsadd(pszFile, _T(".tif")); @@ -1031,7 +1031,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { //dib24 = FIP->FI_ConvertTo8Bits(dib_new); //ret = SaveImage(FIF_GIF,dib24, pszFilename, _T("gif")); //FIP->FI_Unload(dib24); - LPTSTR pszFile = NULL; + TCHAR* pszFile = NULL; mir_tcsadd(pszFile, pszFilename); mir_tcsadd(pszFile, _T(".gif")); HBITMAP hBmp = FIP->FI_CreateHBITMAPFromDIB(dib_new); @@ -1046,7 +1046,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { } /* //load PNG and save file in user format (if differ) //this get better result for transparent aereas - //LPTSTR pszFormat = (LPTSTR)ComboBox_GetItemData(hwndCombo, ComboBox_GetCurSel(hwndCombo)); + //TCHAR* pszFormat = (TCHAR*)ComboBox_GetItemData(hwndCombo, ComboBox_GetCurSel(hwndCombo)); TCHAR pszFormat[6]; ComboBox_GetText(hwndCombo, pszFormat, 6); if(ret && (_tcsicmp (pszFormat,_T("png")) != 0)) { diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h index 934340ace0..21a0519691 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.h +++ b/plugins/SendScreenshotPlus/src/UMainForm.h @@ -69,7 +69,7 @@ class TfrmMain{ bool m_bOnExitSave; static void Unload(); - void Init(LPTSTR DestFolder, MCONTACT Contact); + void Init(TCHAR* DestFolder, MCONTACT Contact); void Close(){SendMessage(m_hWnd,WM_CLOSE,0,0);} void Show(){ShowWindow(m_hWnd,SW_SHOW);} void Hide(){ShowWindow(m_hWnd,SW_HIDE);} @@ -84,9 +84,9 @@ class TfrmMain{ bool m_bFormAbout, m_bFormEdit; HWND m_hTargetWindow, m_hLastWin; HWND m_hTargetHighlighter; - LPTSTR m_FDestFolder; - LPTSTR m_pszFile; - LPTSTR m_pszFileDesc; + TCHAR* m_FDestFolder; + TCHAR* m_pszFile; + TCHAR* m_pszFileDesc; FIBITMAP* m_Screenshot;//Graphics::TBitmap *Screenshot; RGBQUAD m_AlphaColor; CSend* m_cSend; @@ -111,7 +111,7 @@ class TfrmMain{ BYTE m_opt_chkOpenAgain; //TCheckBox *chkOpenAgain; BYTE m_opt_chkClientArea; //TCheckBox *chkClientArea; BYTE m_opt_edtQuality; //TLabeledEdit *edtQuality; - BYTE m_opt_btnDeleteAfterSend; //TCheckBox *chkDeleteAfterSend; + bool m_opt_btnDeleteAfterSend; //TCheckBox *chkDeleteAfterSend; BYTE m_opt_cboxFormat; //TComboBox *cboxFormat; BYTE m_opt_edtTimed; //TLabeledEdit *edtTimed; bool m_bCapture; //is capture activ diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index 71e35bfa17..1da14993b2 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -118,7 +118,7 @@ FIBITMAP* CaptureWindow (HWND hCapture, BOOL ClientArea) { return dib; } -FIBITMAP* CaptureMonitor (LPTSTR szDevice) { +FIBITMAP* CaptureMonitor (TCHAR* szDevice) { SIZE size; HDC hScrDC; FIBITMAP *dib = NULL; @@ -283,7 +283,7 @@ FIBITMAP* CaptureDesktop() {//emulate print screen } while (!bBitmap); #ifdef _DEBUG char mess[120] = {0}; - LPSTR pszMess = mess; + char* pszMess = mess; mir_snprintf(pszMess,120,"SS Bitmap counter: %i\r\n",i); OutputDebugStringA( pszMess ); #endif @@ -299,10 +299,10 @@ FIBITMAP* CaptureDesktop() {//emulate print screen return dib; }*/ -LPTSTR SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, LPTSTR pszFilename, LPTSTR pszExt, int flag) { +TCHAR* SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, TCHAR* pszFilename, TCHAR* pszExt, int flag) { int ret=0; - LPTSTR pszFile = NULL; - LPTSTR FileExt = (LPTSTR)GetFileExt (pszFilename, DBVT_TCHAR); + TCHAR* pszFile = NULL; + TCHAR* FileExt = GetFileExt(pszFilename); if(!FileExt) { if(!pszExt) return NULL; mir_tcsadd(pszFile, pszFilename); @@ -328,47 +328,32 @@ LPTSTR SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, LPTSTR pszFilename, LPTST } //--------------------------------------------------------------------------- -INT_PTR GetFileName(LPTSTR pszPath, UINT typ) { - /*DBVT_ASCIIZ, DBVT_WCHAR, DBVT_TCHAR*/ - LPTSTR slash = _tcsrchr(pszPath,_T('\\')); - if (slash) { - switch (typ) { - case DBVT_ASCIIZ: - return (INT_PTR)mir_t2a(slash+1); - case DBVT_WCHAR: - return (INT_PTR)mir_t2u(slash+1); - default: - return 0; - } - } - else { - switch (typ) { - case DBVT_ASCIIZ: - return (INT_PTR)mir_t2a(pszPath); - case DBVT_WCHAR: - return (INT_PTR)mir_t2u(pszPath); - default: - return 0; - } - } +TCHAR* GetFileNameW(TCHAR* pszPath) { + TCHAR* slash = _tcsrchr(pszPath,_T('\\')); + if(slash) + return mir_t2u(slash+1); + else + return mir_t2u(pszPath); +} +TCHAR* GetFileExtW(TCHAR* pszPath) { + TCHAR* slash = _tcsrchr(pszPath,_T('.')); + if(slash) + return mir_t2u(slash); + return NULL; } -INT_PTR GetFileExt (LPTSTR pszPath, UINT typ) { - /*DBVT_ASCIIZ, DBVT_WCHAR, DBVT_TCHAR*/ - LPTSTR slash = _tcsrchr(pszPath,_T('.')); - if (slash) { - switch (typ) { - case DBVT_ASCIIZ: - return (INT_PTR)mir_t2a(slash); - case DBVT_WCHAR: - return (INT_PTR)mir_t2u(slash); - default: - return 0; - } - } - else { - return NULL; - } +char* GetFileNameA(TCHAR* pszPath) { + TCHAR* slash = _tcsrchr(pszPath,_T('\\')); + if(slash) + return mir_t2a(slash+1); + else + return mir_t2a(pszPath); +} +char* GetFileExtA(TCHAR* pszPath) { + TCHAR* slash = _tcsrchr(pszPath,_T('.')); + if(slash) + return mir_t2a(slash); + return NULL; } //--------------------------------------------------------------------------- @@ -393,7 +378,7 @@ BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID& clsidEncoder) { return bOk; } /* -INT_PTR SavePNG(HBITMAP hBmp, LPTSTR szFilename) { +void SavePNG(HBITMAP hBmp, TCHAR* szFilename) { Gdiplus::GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); @@ -410,10 +395,9 @@ INT_PTR SavePNG(HBITMAP hBmp, LPTSTR szFilename) { delete pBitmap; } Gdiplus::GdiplusShutdown(gdiplusToken); - return 0; }*/ -INT_PTR SaveGIF(HBITMAP hBmp, LPTSTR szFilename) { +void SaveGIF(HBITMAP hBmp, TCHAR* szFilename) { Gdiplus::GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); @@ -430,10 +414,9 @@ INT_PTR SaveGIF(HBITMAP hBmp, LPTSTR szFilename) { delete pBitmap; } Gdiplus::GdiplusShutdown(gdiplusToken); - return 0; } -INT_PTR SaveTIF(HBITMAP hBmp, LPTSTR szFilename) { +void SaveTIF(HBITMAP hBmp, TCHAR* szFilename) { //http://www.codeproject.com/Messages/1406708/How-to-reduce-the-size-of-an-Image-using-GDIplus.aspx ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; @@ -470,5 +453,4 @@ INT_PTR SaveTIF(HBITMAP hBmp, LPTSTR szFilename) { delete pBitmap; } Gdiplus::GdiplusShutdown(gdiplusToken); - return 0; } diff --git a/plugins/SendScreenshotPlus/src/Utils.h b/plugins/SendScreenshotPlus/src/Utils.h index 7270178153..59e456bde3 100644 --- a/plugins/SendScreenshotPlus/src/Utils.h +++ b/plugins/SendScreenshotPlus/src/Utils.h @@ -50,18 +50,27 @@ size_t MonitorInfoEnum(MONITORINFOEX* & myMonitors, RECT & virtualScreen); BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); FIBITMAP* CaptureWindow(HWND hCapture, BOOL ClientArea); -FIBITMAP* CaptureMonitor(LPTSTR szDevice); +FIBITMAP* CaptureMonitor(TCHAR* szDevice); FIBITMAP* CaptureScreen(HDC hDC, SIZE size, HWND hCapture=0); //FIBITMAP* CaptureDesktop(); /*emulate print screen (not used)*/ -LPTSTR SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, LPTSTR pszFilename, LPTSTR pszExt, int flag=0); - -INT_PTR GetFileName(LPTSTR pszPath, UINT typ); -INT_PTR GetFileExt (LPTSTR pszPath, UINT typ); +TCHAR* SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, TCHAR* pszFilename, TCHAR* pszExt, int flag=0); + +TCHAR* GetFileNameW(TCHAR* pszPath); +TCHAR* GetFileExtW (TCHAR* pszPath); +char* GetFileNameA(TCHAR* pszPath); +char* GetFileExtA (TCHAR* pszPath); +#ifdef _UNICODE +# define GetFileName GetFileNameW +# define GetFileExt GetFileExtW +#else +# define GetFileName GetFileNameA +# define GetFileExt GetFileExtA +#endif // _UNICODE BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID& clsidEncoder); -//INT_PTR SavePNG(HBITMAP hBmp, LPTSTR szFilename); -INT_PTR SaveGIF(HBITMAP hBmp, LPTSTR szFilename); -INT_PTR SaveTIF(HBITMAP hBmp, LPTSTR szFilename); +//void SavePNG(HBITMAP hBmp, TCHAR* szFilename); +void SaveGIF(HBITMAP hBmp, TCHAR* szFilename); +void SaveTIF(HBITMAP hBmp, TCHAR* szFilename); //--------------------------------------------------------------------------- /* Old stuff from Borland C++ |