diff options
| author | George Hazan <ghazan@miranda.im> | 2019-03-02 12:32:44 +0300 |
|---|---|---|
| committer | George Hazan <ghazan@miranda.im> | 2019-03-02 12:32:55 +0300 |
| commit | 931a7dc1ac0dbc7e6c1083583ced915e572f5b47 (patch) | |
| tree | 9fe9a6448d44030e26aa7107ce16044ed413e0d0 /plugins/CurrencyRates/src/CurrencyRateChart.cpp | |
| parent | dd7d9954042254e66e3bbbec7195c6be8b1a0663 (diff) | |
all protocols (even virtual ones) moved to the Protocols folder
Diffstat (limited to 'plugins/CurrencyRates/src/CurrencyRateChart.cpp')
| -rw-r--r-- | plugins/CurrencyRates/src/CurrencyRateChart.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/plugins/CurrencyRates/src/CurrencyRateChart.cpp b/plugins/CurrencyRates/src/CurrencyRateChart.cpp deleted file mode 100644 index a3208811a4..0000000000 --- a/plugins/CurrencyRates/src/CurrencyRateChart.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "StdAfx.h" - -#ifdef CHART_IMPLEMENT - -namespace -{ - class CMyJob : private boost::noncopyable - { - private: - CMyJob(LPCTSTR pszName = nullptr): m_hJob(::CreateJobObject(nullptr,pszName)) - { - if(m_hJob) - { - JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; - jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; - if(0 == ::SetInformationJobObject(m_hJob,JobObjectExtendedLimitInformation,&jeli,sizeof(jeli))) - { -#ifdef OUTPUT_TO_DEBUG_VIEWER - ::OutputDebugString(_T("Error occurred during the job initialization\n")); -#endif - } - } - - } - ~CMyJob() - { - if(m_hJob) - { - ::CloseHandle(m_hJob); - } - } - - public: - static CMyJob& GetInstance() - { - static CMyJob g_job(_T("MirandaJob_E12D5E9C_00E7_4FFA_9831_F35E45C6EBDA")); - return g_job; - } - - bool AssignProcess(HANDLE hProcess) - { - if(m_hJob && hProcess) - { - auto b = (TRUE == ::AssignProcessToJobObject(m_hJob,hProcess)); - return b; - } - - return false; - } - - private: - HANDLE m_hJob; - }; - -} - -INT_PTR CurrencyRatesMenu_Chart(WPARAM wp, LPARAM /*lp*/) -{ -#ifdef _UNICODE - MCONTACT hContact = static_cast<MCONTACT>(wp); - if (NULL == hContact) - return 0; - - auto sLogFileName = GetContactLogFileName(hContact); - - if(auto hWnd = ::FindWindow(nullptr,_T("Miranda CurrencyRates Chart"))) - { - COPYDATASTRUCT copydata_struct; - copydata_struct.cbData = static_cast<DWORD>(sLogFileName.size()*sizeof(TCHAR)); - copydata_struct.lpData = const_cast<void*>(static_cast<const void*>(sLogFileName.c_str())); - copydata_struct.dwData = 0x1945; - - SendMessage(hWnd,WM_COPYDATA,0,reinterpret_cast<LPARAM>(©data_struct)); - } - else - { - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW; - si.wShowWindow = SW_SHOWNORMAL; - ZeroMemory(&pi, sizeof(pi)); - - auto sCmdLine = CreateFilePath(_T("CurrencyRatesChart.exe")); - sCmdLine += _T(" \""); - sCmdLine += sLogFileName; - sCmdLine += _T("\""); - if(::CreateProcess(nullptr,const_cast<LPTSTR>(sCmdLine.c_str()),nullptr,nullptr,FALSE,0,nullptr,nullptr,&si,&pi)) - { - CMyJob::GetInstance().AssignProcess(pi.hProcess); - - ::CloseHandle(pi.hThread); - ::CloseHandle(pi.hProcess); - } - } -#endif - return 0; -} - -#endif //CHART_IMPLEMENT |
