diff options
Diffstat (limited to 'plugins/SendScreenshotPlus')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.cpp | 66 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendEmail.cpp | 20 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 2 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 8 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Main.cpp | 38 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UAboutForm.cpp | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.cpp | 84 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Utils.cpp | 30 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/ctrl_button.cpp | 66 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 10 |
11 files changed, 166 insertions, 166 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 6ec66563aa..002d9fa922 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -35,22 +35,22 @@ CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) : m_bDeleteAfterSend(false), m_bAsync(bAsync), m_bSilent(bSilent), - m_pszFile(NULL), - m_pszFileDesc(NULL), - m_URL(NULL), - m_URLthumb(NULL), - m_pszSendTyp(NULL), - m_pszProto(NULL), + m_pszFile(nullptr), + m_pszFileDesc(nullptr), + m_URL(nullptr), + m_URLthumb(nullptr), + m_pszSendTyp(nullptr), + m_pszProto(nullptr), // m_hContact(hContact), // initialized below m_EnableItem(0), m_ChatRoom(0), // m_PFflag(0), m_cbEventMsg(0), - m_szEventMsg(NULL), - m_hSend(0), - m_hOnSend(0), - m_ErrorMsg(NULL), - m_ErrorTitle(NULL) + m_szEventMsg(nullptr), + m_hSend(nullptr), + m_hOnSend(nullptr), + m_ErrorMsg(nullptr), + m_ErrorTitle(nullptr) { SetContact(hContact); } @@ -297,10 +297,10 @@ void CSend::svcSendFileExit() } // Start miranda PSS_FILE based on mir ver (T) - wchar_t* ppFile[2] = { 0, 0 }; + wchar_t* ppFile[2] = { nullptr, nullptr }; wchar_t* pDesc = mir_wstrdup(m_pszFileDesc); ppFile[0] = mir_wstrdup(m_pszFile); - ppFile[1] = NULL; + ppFile[1] = nullptr; m_hSend = (HANDLE)ProtoChainSend(m_hContact, PSS_FILE, (WPARAM)pDesc, (LPARAM)ppFile); mir_free(pDesc); mir_free(ppFile[0]); @@ -378,7 +378,7 @@ void CSend::DB_EventAdd(WORD EventType) dbei.szModule = m_pszProto; dbei.eventType = EventType; dbei.flags = DBEF_SENT; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.flags |= DBEF_UTF; dbei.cbBlob = m_cbEventMsg; dbei.pBlob = (PBYTE)m_szEventMsg; @@ -402,9 +402,9 @@ void CSend::Error(LPCTSTR pszFormat, ...) memset(&m_box, 0, sizeof(MSGBOX)); m_box.cbSize = sizeof(MSGBOX); - m_box.hParent = NULL; + m_box.hParent = nullptr; m_box.hiLogo = GetIcon(ICO_MAIN); - m_box.hiMsg = NULL; + m_box.hiMsg = nullptr; m_box.ptszTitle = m_ErrorTitle; m_box.ptszMsg = m_ErrorMsg; m_box.uType = MB_OK | MB_ICON_ERROR; @@ -419,7 +419,7 @@ void CSend::Exit(unsigned int Result) switch (Result) { case CSEND_DIALOG: Skin_PlaySound("FileDone"); - DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_UResultForm), 0, ResultDialogProc, (LPARAM)this); + DialogBoxParam(g_hSendSS, MAKEINTRESOURCE(IDD_UResultForm), nullptr, ResultDialogProc, (LPARAM)this); err = false; break; case ACKRESULT_SUCCESS: @@ -449,11 +449,11 @@ void CSend::Exit(unsigned int Result) if (err) { Skin_PlaySound("FileFailed"); if (m_ErrorMsg) MsgBoxService(NULL, (LPARAM)&m_box); - else MsgErr(NULL, LPGENW("An unknown error has occurred.")); + else MsgErr(nullptr, LPGENW("An unknown error has occurred.")); } } if (m_pszFile && *m_pszFile && m_bDeleteAfterSend && m_EnableItem&SS_DLG_DELETEAFTERSSEND) { - DeleteFile(m_pszFile), m_pszFile = NULL; + DeleteFile(m_pszFile), m_pszFile = nullptr; } if (m_bAsync) delete this;/// deletes derived class since destructor is virtual (which also auto-calls base dtor) @@ -467,7 +467,7 @@ void CSend::Exit(unsigned int Result) const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* endTag) { char* begin = strstr(str, startTag); - if (!begin) return NULL; + if (!begin) return nullptr; begin += mir_strlen(startTag) - 1; for (; *begin != '>' && *begin; ++begin); if (*begin) { @@ -482,7 +482,7 @@ int JSON_ParseData_(const char** jsondata, size_t jsonlen, const char** rawdata) const char* c = *jsondata; const char* jsonend = *jsondata + jsonlen; int len = 0; - *rawdata = NULL; + *rawdata = nullptr; if (c == jsonend) return 0; if (*c == '{') { // scope (object) @@ -560,7 +560,7 @@ int JSON_Get_(const char* json, size_t jsonlen, const char* variable, const char JSON_ParseData_(&c, jsonend - c, value); } } - *value = NULL; + *value = nullptr; return 0; } @@ -645,9 +645,9 @@ static void HTTPFormAppendData(NETLIBHTTPREQUEST* nlhr, size_t* dataMax, char** void CSend::HTTPFormDestroy(NETLIBHTTPREQUEST* nlhr) { - mir_free(nlhr->headers[0].szValue), nlhr->headers[0].szValue = NULL; - mir_free(nlhr->headers), nlhr->headers = NULL; - mir_free(nlhr->pData), nlhr->pData = NULL; + mir_free(nlhr->headers[0].szValue), nlhr->headers[0].szValue = nullptr; + mir_free(nlhr->headers), nlhr->headers = nullptr; + mir_free(nlhr->pData), nlhr->pData = nullptr; } int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* url, HTTPFormData* frm, size_t frmNum) @@ -700,7 +700,7 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* size_t dataMax = 0; for (HTTPFormData* iter = frm, *end = frm + frmNum; iter != end; ++iter) { if (iter->flags&HTTPFF_HEADER) continue; - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, 2 + sizeof(boundary) + 40); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, 2 + sizeof(boundary) + 40); memset(dataPos, '-', 2); dataPos += 2; memcpy(dataPos, boundary, sizeof(boundary)); dataPos += sizeof(boundary); memcpy(dataPos, "\r\nContent-Disposition: form-data; name=\"", 40); dataPos += 40; @@ -713,7 +713,7 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* if (!filename) filename = iter->value_str; else ++filename; valuelen = mir_strlen(filename); - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 13 + valuelen + 17); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 13 + valuelen + 17); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"; filename=\"", 13); dataPos += 13; memcpy(dataPos, filename, valuelen); dataPos += valuelen; @@ -741,9 +741,9 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* if (fp) { fseek(fp, 0, SEEK_END); filesize = ftell(fp); fseek(fp, 0, SEEK_SET); - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, filesize + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, filesize + 2); if (fread(dataPos, 1, filesize, fp) != filesize) { - fclose(fp), fp = NULL; + fclose(fp), fp = nullptr; } } if (!fp) { @@ -758,14 +758,14 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* memcpy(dataPos, "\r\n", 2); dataPos += 2; } else if (iter->flags&HTTPFF_8BIT) { - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 38 + valuelen + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 38 + valuelen + 2); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n", 38); dataPos += 38; memcpy(dataPos, iter->value_str, valuelen); dataPos += valuelen; memcpy(dataPos, "\r\n", 2); dataPos += 2; } else if (iter->flags&HTTPFF_INT) { - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 5 + 17/*max numbers*/ + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 5 + 17/*max numbers*/ + 2); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"\r\n\r\n", 5); dataPos += 5; int ret = snprintf(dataPos, 17, "%Id", iter->value_int); @@ -773,14 +773,14 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* memcpy(dataPos, "\r\n", 2); dataPos += 2; } else { - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, namelen + 5 + valuelen + 2); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, namelen + 5 + valuelen + 2); memcpy(dataPos, iter->name, namelen); dataPos += namelen; memcpy(dataPos, "\"\r\n\r\n", 5); dataPos += 5; memcpy(dataPos, iter->value_str, valuelen); dataPos += valuelen; memcpy(dataPos, "\r\n", 2); dataPos += 2; } } - HTTPFormAppendData(nlhr, &dataMax, &dataPos, NULL, 2 + sizeof(boundary) + 4); + HTTPFormAppendData(nlhr, &dataMax, &dataPos, nullptr, 2 + sizeof(boundary) + 4); memset(dataPos, '-', 2); dataPos += 2; memcpy(dataPos, boundary, sizeof(boundary)); dataPos += sizeof(boundary); memcpy(dataPos, "--\r\n", 4); dataPos += 4; diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp index 760ad268f3..20993010b2 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp +++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp @@ -35,11 +35,11 @@ CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool /*bAsync*/) { m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_DELETEAFTERSSEND; // SS_DLG_AUTOSEND | ; m_pszSendTyp = LPGENW("Email transfer"); - m_pszFileA = NULL; - m_pszFileName = NULL; - m_Email = NULL; - m_FriendlyName = NULL; - m_Subject = NULL; + m_pszFileA = nullptr; + m_pszFileName = nullptr; + m_Email = nullptr; + m_FriendlyName = nullptr; + m_Subject = nullptr; } CSendEmail::~CSendEmail() @@ -86,14 +86,14 @@ void CSendEmail::SendThread() MAPIFUNC lpMAPISendMail; HINSTANCE hMAPILib = ::LoadLibrary(L"MAPI32.DLL"); - if (hMAPILib == NULL) { + if (hMAPILib == nullptr) { //return -1; Error(SS_ERR_INIT, m_pszSendTyp); Exit(ACKRESULT_FAILED); return; } lpMAPISendMail = (MAPIFUNC)GetProcAddress(hMAPILib, "MAPISendMail"); - if (lpMAPISendMail == NULL) { + if (lpMAPISendMail == nullptr) { ::FreeLibrary(hMAPILib); //return -2; Error(SS_ERR_INIT, m_pszSendTyp); @@ -104,10 +104,10 @@ void CSendEmail::SendThread() arrfileDesc[0].ulReserved = 0; arrfileDesc[0].flFlags = 0; - arrfileDesc[0].lpFileType = NULL; + arrfileDesc[0].lpFileType = nullptr; arrfileDesc[0].nPosition = -1; arrfileDesc[0].lpszPathName = m_pszFileA; - arrfileDesc[0].lpszFileName = NULL; + arrfileDesc[0].lpszFileName = nullptr; Msg.nFileCount = 1; Msg.lpFiles = arrfileDesc; @@ -128,7 +128,7 @@ void CSendEmail::SendThread() recip.lpszAddress = m_Email; //email recip.ulEIDSize = 0; - recip.lpEntryID = NULL; + recip.lpEntryID = nullptr; Msg.lpRecips = &recip; try { diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index b3838ef569..ec25d447fa 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -35,7 +35,7 @@ CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) { m_EnableItem = 0; //SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENW("FTPFile transfer"); - m_pszFileName = NULL; + m_pszFileName = nullptr; } CSendFTPFile::~CSendFTPFile() diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index dda77d2764..6426adc9c9 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -INT_PTR(*g_MirCallService)(const char *, WPARAM, LPARAM) = NULL; +INT_PTR(*g_MirCallService)(const char *, WPARAM, LPARAM) = nullptr; ///////////////////////////////////////////////////////////////////////////////////////// @@ -37,9 +37,9 @@ CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/) { m_EnableItem = SS_DLG_DESCRIPTION; //| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENW("HTTPServer transfer"); - m_pszFileName = NULL; - m_fsi_pszSrvPath = NULL; - m_fsi_pszRealPath = NULL; + m_pszFileName = nullptr; + m_fsi_pszSrvPath = nullptr; + m_fsi_pszRealPath = nullptr; } CSendHTTPServer::~CSendHTTPServer() diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp index 728c6e2d3f..a5ca255e53 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp @@ -80,7 +80,7 @@ void CSendHost_ImageShack::SendThread() if (reply) { if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->dataLength) { reply->pData[reply->dataLength - 1] = '\0';/// make sure its null terminated - const char* url = NULL; + const char* url = nullptr; url = GetHTMLContent(reply->pData, "<image_link>", "</image_link>"); if (url && *url) { mir_free(m_URL), m_URL = mir_strdup(url); @@ -101,7 +101,7 @@ void CSendHost_ImageShack::SendThread() } else {/// check error mess from server url = GetHTMLContent(reply->pData, "<error ", "</error>"); - wchar_t* err = NULL; + wchar_t* err = nullptr; if (url) err = mir_a2u(url); if (!err || !*err) {/// fallback to server response mess mir_free(err); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 307b314beb..6710d8e16e 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -34,8 +34,8 @@ CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; HINSTANCE g_hSendSS; MGLOBAL g_myGlobals; -HNETLIBUSER g_hNetlibUser=0;//!< Netlib Register User -FI_INTERFACE *FIP=NULL; +HNETLIBUSER g_hNetlibUser=nullptr;//!< Netlib Register User +FI_INTERFACE *FIP=nullptr; int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP() IconItem ICONS[ICO_END_] = @@ -68,7 +68,7 @@ IconItem ICONS_BTN[ICO_BTN_END_] = { LPGEN("Down arrow"), "downarrow", IDI_DOWNARROW }, }; -static HANDLE m_hFolderScreenshot = 0; +static HANDLE m_hFolderScreenshot = nullptr; wchar_t* GetCustomPath() { wchar_t* pszPath = Utils_ReplaceVarsW(L"%miranda_userdata%\\Screenshots"); @@ -79,24 +79,24 @@ wchar_t* GetCustomPath() pszPath = mir_wstrdup(szPath); } if (!pszPath) { - MessageBox(NULL, L"Can not retrieve screenshot path.", L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); - return 0; + MessageBox(nullptr, L"Can not retrieve screenshot path.", L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); + return nullptr; } int result = CreateDirectoryTreeW(pszPath); if (result) { wchar_t szError[MAX_PATH]; mir_snwprintf(szError, MAX_PATH, TranslateT("Could not create screenshot folder (error code: %d):\n%s\nDo you have write permissions?"), result, pszPath); - MessageBox(NULL, szError, L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); + MessageBox(nullptr, szError, L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); mir_free(pszPath); - return 0; + return nullptr; } return pszPath; } /// services -static HANDLE m_hOpenCaptureDialog = 0; -static HANDLE m_hSendDesktop = 0; -static HANDLE m_hEditBitmap = 0; -static HANDLE m_hSend2ImageShack = 0; +static HANDLE m_hOpenCaptureDialog = nullptr; +static HANDLE m_hSendDesktop = nullptr; +static HANDLE m_hEditBitmap = nullptr; +static HANDLE m_hSend2ImageShack = nullptr; ///////////////////////////////////////////////////////////////////////////////////////// // Callback function of service for contact menu and main menu @@ -107,7 +107,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam) { TfrmMain* frmMain = new TfrmMain(); if (!frmMain) { - MessageBox(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); + MessageBox(nullptr, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return -1; } wchar_t* pszPath = GetCustomPath(); @@ -118,7 +118,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam) frmMain->Init(pszPath, wParam); mir_free(pszPath); if (lParam == 0xFFFF) { - frmMain->SetTargetWindow(NULL); + frmMain->SetTargetWindow(nullptr); } frmMain->Show(); return 0; @@ -137,7 +137,7 @@ INT_PTR service_SendDesktop(WPARAM wParam, LPARAM) { TfrmMain* frmMain = new TfrmMain(); if (!frmMain) { - MessageBox(NULL, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); + MessageBox(nullptr, TranslateT("Could not create main dialog."), TranslateT("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return -1; } wchar_t* pszPath = GetCustomPath(); @@ -190,8 +190,8 @@ INT_PTR service_EditBitmap(WPARAM, LPARAM) INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) { - char* result = NULL; - CSendHost_ImageShack* cSend = new CSendHost_ImageShack(NULL, lParam, false); + char* result = nullptr; + CSendHost_ImageShack* cSend = new CSendHost_ImageShack(nullptr, lParam, false); cSend->m_bDeleteAfterSend = false; cSend->SetFile((char*)wParam); if (lParam != NULL) { @@ -271,8 +271,8 @@ DLL_EXPORT int Load(void) pcli = Clist_GetInterface(); INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); - if (FIP == NULL || result != S_OK) { - MessageBox(NULL, TranslateT("Image services (AdvaImg plugin) not found.\nSendSS disabled."), TranslateT("SendSS"), MB_OK | MB_ICONERROR | MB_APPLMODAL); + if (FIP == nullptr || result != S_OK) { + MessageBox(nullptr, TranslateT("Image services (AdvaImg plugin) not found.\nSendSS disabled."), TranslateT("SendSS"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return 1; } /// hook events @@ -328,7 +328,7 @@ DLL_EXPORT int Load(void) /// register highlighter window class HBRUSH brush = CreateSolidBrush(0x0000FF00);//owned by class - WNDCLASS wndclass = { CS_HREDRAW | CS_VREDRAW, DefWindowProc, 0, 0, g_hSendSS, NULL, NULL, brush, NULL, L"SendSSHighlighter" }; + WNDCLASS wndclass = { CS_HREDRAW | CS_VREDRAW, DefWindowProc, 0, 0, g_hSendSS, nullptr, nullptr, brush, nullptr, L"SendSSHighlighter" }; g_clsTargetHighlighter = RegisterClass(&wndclass); return 0; } diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index cf2ca571c7..3e620db8d1 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -171,7 +171,7 @@ TfrmAbout::TfrmAbout(HWND Owner) m_hWndOwner = Owner; m_Page = 1; // create window - m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UAboutForm), 0, DlgTfrmAbout, (LPARAM)this); + m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UAboutForm), nullptr, DlgTfrmAbout, (LPARAM)this); //register object _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); } @@ -212,5 +212,5 @@ void TfrmAbout::btnPageClick() mir_free(pszPlug); mir_free(pszVer); SetDlgItemText(m_hWnd, IDC_HEADERBAR, newTitle); - InvalidateRect(GetDlgItem(m_hWnd, IDC_HEADERBAR), NULL, 1); + InvalidateRect(GetDlgItem(m_hWnd, IDC_HEADERBAR), nullptr, 1); } diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 55ed414586..8ccd2683d5 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -270,9 +270,9 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) ChangeWindowMessageFilterEx_t pChangeWindowMessageFilterEx; pChangeWindowMessageFilterEx = (ChangeWindowMessageFilterEx_t)GetProcAddress(GetModuleHandleA("user32"), "ChangeWindowMessageFilterEx"); if (pChangeWindowMessageFilterEx) { /// Win7+, UAC fix - pChangeWindowMessageFilterEx(m_hWnd, WM_DROPFILES, MSGFLT_ALLOW, NULL); - pChangeWindowMessageFilterEx(m_hWnd, WM_COPYDATA, MSGFLT_ALLOW, NULL); - pChangeWindowMessageFilterEx(m_hWnd, 0x0049/*WM_COPYGLOBALDATA*/, MSGFLT_ALLOW, NULL); + pChangeWindowMessageFilterEx(m_hWnd, WM_DROPFILES, MSGFLT_ALLOW, nullptr); + pChangeWindowMessageFilterEx(m_hWnd, WM_COPYDATA, MSGFLT_ALLOW, nullptr); + pChangeWindowMessageFilterEx(m_hWnd, 0x0049/*WM_COPYGLOBALDATA*/, MSGFLT_ALLOW, nullptr); } DragAcceptFiles(m_hWnd, 1); } @@ -403,8 +403,8 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) break; case ID_imgTarget: if (m_opt_tabCapture != 0) break; - m_hLastWin = NULL; - SetTimer(m_hWnd, ID_imgTarget, BUTTON_POLLDELAY, NULL); + m_hLastWin = nullptr; + SetTimer(m_hWnd, ID_imgTarget, BUTTON_POLLDELAY, nullptr); break; case ID_btnAbout: TfrmMain::btnAboutClick(); @@ -450,7 +450,7 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) break; case ID_edtCaption: //cboxDesktopChange m_opt_cboxDesktop = (BYTE)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); - m_hTargetWindow = NULL; + m_hTargetWindow = nullptr; if (m_opt_cboxDesktop > 0) { edtSizeUpdate(m_Monitors[m_opt_cboxDesktop - 1].rcMonitor, GetParent((HWND)lParam), ID_edtSize); } @@ -466,10 +466,10 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) switch (IDControl) { //lParam = Handle to the control case ID_edtQuality: - m_opt_edtQuality = (BYTE)GetDlgItemInt(m_hWnd, ID_edtQuality, NULL, FALSE); + m_opt_edtQuality = (BYTE)GetDlgItemInt(m_hWnd, ID_edtQuality, nullptr, FALSE); break; case ID_edtTimed: - m_opt_edtTimed = (BYTE)GetDlgItemInt(m_hWnd, ID_edtTimed, NULL, FALSE); + m_opt_edtTimed = (BYTE)GetDlgItemInt(m_hWnd, ID_edtTimed, nullptr, FALSE); break; default: break; @@ -519,7 +519,7 @@ void TfrmMain::wmTimer(WPARAM wParam, 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, (wchar_t*)g_clsTargetHighlighter, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hSendSS, NULL); + m_hTargetHighlighter = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW, (wchar_t*)g_clsTargetHighlighter, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_hSendSS, nullptr); if (!m_hTargetHighlighter) return; SetLayeredWindowAttributes(m_hTargetHighlighter, 0, 123, LWA_ALPHA); SetSystemCursor(CopyCursor(GetIcon(ICO_TARGET)), OCR_IBEAM);//text cursor @@ -529,8 +529,8 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) } if (!(GetAsyncKeyState(primarymouse) & 0x8000)) { KillTimer(m_hWnd, ID_imgTarget); - SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0); - DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = NULL; + SystemParametersInfo(SPI_SETCURSORS, 0, nullptr, 0); + DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = nullptr; SetTargetWindow(m_hLastWin); Show(); return; @@ -558,7 +558,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) int width = rect.right - rect.left; int height = rect.bottom - rect.top; if (g_iTargetBorder) { - SetWindowPos(m_hTargetHighlighter, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(m_hTargetHighlighter, nullptr, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE); if (width > g_iTargetBorder * 2 && height > g_iTargetBorder * 2) { HRGN hRegnNew = CreateRectRgn(0, 0, width, height); HRGN hRgnHole = CreateRectRgn(g_iTargetBorder, g_iTargetBorder, width - g_iTargetBorder, height - g_iTargetBorder); @@ -566,7 +566,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) DeleteObject(hRgnHole); SetWindowRgn(m_hTargetHighlighter, hRegnNew, FALSE);//cleans up hRegnNew } - else SetWindowRgn(m_hTargetHighlighter, NULL, FALSE); + else SetWindowRgn(m_hTargetHighlighter, nullptr, FALSE); } SetWindowPos(m_hTargetHighlighter, HWND_TOPMOST, rect.left, rect.top, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); } @@ -579,7 +579,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) if (!m_bCapture) { //only start once if (m_Screenshot) { FIP->FI_Unload(m_Screenshot); - m_Screenshot = NULL; + m_Screenshot = nullptr; } m_bCapture = true; switch (m_opt_tabCapture) { @@ -587,7 +587,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) m_Screenshot = CaptureWindow(m_hTargetWindow, m_opt_chkClientArea, m_opt_chkIndirectCapture); break; case 1: - m_Screenshot = CaptureMonitor((m_opt_cboxDesktop > 0) ? m_Monitors[m_opt_cboxDesktop - 1].szDevice : NULL); + m_Screenshot = CaptureMonitor((m_opt_cboxDesktop > 0) ? m_Monitors[m_opt_cboxDesktop - 1].szDevice : nullptr); break; case 2: /// edge case, existing local file break; @@ -620,7 +620,7 @@ void TfrmMain::wmNotify(WPARAM, LPARAM lParam) case TCN_SELCHANGING:{ if (!m_hwndTabPage) break; ShowWindow(m_hwndTabPage, SW_HIDE); - m_hwndTabPage = NULL; + m_hwndTabPage = nullptr; break; } case TCN_SELCHANGE:{ TAB_INFO itab = { TCIF_PARAM }; @@ -662,7 +662,7 @@ void TfrmMain::UMevent(WPARAM, LPARAM lParam) case EVT_CaptureDone: if (!m_Screenshot && m_opt_tabCapture != 2) { wchar_t *err = TranslateT("Couldn't take a screenshot"); - MessageBox(NULL, err, ERROR_TITLE, MB_OK | MB_ICONWARNING); + MessageBox(nullptr, err, ERROR_TITLE, MB_OK | MB_ICONWARNING); Show(); return; } @@ -674,7 +674,7 @@ void TfrmMain::UMevent(WPARAM, LPARAM lParam) if (m_opt_chkOpenAgain) { if (m_Screenshot) { FIP->FI_Unload(m_Screenshot); - m_Screenshot = NULL; + m_Screenshot = nullptr; } Show(); } @@ -696,22 +696,22 @@ TfrmMain::TfrmMain() /* m_opt_XXX */ m_bOnExitSave = TRUE; - m_hWnd = NULL; + m_hWnd = nullptr; m_hContact = NULL; m_bFormAbout = false; - m_hTargetWindow = m_hLastWin = NULL; - m_hTargetHighlighter = NULL; - m_FDestFolder = m_pszFile = NULL; - m_Screenshot = NULL; + m_hTargetWindow = m_hLastWin = nullptr; + m_hTargetHighlighter = nullptr; + m_FDestFolder = m_pszFile = nullptr; + m_Screenshot = nullptr; /* m_AlphaColor */ - m_cSend = NULL; + m_cSend = nullptr; - m_Monitors = NULL; + m_Monitors = nullptr; m_MonitorCount = MonitorInfoEnum(m_Monitors, m_VirtualScreen); /* m_opt_XXX */ LoadOptions(); m_bCapture = false; /* m_hwndTab,m_hwndTabPage */ - m_himlTab = NULL; + m_himlTab = nullptr; } TfrmMain::~TfrmMain() @@ -723,8 +723,8 @@ TfrmMain::~TfrmMain() if (m_Screenshot) FIP->FI_Unload(m_Screenshot); if (m_cSend) delete m_cSend; if (m_hTargetHighlighter) { - DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = NULL; - SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0); + DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = nullptr; + SystemParametersInfo(SPI_SETCURSORS, 0, nullptr, 0); } } @@ -792,7 +792,7 @@ void TfrmMain::Init(wchar_t* DestFolder, MCONTACT Contact) m_hContact = Contact; // create window - m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UMainForm), 0, DlgTfrmMain, (LPARAM)this); + m_hWnd = CreateDialogParam(g_hSendSS, MAKEINTRESOURCE(IDD_UMainForm), nullptr, DlgTfrmMain, (LPARAM)this); //register object _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); @@ -826,11 +826,11 @@ void TfrmMain::btnCaptureClick() TfrmMain::Hide(); if (m_opt_chkTimed) { - SetTimer(m_hWnd, ID_chkTimed, m_opt_edtTimed ? m_opt_edtTimed * 1000 : 500, NULL); /// calls EVT_CaptureDone + SetTimer(m_hWnd, ID_chkTimed, m_opt_edtTimed ? m_opt_edtTimed * 1000 : 500, nullptr); /// calls EVT_CaptureDone return; } if (m_opt_tabCapture == 1) { /// desktop needs always time to update from TfrmMain::Hide() - SetTimer(m_hWnd, ID_chkTimed, 500, NULL); /// calls EVT_CaptureDone + SetTimer(m_hWnd, ID_chkTimed, 500, nullptr); /// calls EVT_CaptureDone return; } if (m_opt_tabCapture != 2) { @@ -889,7 +889,7 @@ void TfrmMain::cboxSendByChange() m_cSend = new CSendHost_Imgur(m_hWnd, m_hContact, true); break; default: //SS_JUSTSAVE - "Just save it " - m_cSend = NULL; + m_cSend = nullptr; break; } if (m_cSend) { @@ -898,12 +898,12 @@ void TfrmMain::cboxSendByChange() } bState = (itemFlag & SS_DLG_DELETEAFTERSSEND); hIcon = GetIconBtn(m_opt_btnDeleteAfterSend ? ICO_BTN_DELON : ICO_BTN_DEL); - SendDlgItemMessage(m_hWnd, ID_chkDeleteAfterSend, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : 0)); + SendDlgItemMessage(m_hWnd, ID_chkDeleteAfterSend, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : nullptr)); Button_Enable(GetDlgItem(m_hWnd, ID_chkDeleteAfterSend), bState); bState = (itemFlag & SS_DLG_DESCRIPTION); hIcon = GetIconBtn(m_opt_btnDesc ? ICO_BTN_DESCON : ICO_BTN_DESC); - SendDlgItemMessage(m_hWnd, ID_chkDesc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : 0)); + SendDlgItemMessage(m_hWnd, ID_chkDesc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(bState ? hIcon : nullptr)); Button_Enable(GetDlgItem(m_hWnd, ID_chkDesc), bState); } @@ -931,7 +931,7 @@ void TfrmMain::btnAboutOnCloseWindow(HWND) void TfrmMain::btnExploreClick() { if (m_FDestFolder) - ShellExecute(NULL, L"explore", m_FDestFolder, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"explore", m_FDestFolder, nullptr, nullptr, SW_SHOW); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1020,7 +1020,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) case 1: // JPG wszFileName.Append(L".jpg"); { - FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL); + FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr); FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32); FIP->FI_Unload(dib32); ret = FIP->FI_SaveU(FIF_JPEG, dib24, wszFileName, 0); @@ -1031,7 +1031,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) case 2: // BMP wszFileName.Append(L".bmp"); { - FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL); + FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr); FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32); FIP->FI_Unload(dib32); ret = FIP->FI_SaveU(FIF_BMP, dib24, wszFileName, 0); @@ -1042,7 +1042,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) case 3: //TIFF (miranda freeimage interface do not support save tiff, we udse GDI+) wszFileName.Append(L".tif"); { - FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL); + FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr); FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32); FIP->FI_Unload(dib32); @@ -1119,17 +1119,17 @@ void TfrmMain::FormClose() do { // wait for editor exit or messages/input res = MsgWaitForMultipleObjects(1, &shex.hProcess, 0, INFINITE, QS_ALLINPUT); - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { res = WAIT_OBJECT_0; - PostMessage(NULL, WM_QUIT, 0, 0); // forward for outer message loops + PostMessage(nullptr, WM_QUIT, 0, 0); // forward for outer message loops break; } // process dialog messages (of unknown dialogs) HWND hwndDlgModeless = GetActiveWindow(); // HWND hwndDlgModeless = msg.hwnd; // for(HWND hTMP; (hTMP=GetAncestor(hwndDlgModeless,GA_PARENT)) && IsChild(hTMP,hwndDlgModeless); hwndDlgModeless=hTMP); - if (hwndDlgModeless != NULL && IsDialogMessage(hwndDlgModeless, &msg)) /* Wine fix. */ + if (hwndDlgModeless != nullptr && IsDialogMessage(hwndDlgModeless, &msg)) /* Wine fix. */ continue; // process messages TranslateMessage(&msg); @@ -1144,7 +1144,7 @@ void TfrmMain::FormClose() if (send && m_cSend && m_pszFile) { if (!m_cSend->Send()) // not sent now, class deletes itself later - m_cSend = NULL; + m_cSend = nullptr; cboxSendByChange(); } else if (!send && bCanDelete) diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index cc58922f8e..7b0b71c5e6 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -60,8 +60,8 @@ static BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen) { - MONITORS tmp = { 0, 0 }; - if (EnumDisplayMonitors(NULL, NULL, MonitorInfoEnumProc, (LPARAM)&tmp)) { + MONITORS tmp = { 0, nullptr }; + if (EnumDisplayMonitors(nullptr, nullptr, MonitorInfoEnumProc, (LPARAM)&tmp)) { myMonitors = tmp.info; memset(&virtualScreen, 0, sizeof(virtualScreen)); for (size_t i = 0; i < tmp.count; ++i) { @@ -74,7 +74,7 @@ size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen) return 0; } -FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = 0); +FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = nullptr); ///////////////////////////////////////////////////////////////////////////////////////// // capture window as FIBITMAP - caller must FIP->FI_Unload(dib) @@ -86,7 +86,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) RECT rect;//cropping rect if (!hCapture || !IsWindow(hCapture)) - return NULL; + return nullptr; hForegroundWin = GetForegroundWindow(); // old foreground window SetForegroundWindow(hCapture); // force target foreground BringWindowToTop(hCapture); // bring it to top as well @@ -95,7 +95,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) HWND hParent = GetAncestor(hCapture, GA_PARENT); if (hParent && !IsChild(hParent, hCapture)) - hParent = NULL; + hParent = nullptr; if (bIndirectCapture) { intptr_t wastopmost = GetWindowLongPtr(hCapture, GWL_EXSTYLE)&WS_EX_TOPMOST; if (!wastopmost) @@ -107,7 +107,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) } else GetWindowRect(hCapture, &rect); - dib = CaptureMonitor(NULL, &rect); + dib = CaptureMonitor(nullptr, &rect); if (!wastopmost) SetWindowPos(hCapture, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } @@ -151,14 +151,14 @@ FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/) /// get screen resolution if (!szDevice) { - hScrDC = CreateDC(L"DISPLAY", NULL, NULL, NULL); + hScrDC = CreateDC(L"DISPLAY", nullptr, nullptr, nullptr); rect.left = GetSystemMetrics(SM_XVIRTUALSCREEN); rect.top = GetSystemMetrics(SM_YVIRTUALSCREEN); rect.right = GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN); rect.bottom = GetSystemMetrics(SM_YVIRTUALSCREEN) + GetSystemMetrics(SM_CYVIRTUALSCREEN); } else { - hScrDC = CreateDC(szDevice, NULL, NULL, NULL); + hScrDC = CreateDC(szDevice, nullptr, nullptr, nullptr); rect.left = rect.top = 0; rect.right = GetDeviceCaps(hScrDC, HORZRES); rect.bottom = GetDeviceCaps(hScrDC, VERTRES); @@ -171,7 +171,7 @@ FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/) } FIBITMAP *dib = CreateDIBFromDC(hScrDC, &rect); - ReleaseDC(NULL, hScrDC); + ReleaseDC(nullptr, hScrDC); return dib; } @@ -204,8 +204,8 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) bool bFixAlpha = true; bool bInvert = false; HBRUSH hBr = CreateSolidBrush(RGB(255, 255, 255));//Create a SolidBrush object for non transparent area - HBITMAP hMask = CreateBitmap(width, height, 1, 1, NULL);// Create monochrome (1 bit) B+W mask bitmap. - HDC hMaskDC = CreateCompatibleDC(0); + HBITMAP hMask = CreateBitmap(width, height, 1, 1, nullptr);// Create monochrome (1 bit) B+W mask bitmap. + HDC hMaskDC = CreateCompatibleDC(nullptr); SelectBitmap(hMaskDC, hMask); HRGN hRgn = CreateRectRgn(0, 0, 0, 0); if (hCapture && GetWindowRgn(hCapture, hRgn) == ERROR) { @@ -254,7 +254,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) DeleteDC(hMemDC); DeleteObject(hBitmap); if (!hDC) - ReleaseDC(NULL, hScrDC); + ReleaseDC(nullptr, hScrDC); #ifdef _DEBUG switch (FIP->FI_GetImageType(dib)) { @@ -349,7 +349,7 @@ void SaveGIF(HBITMAP hBmp, const wchar_t *szFilename) { Gdiplus::GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; - Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr); Gdiplus::Bitmap *pBitmap = Gdiplus::Bitmap::FromHBITMAP(hBmp, (HPALETTE)GetStockObject(DEFAULT_PALETTE)); if (pBitmap) { @@ -357,7 +357,7 @@ void SaveGIF(HBITMAP hBmp, const wchar_t *szFilename) CLSID clsidEncoder; if (GetEncoderClsid(L"image/gif", clsidEncoder)) { LPWSTR pswFile = mir_wstrdup(szFilename); - pBitmap->Save((const WCHAR*)pswFile, &clsidEncoder, NULL); + pBitmap->Save((const WCHAR*)pswFile, &clsidEncoder, nullptr); mir_free(pswFile); } delete pBitmap; @@ -373,7 +373,7 @@ void SaveTIF(HBITMAP hBmp, const wchar_t *szFilename) ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::Status stat; - Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr); Gdiplus::Bitmap *pBitmap = Gdiplus::Bitmap::FromHBITMAP(hBmp, (HPALETTE)GetStockObject(DEFAULT_PALETTE)); if (pBitmap) { diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index 54d20d58ef..71bbf81a27 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -47,7 +47,7 @@ typedef struct TMBCtrl // External theme methods and properties static mir_cs csTips; -static HWND hwndToolTips = NULL; +static HWND hwndToolTips = nullptr; /** * name: DestroyTheme @@ -59,11 +59,11 @@ static void __fastcall DestroyTheme(BTNCTRL *ctl) { if (ctl->hThemeButton) { CloseThemeData(ctl->hThemeButton); - ctl->hThemeButton = NULL; + ctl->hThemeButton = nullptr; } if (ctl->hThemeToolbar) { CloseThemeData(ctl->hThemeToolbar); - ctl->hThemeToolbar = NULL; + ctl->hThemeToolbar = nullptr; } } @@ -124,7 +124,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT OffsetRect(rcText, rcImage.right + 4, 0); if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hIcon, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hIcon, 0, rcImage.left, rcImage.top, rcImage.right - rcImage.left, rcImage.bottom - rcImage.top, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); @@ -141,7 +141,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT rcImage.top = (rcClient->bottom - rcClient->top - rcImage.bottom) / 2; if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcImage.left, rcImage.top, rcImage.right - rcImage.left, rcImage.bottom - rcImage.top, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); @@ -209,7 +209,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien wszText, ccText, DST_PREFIXTEXT, - NULL, + nullptr, &sizeText); if (ctl->cHot) { @@ -222,7 +222,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien L"&", 1, DST_PREFIXTEXT, - NULL, + nullptr, &rcHot); sizeText.right -= (rcHot.right - rcHot.left); @@ -263,7 +263,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) // Draw the flat button if (ctl->dwStyle & MBS_FLAT) { - HBRUSH hbr = NULL; + HBRUSH hbr = nullptr; if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT) hbr = GetSysColorBrush(COLOR_3DLIGHT); @@ -342,7 +342,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) : GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); - DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)szText, 0, rcText.left, rcText.top, rcText.right - rcText.left, rcText.bottom - rcText.top, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); SelectObject(hdcMem, hOldFont); @@ -400,7 +400,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L } if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { DestroyWindow(hwndToolTips); - hwndToolTips = NULL; + hwndToolTips = nullptr; } } DestroyTheme(bct); @@ -421,7 +421,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L } tmp++; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; @@ -430,7 +430,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L if (bct->dwStyle & MBS_PUSHBUTTON) { if (bct->pbState) bct->pbState = 0; else bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } else SetFocus(hwndBtn); @@ -442,7 +442,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_THEMECHANGED: // themed changed, reload theme object LoadTheme(bct); - InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it + InvalidateRect(bct->hwnd, nullptr, TRUE); // repaint it break; case WM_SETFONT: // remember the font so we can use it later @@ -485,18 +485,18 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BM_SETIMAGE: if (wParam == IMAGE_ICON) { bct->hIcon = (HICON)lParam; - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hBitmap = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } else if (wParam == IMAGE_BITMAP) { - bct->hIcon = NULL; + bct->hIcon = nullptr; bct->hBitmap = (HBITMAP)lParam; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } else if (wParam == NULL && lParam == NULL) { - bct->hIcon = NULL; - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hIcon = nullptr; + bct->hBitmap = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; @@ -510,7 +510,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L bct->pbState = 0; bct->stateId = PBS_NORMAL; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BM_GETCHECK: @@ -519,14 +519,14 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BUTTONSETDEFAULT: bct->defbutton = (wParam != 0); - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BUTTONADDTOOLTIP: if (wParam) { mir_cslock lck(csTips); if (!hwndToolTips) - hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); + hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandle(nullptr), nullptr); if (lParam == MBBF_UNICODE) { TOOLINFOW ti; @@ -571,34 +571,34 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_SETFOCUS: // set keybord bFocus and redraw bct->bFocus = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_KILLFOCUS: // kill bFocus and redraw bct->bFocus = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_WINDOWPOSCHANGED: - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_ENABLE: // windows tells us to enable/disable bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_MOUSELEAVE: // faked by the WM_TIMER if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; case WM_LBUTTONDOWN: if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; @@ -615,17 +615,17 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L // Tell your daddy you got clicked, if mouse is still over the button. if ((bct->dwStyle & MBS_PUSHBUTTON) || bPressed) SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn); - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; case WM_MOUSEMOVE: if (bct->stateId == PBS_NORMAL) { bct->stateId = PBS_HOT; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } // Call timer, used to start cheesy TrackMouseEvent faker - SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); + SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, nullptr); break; case WM_TIMER: // use a timer to check if they have did a mouseout @@ -666,7 +666,7 @@ void CtrlButtonLoadModule()/// @fixme : compatibility with UInfoEx is everything wc.cbSize = sizeof(wc); wc.lpszClassName = UINFOBUTTONCLASS; wc.lpfnWndProc = Button_WndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(LPBTNCTRL); wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index b1a46feabb..25017e15a1 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -88,14 +88,14 @@ static HICON MsgLoadIcon(LPMSGBOX pMsgBox) case MB_ICON_WARNING: case MB_ICON_INFO: { - LPCTSTR ico[] = { 0, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION }; - hIcon = LoadIcon(NULL, ico[MB_ICON_INDEX(pMsgBox->uType)]); + LPCTSTR ico[] = { nullptr, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION }; + hIcon = LoadIcon(nullptr, ico[MB_ICON_INDEX(pMsgBox->uType)]); } break; // no icon default: - hIcon = NULL; + hIcon = nullptr; } return hIcon; } @@ -684,7 +684,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); - mb.hiMsg = NULL; + mb.hiMsg = nullptr; mb.ptszTitle = TranslateW(pszTitle); mb.ptszInfoText = TranslateW(pszInfo); mb.ptszMsg = tszMsg; @@ -711,7 +711,7 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); - mb.hiMsg = NULL; + mb.hiMsg = nullptr; mb.ptszTitle = tszTitle; mb.ptszMsg = tszMsg; mb.uType = MB_OK | MB_ICON_ERROR; |