void RenamePrinter(const std::tstring& currentPrinterName, const std::tstring& newPrinterName)
{
   HANDLE printer = 0;
   PRINTER_INFO_2 *printerInfo = 0;
   DEVMODE *pDevMode = 0;
   
   try
   {
      // get the printer and it's info structure...
      PRINTER_DEFAULTS printerDefaults;
      ZeroMemory(&printerDefaults, sizeof(printerDefaults));
      printerDefaults.DesiredAccess = PRINTER_ALL_ACCESS;

      BOOL result = OpenPrinter((LPTSTR)currentPrinterName.c_str(), &printer, &printerDefaults);
      if (!result || (0 == printer))
         throw Workshare::Exception(_T("Failed to open printer."));

      DWORD bufferSize = 0;
      SetLastError(0);
      result = GetPrinter(printer, 2, 0, 0, &bufferSize);
      if ((!result) && (GetLastError() != ERROR_INSUFFICIENT_BUFFER) || (bufferSize == 0))
         throw Workshare::Exception(_T("Failed to get printer info buffer size."));

      printerInfo = (PRINTER_INFO_2 *)GlobalAlloc(GPTR, bufferSize);
      if (0 == printerInfo)
         throw Workshare::System::SystemException(_T("Failed to allocate printer info buffer."));

      result = GetPrinter(printer, 2, (LPBYTE)printerInfo, bufferSize, &bufferSize);
      if (!result)
         throw Workshare::Exception(_T("Failed to get printer info."));

      // If GetPrinter didn't fill in the DEVMODE, try to get it by calling DocumentProperties...
      LONG lFlag;

      if (0 == printerInfo->pDevMode)
      {
         bufferSize = DocumentProperties(0, printer, (LPTSTR)currentPrinterName.c_str(), 0, 0, 0);
         if (bufferSize <= 0)
            throw Workshare::Exception(_T("Failed to get document properties buffer size."));

         pDevMode = (DEVMODE *)GlobalAlloc(GPTR, bufferSize);
         if (0 == pDevMode)
            throw Workshare::System::SystemException(_T("Failed to allocate document properties buffer."));

         lFlag = DocumentProperties(0, printer, (LPTSTR)currentPrinterName.c_str(), pDevMode, 0, DM_OUT_BUFFER);
         if (lFlag != IDOK || 0 == pDevMode)
            throw Workshare::Exception(_T("Failed to get document properties."));

         printerInfo->pDevMode = pDevMode;
      }

      if (!(printerInfo->pDevMode->dmFields & DM_ORIENTATION))
         throw Workshare::Exception(_T("Printer does not support the required name change."));

      // Specify the new printer name...
      printerInfo->pPrinterName = (LPTSTR)newPrinterName.c_str() ;

      // Do not attempt to set security descriptor...
      printerInfo->pSecurityDescriptor = 0;

      lFlag = DocumentProperties(0, printer, (LPTSTR)currentPrinterName.c_str(), printerInfo->pDevMode,
                                 printerInfo->pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER);
      if (IDOK != lFlag)
         throw Workshare::Exception(_T("Failed to update the devmode part of document properties."));

      result = SetPrinter(printer, 2, (LPBYTE)printerInfo, 0);
      if (!result)
         throw Workshare::Exception(_T("Failed to update printer information."));

      // Tell other apps that there was a change...
      SendMessageTimeout(HWND_BROADCAST, WM_DEVMODECHANGE, 0L,
                        (LPARAM)(LPCTSTR)(LPTSTR)currentPrinterName.c_str(), SMTO_NORMAL, 1000, 0);

      return;
   }
   catch(...)
   {
      if (printerInfo)
         GlobalFree(printerInfo);
      if (printer)
         ClosePrinter(printer);
      if (pDevMode)
         GlobalFree(pDevMode);

      throw;
   }
}
int CPostData::TBigDataPost()
{
	//CString sTraceBuffer;
	CUrlCrack url;
	if (!url.Crack(m_strUrl.c_str()))
		return ERR_URLCRACKERROR;

	m_hInetSession = ::InternetOpen(MS_USERAGENT, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
	if (m_hInetSession == NULL)
		return ERR_NETWORKERROR;

	DWORD dwTimeOut = 360000;
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONTROL_SEND_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_SEND_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_RECEIVE_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONNECT_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);

	m_hInetConnection = ::InternetConnect(m_hInetSession, url.GetHostName(), url.GetPort(), NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD)this);
	if (m_hInetConnection == NULL)
	{
		CloseHandles();
		return  ERR_NETWORKERROR;
	}

	LPCTSTR ppszAcceptTypes[2];
	ppszAcceptTypes[0] = _T("*/*"); 
	ppszAcceptTypes[1] = NULL;

	DWORD dwFlags = 0;

	if( url.GetPort() == 443 )
	{
		dwFlags =	INTERNET_FLAG_NO_CACHE_WRITE |
					INTERNET_FLAG_KEEP_CONNECTION |
					INTERNET_FLAG_PRAGMA_NOCACHE |
					INTERNET_FLAG_SECURE |
					INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
					INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
	}
	else if( url.GetPort() == 80 )
	{
		//for HTTP
		dwFlags =	INTERNET_FLAG_NO_CACHE_WRITE |
					INTERNET_FLAG_KEEP_CONNECTION |
					INTERNET_FLAG_PRAGMA_NOCACHE ;
	}

	m_hInetFile = HttpOpenRequest(m_hInetConnection, _T("POST"), url.GetPath(), NULL, NULL, ppszAcceptTypes, dwFlags, (DWORD)this);
	if (m_hInetFile == NULL)
	{
		CloseHandles();
		return  ERR_NETWORKERROR;
	}
	return ERR_SUCCESS;
}
int CPostData::TransferDataPost()
{
	CUrlCrack url;
	if (!url.Crack(m_strUrl.c_str()))
		return ERR_URLCRACKERROR;

	m_hInetSession = ::InternetOpen(MONEYHUB_USERAGENT, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
	if (m_hInetSession == NULL)
		return ERR_NETWORKERROR;


	DWORD dwTimeOut = 60000;
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONTROL_SEND_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_SEND_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_RECEIVE_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONNECT_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);

	m_hInetConnection = ::InternetConnect(m_hInetSession, url.GetHostName(), url.GetPort(), NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD)this);
	if (m_hInetConnection == NULL)
	{
		CloseHandles();
		return ERR_NETWORKERROR;
	}


	LPCTSTR ppszAcceptTypes[2];
	ppszAcceptTypes[0] = _T("*/*"); 
	ppszAcceptTypes[1] = NULL;

	m_hInetFile = HttpOpenRequest(m_hInetConnection, _T("POST"), url.GetPath(), NULL, NULL, ppszAcceptTypes, INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_KEEP_CONNECTION, (DWORD)this);
	if (m_hInetFile == NULL)
	{
		CloseHandles();
		return ERR_NETWORKERROR;
	}


	HttpAddRequestHeaders(m_hInetFile, _T("Content-Type: application/x-www-form-urlencoded\r\n"), -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE); 
	HttpAddRequestHeaders(m_hInetFile, _T("User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)\r\n"), -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE); 

	TCHAR szHeaders[1024];
	_stprintf_s(szHeaders, _countof(szHeaders), _T("MoneyhubUID: %s\r\n"), m_strHWID.c_str());
	HttpAddRequestHeaders(m_hInetFile, szHeaders, -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE); 

	BOOL bSend = ::HttpSendRequest(m_hInetFile, NULL, 0, m_lpPostData, m_dwPostDataLength);
	if (!bSend)
	{
		CloseHandles();
		return ERR_NETWORKERROR;
	}

	CloseHandles();

	return ERR_SUCCESS;
}
Example #4
0
void MyLib::AddMediaPath(std::tstring &path)
{
	mediaPaths.push_back(path);

	if (m_pFileMonitor == NULL)
	{
		m_pFileMonitor = new fileMonitors(pPlayListAuto);
	}

	m_pFileMonitor->AddDirectory(path.c_str());
}
Example #5
0
void NotesHelper::CreateNotesMessage(const std::tstring& recipients, const std::tstring& subject, StringVector& body, LNMailMessage &message)
{
	LNSTATUS status = Session::Instance()->GetNotesSession().CreateMailMessage(&message);
	if(NOERROR != status)
	{
		std::vector<char> errorbuffer(LNERROR_MESSAGE_LENGTH);
		LNINT charCount = LNGetErrorMessage(status, &errorbuffer[0]);
		throw CppUnitException(std::tstring(errorbuffer.begin(), errorbuffer.begin() + charCount), __LINE__, _T(__FILE__));	
	}

	message.SendTo(Workshare::Conversions::W22LNString(recipients.c_str()));
	message.SetSubject(Workshare::Conversions::W22LNString(subject.c_str()));
		
	LNRichText rtBody;
	message.GetBody(&rtBody);

	for(StringVector::iterator bodyIter = body.begin(); bodyIter != body.end(); ++bodyIter)
	{
		rtBody.Append(Workshare::Conversions::W22LNString(bodyIter->c_str()));
	}
}
Example #6
0
std::tstring Config::Load(const std::string& name, const std::tstring& entry)
{
	HKEY hkey;
	if (RegOpenKeyExA(RootKey(), name.c_str(), 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS)
		throw truntime_error(_T("reading configuration"));
	AutoDeleteKey key(hkey);
	TCHAR buf[512];
	DWORD type, len = sizeof(buf);
	if (RegQueryValueEx(key, entry.c_str(), NULL, &type, (BYTE*) buf, &len) != ERROR_SUCCESS || type != REG_SZ)
		throw truntime_error(_T("reading configuration"));
	return buf;
}
Example #7
0
void Workshare::Mail::Mapi::RemoveMessageTag(LPMESSAGE lpMessage, const std::tstring& sTag)
{
	IMAPIPropPtr spMapiProp = lpMessage;
	if(spMapiProp == 0)
		throw Workshare::Exception(_T("Failed to extract the IID_IMAPIProp interface from lpMessage"));

	LPMAPINAMEID pTagName = 0;
	HRESULT hr = MAPIAllocateBuffer(sizeof(MAPINAMEID), (LPVOID*)&pTagName);
	if(FAILED(hr))
		throw MapiException(hr, _T("Failed to allocate MAPI memory for the tag name"));

	pTagName[0].lpguid = (LPGUID)&PS_PUBLIC_STRINGS;
	pTagName[0].ulKind = MNID_STRING;
	_bstr_t bsTag(sTag.c_str());
	pTagName[0].Kind.lpwstrName = bsTag;

	LPSPropTagArray pPropTag = 0;
	hr = spMapiProp->GetIDsFromNames(1, &pTagName, 0, &pPropTag);
	if(FAILED(hr))
	{
		MAPIFreeBuffer(pTagName);
		std::tostringstream error;
		error << _T("Failed to determine the ID from the tag name \"") << sTag.c_str() << _T("\"") << std::ends;
		throw MapiException(hr, error.str().c_str());
	}

	if(1 == pPropTag->cValues && PT_ERROR != PROP_TYPE(pPropTag->aulPropTag[0]))
	{
		spMapiProp->DeleteProps(pPropTag, 0);
	}
	else
	{
		std::tostringstream error;
		error << _T("Failed to delete the message tag \"") << sTag.c_str() << _T("\"") << std::ends;
		LOG_WS_INFO(error.str().c_str());
	}

	MAPIFreeBuffer(pPropTag);
	MAPIFreeBuffer(pTagName);
}
Example #8
0
void ExtractEmail(IDispatchPtr spDispOutlook, IDispatchPtr spDispNameSpace, const std::tstring& subject, const std::tstring& folder)
{
    if(subject.empty())
        throw Workshare::ArgumentException(_T("subject"), _T("Blank subject specified for the search"));

    if(folder.empty())
        throw Workshare::ArgumentException(_T("folder"), _T("Invalid destination folder specified for saving of attachments"));

    if(-1 == _taccess(folder.c_str(), 0))
        throw Workshare::ArgumentException(_T("folder"), _T("Destination folder does not exist"));

    Outlook::_MailItemPtr spEmailItem = FindEmail(spDispOutlook, spDispNameSpace, subject);

    Outlook::AttachmentsPtr spAttachments = spEmailItem->Attachments;
    if(spAttachments == 0)
        throw Workshare::NullReferenceException(_T("Failed to get the attachments collection for the mail item"));

    long attachmentCount = spAttachments->Count;
    if(0 == attachmentCount)
        return;

    for(long index = 1; index <= attachmentCount; index++)
    {
        Outlook::AttachmentPtr spAttachment = spAttachments->Item(index);

        //we don't handle embedded documents
        Outlook::OlAttachmentType attachmentType = spAttachment->Type;
        if(Outlook::olOLE == attachmentType || Outlook::olEmbeddeditem == attachmentType)
            continue;

        std::tstring filename(folder);
        filename.append(_T("\\")).append((LPTSTR)spAttachment->FileName);

        std::tstring baseFilename = GetFilenameWithoutExtension(filename);
        std::tstring fileExtension = GetFileExtension(filename);
        int duplicate = 1;
        while(-1 != _taccess(filename.c_str(), 0))
        {
            duplicate++;
            std::tostringstream dupFilename;
            dupFilename << baseFilename << _T("(") << duplicate << _T(").") << fileExtension << std::ends;
            filename = dupFilename.str().c_str();
        }
        HRESULT hr = spAttachment->SaveAsFile(filename.c_str());
        if(FAILED(hr))
        {
            std::tostringstream errMsg;
            errMsg << _T("Failed to save attachment ") << (LPCTSTR)spAttachment->FileName << _T(" to ") << filename << std::ends;
            throw Workshare::Com::ComException(errMsg.str().c_str(), hr, spAttachment);
        }
    }
}
Example #9
0
bool facebook_client::save_url(const std::string &url,const std::tstring &filename, HANDLE &nlc)
{
	NETLIBHTTPREQUEST req = {sizeof(req)};
	NETLIBHTTPREQUEST *resp;
	req.requestType = REQUEST_GET;
	req.szUrl = const_cast<char*>(url.c_str());
	req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_PERSISTENT | NLHRF_NODUMP;
	req.nlc = nlc;

	resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
		reinterpret_cast<WPARAM>(this->parent->m_hNetlibUser), reinterpret_cast<LPARAM>(&req)));

	bool ret = false;

	if (resp) {
		nlc = resp->nlc;
		parent->debugLogA("@@@@@ Saving avatar URL %s to path %s", url.c_str(), _T2A(filename.c_str()));

		// Create folder if necessary
		std::tstring dir = filename.substr(0,filename.rfind('\\'));
		if (_taccess(dir.c_str(), 0))
			CreateDirectoryTreeT(dir.c_str());

		// Write to file
		FILE *f = _tfopen(filename.c_str(), _T("wb"));
		if (f != NULL) {
			fwrite(resp->pData,1,resp->dataLength,f);
			fclose(f);

			ret = _taccess(filename.c_str(), 0) == 0;
		}

		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
	} else {
		nlc = NULL;
	}

	return ret;
}
Example #10
0
HANDLE FacebookProto::ChatIDToHContact(std::tstring chat_id)
{
    for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
        if (!IsMyContact(hContact, true))
            continue;

        ptrT id(getTStringA(hContact, "ChatRoomID"));
        if (id && !_tcscmp(id, chat_id.c_str()))
            return hContact;
    }

    return 0;
}
Example #11
0
void CGroupMemberView::OnNewGroupMemberList(const std::tstring& strRoomID, std::vector<tstring>& vecMemList)
{
	//刷新界面成员
	if (_tcsicmp(strRoomID.c_str(), m_strRoomID.c_str()) == 0)
	{
		//clear first.
		m_pGroupMemberList->RemoveAll();

		//add new.
		for (int i=0; i<vecMemList.size(); i++)
		{
			sFriendListItem oneFriend;
			//if (mainDlg::getInstance()->GetFriendItem(vecMemList[i], oneFriend))
			//{
			//	vector<tstring> vecProperty;
			//	//有可能是 我的好友 没有机构ID,调用GetDuty就会失败!
			//	//if(GetDuty(oneFriend.strOrgID, oneFriend.strAccount, vecProperty))
			//	//{
			//		m_pGroupMemberList->AddOneItem(oneFriend, vecProperty);	
			//	//}
			//}

			//先从好友里面去找。
			if (mainDlg::getInstance()->GetFriendItem(vecMemList[i], oneFriend))
			{

			}
			else
			{
				//从陌生人里面去找。
				sUserVCard oneVCard;
				CController::Instance()->GetUserInfoMgr()->GetUserVCard(vecMemList[i], oneVCard);
				oneFriend.strAccount = oneVCard.strAccount;
				oneFriend.strAvatar = oneVCard.strPhotoPath.empty()? DEF_AVATAR_NOR : oneVCard.strPhotoPath;
				oneFriend.strOrgID = oneVCard.strOrganization;
				oneFriend.strOrgnization = oneVCard.strOrganization;
				oneFriend.strShowName = oneVCard.strUserNickname;
			}

			//获取duty,有可能获得的是空的。
			vector<tstring> vecProperty;
 			if(GetDuty(oneFriend.strOrgID, oneFriend.strAccount, vecProperty))
 			{
 
 			}

			m_pGroupMemberList->AddOneItem(oneFriend, vecProperty);

		}
	}
}
Example #12
0
HANDLE NotesHelper::CreateNotesMessage(const std::tstring& recipients, const std::tstring& subject, const std::tstring& body, const std::tstring& from)
{
	InitialiseSession();
	NOTEHANDLE hMemo = 0;
	if(NOERROR != NSFNoteCreate(m_hMailBox, &hMemo))
		throw CppUnitException(_T("Failed to create a note"), __LINE__, _T(__FILE__));	
	
	try
	{
		SetMemoText(hMemo, FIELD_FORM, MAIL_MEMO_FORM);
		SetMemoText(hMemo, MAIL_ENTERSENDTO_ITEM, Workshare::Conversions::T22A(recipients.c_str()));
		SetMemoText(hMemo, MAIL_FROM_ITEM, Workshare::Conversions::T22A(from.c_str()));	
		SetMemoText(hMemo, MAIL_SUBJECT_ITEM, Workshare::Conversions::T22A(subject.c_str()));	
		SetMemoText(hMemo, MAIL_BODY_ITEM, Workshare::Conversions::T22A(body.c_str()));	
		SetMemoText(hMemo, MAIL_DELIVERYPRIORITY_ITEM, "Normal");	
		SetMemoText(hMemo, MAIL_DELIVERYREPORT_ITEM, "Basic");	
		SetMemoText(hMemo, MAIL_RETURNRECEIPT_ITEM, "No");	
		

		TIMEDATE tdCurrent;
		OSCurrentTIMEDATE(&tdCurrent);

		SetMemoDate(hMemo, MAIL_COMPOSEDDATE_ITEM, tdCurrent);
		SetMemoDate(hMemo, MAIL_POSTEDDATE_ITEM, tdCurrent);

		STATUS status = NSFNoteUpdate(hMemo, UPDATE_FORCE);
		if(NOERROR != status)
			throw CppUnitException(_T("Failed to update the note"), __LINE__, _T(__FILE__));	

		return hMemo; 
	}
	catch(...)
	{
		NSFNoteClose(hMemo);
		return 0;
	}
}
Example #13
0
// Get process id from window name
DWORD Injector::GetProcessIdByWindow(const std::tstring& Name)
{
	// Find window
	HWND MyWnd = FindWindow(NULL,Name.c_str());
	if (!MyWnd)
		throw std::runtime_error("Could not find window.");

	// Get process ID from window
	DWORD ProcID;
	GetWindowThreadProcessId(MyWnd,&ProcID);
	if (!ProcID)
		throw std::runtime_error("Could not get process id from window.");

	// Return process id
	return ProcID;
}
Example #14
0
IDispatchPtr OpenEmail(IDispatchPtr spDispOutlook, IDispatchPtr spDispNameSpace, const std::tstring& entryId)
{
   if(spDispOutlook == 0)
      throw Workshare::ArgumentNullException(_T("spDispOutlook"), _T("Outlook Application pointer is null."));

   if(spDispNameSpace == 0)
      throw Workshare::ArgumentNullException(_T("spDispNameSpace"), _T("MAPI NameSpace pointer is null."));

   Outlook::_ApplicationPtr spOutlook = spDispOutlook;
   Outlook::_NameSpacePtr spNameSpace = spDispNameSpace;
   IDispatchPtr spMailItem;
   HRESULT hr = spNameSpace->raw_GetItemFromID(_bstr_t(entryId.c_str()), vtMissing, &spMailItem);
   if(FAILED(hr))
      throw Workshare::Com::ComException(_T("Outlook failed to open the email message"), hr, spNameSpace);

   return spMailItem;
}
Example #15
0
FILETIME GetLastModifiedTime(const std::tstring& fileName)
{
   FILETIME OriginalCreationTime;
	FILETIME OriginalLastAccessTime;
	FILETIME OriginalWriteTime;

   ::ZeroMemory(&OriginalCreationTime, sizeof(OriginalCreationTime));
   ::ZeroMemory(&OriginalLastAccessTime, sizeof(OriginalLastAccessTime));
   ::ZeroMemory(&OriginalWriteTime, sizeof(OriginalWriteTime));

   HANDLE hFile = ::CreateFile(fileName.c_str(), GENERIC_READ,	FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
	if(0 != hFile)
	{
	   ::GetFileTime(hFile, &OriginalCreationTime, &OriginalLastAccessTime, &OriginalWriteTime);
	   ::CloseHandle(hFile);
	}

   return OriginalWriteTime;
}
Example #16
0
template<> unique_ptr<ID3D10Effect> ResourceService::LoadResource<ID3D10Effect>(const std::tstring& filePath)
{
	ID3D10Blob* pErrorBlob;
	ID3D10Effect* pEffect;
	
	HRESULT hr = D3DX10CreateEffectFromFile(filePath.c_str(),
				 NULL,
				 NULL,
				 "fx_4_0",
#ifndef NDEBUG
				 D3D10_SHADER_DEBUG|D3D10_SHADER_SKIP_OPTIMIZATION|D3D10_SHADER_WARNINGS_ARE_ERRORS|D3D10_SHADER_PACK_MATRIX_ROW_MAJOR, //HLSL Flags: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172416%28v=vs.85%29.aspx
#else
				 D3D10_SHADER_OPTIMIZATION_LEVEL3|D3D10_SHADER_IEEE_STRICTNESS|D3D10_SHADER_PACK_MATRIX_ROW_MAJOR,
#endif
				 0,
				 MyServiceLocator::GetInstance()->GetService<IGraphicsService>()->GetGraphicsDevice()->GetDevice(),
				 NULL,
				 NULL,
				 &pEffect,
				 &pErrorBlob,
				 NULL);

	if(FAILED(hr))
	{
		tstringstream ss;
		
		if(pErrorBlob!=nullptr)
		{
			char *errors = (char*)pErrorBlob->GetBufferPointer();
 
			for(unsigned int i = 0; i < pErrorBlob->GetBufferSize(); i++)
				ss<<errors[i];
 
			OutputDebugString(ss.str().c_str());
			pErrorBlob->Release();
			
			throw LoaderException(_T("effect ") + filePath, ss.str() );
		}
		MyServiceLocator::GetInstance()->GetService<DebugService>()->LogDirectXError(hr, __LINE__, __FILE__);
	}

	return unique_ptr<ID3D10Effect>(pEffect);
}
Example #17
0
void MyLib::ImportLycByPath(std::tstring path)
{
	LPCTSTR pszFolder=path.c_str();

	TCHAR* curPath=new TCHAR[MAX_PATH];
	_tgetcwd(curPath,MAX_PATH);

	//改变当前目录
	_tchdir(pszFolder);

	BOOL findResult=FALSE;
	WIN32_FIND_DATA findFileData;
	HANDLE hFind;

	hFind=::FindFirstFile(_T("*.lrc"),&findFileData);
	if(hFind!=INVALID_HANDLE_VALUE){
		findResult=TRUE;
		while(findResult)
		{
			TCHAR *_findName=new TCHAR[MAX_PATH];
			_tcscpy(_findName,findFileData.cFileName);
			TCHAR *pathName=new TCHAR[MAX_PATH+1];
			_tcscpy(pathName,pszFolder);
			_tcscat(pathName,_T("\\"));
			_tcscat(pathName,_findName);
			//std::tstring str(pathName);
			
			std::tstring str(pathName);
			MyLib::shared()->dataPaths.push_back(str);

			findResult=FindNextFile(hFind,&findFileData);
		}
		FindClose(hFind);
	}

	//回复当前目录
	_tchdir(curPath);
}
Example #18
0
Console::Console(const std::tstring& title) : Console()
{
	// After the default constructor, just set the console title
	SetConsoleTitle(title.c_str());
}
Example #19
0
void MyLib::DelMediaPath(std::tstring &path)
{
	m_pFileMonitor->DelDirectory(path.c_str());
	mediaPaths.erase( find(mediaPaths.begin(),mediaPaths.end(),path) );	
}
Example #20
0
void CDocument::ThrowNotSupported(const std::tstring fileName)
{
	std::tstring msg = fileName;
	msg.append(_T(" is not a valid document"));
	throw Workshare::Com::ComException(fileName.c_str(), E_UNSUPPORTED_FILEFORMAT);
}
Example #21
0
bool ZipWrapper::AddFileToZip(const std::tstring& sFilename)
{
	return m_zipArchive.AddNewFile(sFilename.c_str());
}
Example #22
0
bool CToxProto::SetToxAvatar(std::tstring path, bool checkHash)
{
	int length;
	uint8_t *data;
	FILE *hFile = _tfopen(path.c_str(), L"rb");
	if (!hFile)
	{
		debugLogA("CToxProto::SetMyAvatar: failed to open avatar file");
		return false;
	}

	fseek(hFile, 0, SEEK_END);
	length = ftell(hFile);
	rewind(hFile);
	if (length > TOX_AVATAR_MAX_DATA_LENGTH)
	{
		fclose(hFile);
		debugLogA("CToxProto::SetMyAvatar: new avatar size is excessive");
		return false;
	}

	data = (uint8_t*)mir_alloc(length);
	size_t readed = fread(data, sizeof(uint8_t), length, hFile);
	if (readed != length)
	{
		fclose(hFile);
		debugLogA("CToxProto::SetMyAvatar: failed to read avatar file");
		return false;
	}
	fclose(hFile);

	DBVARIANT dbv;
	uint8_t hash[TOX_HASH_LENGTH];
	tox_hash(hash, data, TOX_HASH_LENGTH);
	if (checkHash && !db_get(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, &dbv))
	{
		if (memcmp(hash, dbv.pbVal, TOX_HASH_LENGTH) == 0)
		{
			db_free(&dbv);
			mir_free(data);
			debugLogA("CToxProto::SetMyAvatar: new avatar is same with old");
			return false;
		}
		db_free(&dbv);
	}

	if (tox_set_avatar(tox, TOX_AVATAR_FORMAT_PNG, data, length) == TOX_ERROR)
	{
		mir_free(data);
		debugLogA("CToxProto::SetMyAvatar: failed to set new avatar");
		return false;
	}
	mir_free(data);

	if (checkHash)
	{
		db_set_blob(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, (void*)hash, TOX_HASH_LENGTH);
	}

	return true;
}
BOOL GoogleLyricsProvider::ExtractLyrics(std::tstring& page)
{
	UINT maxCharSeqLen = 0;
	LPCTSTR maxFirstSeqChar = 0;
	LPCTSTR maxLastSeqChar = 0;
	UINT curCharSeqLen = 0;
	LPCTSTR curFirstSeqChar = 0;

	LPCTSTR curChar = page.c_str();
	BOOL bInTag = FALSE;
	BOOL bBRHasBeenFound = FALSE;

	std::tstring ansi;
	for (int pass = 0; pass < 2; pass++)
	{
		if (pass == 1)
		{
			//SecondPass
			if (maxCharSeqLen <= m_MinAllowedLyricsLen)
				return FALSE;
			curChar = maxFirstSeqChar;
			bInTag = FALSE;
		}
		while (*curChar != 0)
		{
			if (maxLastSeqChar <= curChar && pass == 1)
			{
				page = ansi;
				return TRUE;
			}

			switch (*curChar)
			{
			case '<':
				//ASSERT(bInTag == FALSE);
				bInTag = TRUE;
				if (_tcsnicmp(curChar, _T("<br"), 3) == 0 && curCharSeqLen > 0)
				{
					bBRHasBeenFound = TRUE;
					curCharSeqLen+=2;
					if (pass == 1)
						ansi += _T("\r\n");
					//strcat(ansi, "\r\n");
				}
				else
				{
					//Finished...
					if (curCharSeqLen > maxCharSeqLen)
					{
						maxCharSeqLen = curCharSeqLen;
						maxFirstSeqChar = curFirstSeqChar;
						maxLastSeqChar = curChar;
					}
					curCharSeqLen = 0;
					bBRHasBeenFound = FALSE;
				}
				break;
			case '>':
				//ASSERT(bInTag == TRUE);
				bInTag = FALSE;
				break;
			case 10:
				if (!bBRHasBeenFound && curCharSeqLen > 0)//This is a lonesome LF. He can t be here if it was CRLF (look 13)
				{
					curCharSeqLen+=2;
					if (pass==1)
						ansi += _T("\r\n");
					//strcat(ansi, "\r\n");
				}
				break;
			case 13:
				if (!bBRHasBeenFound && curCharSeqLen > 0)
				{
					curCharSeqLen+=2;
					if (pass==1)
						ansi += _T("\r\n");
					if(*curChar == 10)//Handle the case that you get CR without LF following
						curChar++;
				}
				break;
			default:
				if (bInTag == FALSE)
				{
					if (curCharSeqLen == 0)
						curFirstSeqChar = curChar;
					if (pass == 1)
						ansi += *curChar;
					curCharSeqLen++;
				}
			}
			curChar++;
		}
	}
	return NULL;
}
Example #24
0
void Console::putTitle(const std::tstring& value) const
{
	SetConsoleTitle(value.c_str());
}
int CPostData::TBigDataPost()
{
	//CString sTraceBuffer;
	CUrlCrack url;
	if (!url.Crack(m_strUrl.c_str()))
		return ERR_URLCRACKERROR;

	m_hInetSession = ::InternetOpen(MONEYHUB_USERAGENT, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
	if (m_hInetSession == NULL)
		return ERR_NETWORKERROR;

	DWORD dwTimeOut = 10000;
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONTROL_SEND_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_SEND_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_RECEIVE_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);
	InternetSetOptionEx(m_hInetSession, INTERNET_OPTION_CONNECT_TIMEOUT, &dwTimeOut, sizeof(DWORD), 0);

	m_hInetConnection = ::InternetConnect(m_hInetSession, url.GetHostName(), url.GetPort(), NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD)this);
	if (m_hInetConnection == NULL)
	{
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, L"HttpSendRequestEx");
		CloseHandles();
		return  ERR_NETWORKERROR;
	}

	LPCTSTR ppszAcceptTypes[2];
	ppszAcceptTypes[0] = _T("*/*"); 
	ppszAcceptTypes[1] = NULL;

	DWORD dwFlags = 0;

	if( url.GetPort() == 443 )
	{
		dwFlags = INTERNET_FLAG_SECURE;
		//dwFlags =	INTERNET_FLAG_NO_CACHE_WRITE |
		//			INTERNET_FLAG_KEEP_CONNECTION |
		//			INTERNET_FLAG_PRAGMA_NOCACHE |
		//			INTERNET_FLAG_SECURE |
		//			INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
		//			INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
		//			SECURITY_FLAG_IGNORE_UNKNOWN_CA |
		//			INTERNET_OPTION_SECURITY_FLAGS;
	}
	else if( url.GetPort() == 80 )
	{
		//for HTTP
		//dwFlags =	INTERNET_FLAG_NO_CACHE_WRITE |
		//			INTERNET_FLAG_KEEP_CONNECTION |
		//			INTERNET_FLAG_PRAGMA_NOCACHE ;
		dwFlags =	INTERNET_FLAG_RELOAD |
					INTERNET_FLAG_KEEP_CONNECTION |
					INTERNET_FLAG_DONT_CACHE ;
	}
	//m_hInetFile = HttpOpenRequest(m_hInetConnection, _T("POST"), url.GetPath(), NULL, NULL, ppszAcceptTypes, dwFlags, (DWORD)this);
	m_hInetFile = HttpOpenRequest(m_hInetConnection, _T("POST"), url.GetPath(), NULL, NULL, ppszAcceptTypes, dwFlags, (DWORD)this);
	if (m_hInetFile == NULL)
	{
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, L"HttpSendRequestEx   m_hInetFile");
		CloseHandles();
		return  ERR_NETWORKERROR;
	}
	//if( url.GetPort() == 443 )
	{
		DWORD dwBuffLen = sizeof(dwFlags);
		InternetQueryOption (m_hInetFile, INTERNET_OPTION_SECURITY_FLAGS,
			(LPVOID)&dwFlags, &dwBuffLen);

		dwFlags |= (SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID);
		InternetSetOption (m_hInetFile, INTERNET_OPTION_SECURITY_FLAGS,
			&dwFlags, sizeof (dwFlags) );
	}

	HttpAddRequestHeaders(m_hInetFile, _T("Content-Type: application/x-www-form-urlencoded\r\n"), -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
	HttpAddRequestHeaders(m_hInetFile, _T("User-Agent: Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)\r\n"), -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE); 
	HttpAddRequestHeaders(m_hInetFile, _T("Accept-Language: zh-CN"), -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE); 

	return ERR_SUCCESS;
}
Example #26
0
DocumentManager::DocumentManager(const std::tstring& fileName, MetawallBackEnd::IMWHostInstanceManagerPtr spInstanceManager) :
	m_spInstanceManager(spInstanceManager)
{
	m_spObject = m_spInstanceManager->OpenDocument(fileName.c_str(), VARIANT_FALSE);
}
static int tstring_Compare(const std::tstring& a, const std::tstring&b)
{
    return strcmp(a.c_str(), b.c_str());
}
static void tstring_ToString(char* string, size_t bufferSize, std::tstring val)
{
    size_t val_size = strlen(val.c_str());
    strncpy(string, val.c_str(), (val_size >= bufferSize) ? (bufferSize - 1) : val_size);
}
Example #29
0
void CToxProto::SetToxAvatar(std::tstring path)
{
	FILE *hFile = _tfopen(path.c_str(), L"rb");
	if (!hFile)
	{
		debugLogA(__FUNCTION__": failed to open avatar file");
		return;
	}

	fseek(hFile, 0, SEEK_END);
	size_t length = ftell(hFile);
	rewind(hFile);
	if (length > TOX_MAX_AVATAR_SIZE)
	{
		fclose(hFile);
		debugLogA(__FUNCTION__": new avatar size is excessive");
		return;
	}

	uint8_t *data = (uint8_t*)mir_alloc(length);
	if (fread(data, sizeof(uint8_t), length, hFile) != length)
	{
		fclose(hFile);
		debugLogA(__FUNCTION__": failed to read avatar file");
		mir_free(data);
		return;
	}
	fclose(hFile);

	DBVARIANT dbv;
	uint8_t hash[TOX_HASH_LENGTH];
	tox_hash(hash, data, TOX_HASH_LENGTH);
	if (!db_get(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, &dbv))
	{
		if (memcmp(hash, dbv.pbVal, TOX_HASH_LENGTH) == 0)
		{
			db_free(&dbv);
			mir_free(data);
			debugLogA(__FUNCTION__": new avatar is same with old");
			return;
		}
		db_free(&dbv);
	}

	db_set_blob(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, (void*)hash, TOX_HASH_LENGTH);

	if (IsOnline())
	{
		for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
		{
			if (GetContactStatus(hContact) == ID_STATUS_OFFLINE)
				continue;

			int32_t friendNumber = GetToxFriendNumber(hContact);
			if (friendNumber == UINT32_MAX)
			{
				mir_free(data);
				debugLogA(__FUNCTION__": failed to set new avatar");
				return;
			}

			TOX_ERR_FILE_SEND error;
			uint32_t fileNumber = tox_file_send(tox, friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
			if (error != TOX_ERR_FILE_SEND_OK)
			{
				mir_free(data);
				debugLogA(__FUNCTION__": failed to set new avatar");
				return;
			}

			AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
			transfer->pfts.flags |= PFTS_SENDING;
			memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
			transfer->pfts.hContact = hContact;
			transfer->hFile = _tfopen(path.c_str(), L"rb");
			transfers.Add(transfer);
		}
	}

	mir_free(data);
}
/*! Pluginページのメッセージ処理
	@param hwndDlg ダイアログボックスのWindow Handlw
	@param uMsg メッセージ
	@param wParam パラメータ1
	@param lParam パラメータ2
*/
INT_PTR CPropPlugin::DispatchEvent( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    NMHDR*		pNMHDR;
    int			idCtrl;

    WORD		wNotifyCode;
    WORD		wID;

    switch( uMsg ) {

    case WM_INITDIALOG:
        /* ダイアログデータの設定 Plugin */
        InitDialog( hwndDlg );
        SetData( hwndDlg );
        // Modified by KEITA for WIN64 2003.9.6
        ::SetWindowLongPtr( hwndDlg, DWLP_USER, lParam );

        return TRUE;
    case WM_NOTIFY:
        idCtrl = (int)wParam;
        pNMHDR = (NMHDR*)lParam;
        switch( idCtrl ) {
        case IDC_PLUGINLIST:
            switch( pNMHDR->code ) {
            case LVN_ITEMCHANGED:
            {
                HWND hListView = ::GetDlgItem( hwndDlg, IDC_PLUGINLIST );
                int sel = ListView_GetNextItem( hListView, -1, LVNI_SELECTED );
                if( sel >= 0 ) {
                    CPlugin* plugin = CPluginManager::getInstance()->GetPlugin(sel);
                    if( plugin != NULL ) {
                        ::SetWindowText( ::GetDlgItem( hwndDlg, IDC_LABEL_PLUGIN_Description ), to_tchar(plugin->m_sDescription.c_str()) );
                        ::SetWindowText( ::GetDlgItem( hwndDlg, IDC_LABEL_PLUGIN_Author ), to_tchar(plugin->m_sAuthor.c_str()) );
                        ::SetWindowText( ::GetDlgItem( hwndDlg, IDC_LABEL_PLUGIN_Version ), to_tchar(plugin->m_sVersion.c_str()) );
                    } else {
                        ::SetWindowText( ::GetDlgItem( hwndDlg, IDC_LABEL_PLUGIN_Description ), _T("") );
                        ::SetWindowText( ::GetDlgItem( hwndDlg, IDC_LABEL_PLUGIN_Author ), _T("") );
                        ::SetWindowText( ::GetDlgItem( hwndDlg, IDC_LABEL_PLUGIN_Version ), _T("") );
                    }
                    // 2010.08.21 明らかに使えないときはDisableにする
                    EPluginState state = m_Common.m_sPlugin.m_PluginTable[sel].m_state;
                    BOOL bEdit = (state != PLS_DELETED && state != PLS_NONE);
                    ::EnableWindow( ::GetDlgItem( hwndDlg, IDC_PLUGIN_Remove ), bEdit );
                    ::EnableWindow( ::GetDlgItem( hwndDlg, IDC_PLUGIN_OPTION ), state == PLS_LOADED && plugin && plugin->m_options.size() > 0 );
                    ::EnableWindow( ::GetDlgItem( hwndDlg, IDC_PLUGIN_README ),
                                    (state == PLS_INSTALLED || state == PLS_UPDATED || state == PLS_LOADED || state == PLS_DELETED)
                                    && !GetReadMeFile(to_tchar(m_Common.m_sPlugin.m_PluginTable[sel].m_szName)).empty());
                    ::EnableWindow(::GetDlgItem(hwndDlg, IDC_PLUGIN_URL), state == PLS_LOADED && plugin && plugin->m_sUrl.size() > 0);
                }
            }
            break;
            case NM_DBLCLK:
                // リストビューへのダブルクリックで「プラグイン設定」を呼び出す
                if (::IsWindowEnabled(::GetDlgItem( hwndDlg, IDC_PLUGIN_OPTION )))
                {
                    DispatchEvent( hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_PLUGIN_OPTION, BN_CLICKED), (LPARAM)::GetDlgItem( hwndDlg, IDC_PLUGIN_OPTION ) );
                }
                break;
            }
            break;
        default:
            switch( pNMHDR->code ) {
            case PSN_HELP:
                OnHelp( hwndDlg, IDD_PROP_PLUGIN );
                return TRUE;
            case PSN_KILLACTIVE:
                /* ダイアログデータの取得 Plugin */
                GetData( hwndDlg );
                return TRUE;
            case PSN_SETACTIVE:
                m_nPageNum = ID_PROPCOM_PAGENUM_PLUGIN;
                return TRUE;
            }
            break;
        }
        break;

    case WM_COMMAND:
        wNotifyCode = HIWORD(wParam);	/* 通知コード */
        wID = LOWORD(wParam);			/* 項目ID、 コントロールID、 またはアクセラレータID */

        switch( wNotifyCode ) {
        /* ボタン/チェックボックスがクリックされた */
        case BN_CLICKED:
            switch( wID ) {
            case IDC_PLUGIN_SearchNew:		// 新規プラグインを追加
                GetData( hwndDlg );
                CPluginManager::getInstance()->SearchNewPlugin( m_Common, hwndDlg );
                if( m_bTrayProc ) {
                    LoadPluginTemp(m_Common, *m_pcMenuDrawer);
                }
                SetData_LIST( hwndDlg );	//リストの再構築
                break;
            case IDC_PLUGIN_INST_ZIP:		// ZIPプラグインを追加
            {
                static std::tstring	sTrgDir;
                CDlgOpenFile	cDlgOpenFile;
                TCHAR			szPath[_MAX_PATH + 1];
                _tcscpy( szPath, (sTrgDir.empty() ? CPluginManager::getInstance()->GetBaseDir().c_str() : sTrgDir.c_str()));
                // ファイルオープンダイアログの初期化
                cDlgOpenFile.Create(
                    G_AppInstance(),
                    hwndDlg,
                    _T("*.zip"),
                    szPath
                );
                if( cDlgOpenFile.DoModal_GetOpenFileName( szPath ) ) {
                    GetData( hwndDlg );
                    CPluginManager::getInstance()->InstZipPlugin( m_Common, hwndDlg, szPath );
                    if( m_bTrayProc ) {
                        LoadPluginTemp(m_Common, *m_pcMenuDrawer);
                    }
                    SetData_LIST( hwndDlg );	//リストの再構築
                }
                // フォルダを記憶
                TCHAR	szFolder[_MAX_PATH + 1];
                TCHAR	szFname[_MAX_PATH + 1];
                SplitPath_FolderAndFile(szPath, szFolder, szFname);
                sTrgDir = szFolder;
            }
            break;
            case IDC_CHECK_PluginEnable:	// プラグインを有効にする
                EnablePluginPropInput( hwndDlg );
                break;
            case IDC_PLUGIN_Remove:			// プラグインを削除
            {
                HWND hListView = ::GetDlgItem( hwndDlg, IDC_PLUGINLIST );
                int sel = ListView_GetNextItem( hListView, -1, LVNI_SELECTED );
                if( sel >= 0 ) {

                    if( MYMESSAGEBOX( hwndDlg, MB_YESNO, GSTR_APPNAME, LS(STR_PROPCOMPLG_DELETE), m_Common.m_sPlugin.m_PluginTable[sel].m_szName ) == IDYES ) {
                        CPluginManager::getInstance()->UninstallPlugin( m_Common, sel );
                        SetData_LIST( hwndDlg );
                    }
                }
            }
            break;
            case IDC_PLUGIN_OPTION:		// プラグイン設定	// 2010/3/22 Uchi
            {
                HWND hListView = ::GetDlgItem( hwndDlg, IDC_PLUGINLIST );
                int sel = ListView_GetNextItem( hListView, -1, LVNI_SELECTED );
                if( sel >= 0 && m_Common.m_sPlugin.m_PluginTable[sel].m_state == PLS_LOADED ) {
                    // 2010.08.21 プラグイン名(フォルダ名)の同一性の確認
                    CPlugin* plugin = CPluginManager::getInstance()->GetPlugin(sel);
                    wstring sDirName = to_wchar(plugin->GetFolderName().c_str());
                    if( plugin && 0 == auto_stricmp(sDirName.c_str(), m_Common.m_sPlugin.m_PluginTable[sel].m_szName ) ) {
                        CDlgPluginOption cDlgPluginOption;
                        cDlgPluginOption.DoModal( ::GetModuleHandle(NULL), hwndDlg, this, sel );
                    } else {
                        WarningMessage( hwndDlg, LS(STR_PROPCOMPLG_ERR1) );
                    }
                }
            }
            break;
            case IDC_PLUGIN_OpenFolder:			// フォルダを開く
            {
                std::tstring sBaseDir = CPluginManager::getInstance()->GetBaseDir() + _T(".");
                if( ! IsDirectory(sBaseDir.c_str()) ) {
                    if( ::CreateDirectory(sBaseDir.c_str(), NULL) == 0 ) {
                        break;
                    }
                }
                ::ShellExecute( NULL, _T("open"), sBaseDir.c_str(), NULL, NULL, SW_SHOW );
            }
            break;
            case IDC_PLUGIN_README:		// ReadMe表示	// 2011/11/2 Uchi
            {
                HWND hListView = ::GetDlgItem( hwndDlg, IDC_PLUGINLIST );
                int sel = ListView_GetNextItem( hListView, -1, LVNI_SELECTED );
                std::tstring sName = to_tchar(m_Common.m_sPlugin.m_PluginTable[sel].m_szName);	// 個別フォルダ名
                std::tstring sReadMeName = GetReadMeFile(sName);
                if (!sReadMeName.empty()) {
                    if (!BrowseReadMe(sReadMeName)) {
                        WarningMessage( hwndDlg, LS(STR_PROPCOMPLG_ERR2) );
                    }
                } else {
                    WarningMessage( hwndDlg, LS(STR_PROPCOMPLG_ERR3) );
                }
            }
            break;
            case IDC_PLUGIN_URL:
            {
                HWND hListView = ::GetDlgItem(hwndDlg, IDC_PLUGINLIST);
                int sel = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
                if (sel >= 0) {
                    CPlugin* plugin = CPluginManager::getInstance()->GetPlugin(sel);
                    if (plugin != NULL) {
                        ::ShellExecute(NULL, _T("Open"), to_tchar(plugin->m_sUrl.c_str()), NULL, NULL, SW_SHOW);
                    }
                }
            }
            break;
            }
            break;
        case CBN_DROPDOWN:
            //switch( wID ){
            //default:
            //	break;
            //}
            break;	/* CBN_DROPDOWN */
        case EN_KILLFOCUS:
            //switch( wID ){
            //default:
            //	break;
            //}
            break;
        }

        break;	/* WM_COMMAND */
//@@@ 2001.02.04 Start by MIK: Popup Help
    case WM_HELP:
    {
        HELPINFO *p = (HELPINFO *)lParam;
        MyWinHelp( (HWND)p->hItemHandle, HELP_WM_HELP, (ULONG_PTR)(LPVOID)p_helpids );	// 2006.10.10 ryoji MyWinHelpに変更に変更
    }
    return TRUE;
    /*NOTREACHED*/
    //break;
//@@@ 2001.02.04 End

//@@@ 2001.12.22 Start by MIK: Context Menu Help
    //Context Menu
    case WM_CONTEXTMENU:
        MyWinHelp( hwndDlg, HELP_CONTEXTMENU, (ULONG_PTR)(LPVOID)p_helpids );	// 2006.10.10 ryoji MyWinHelpに変更に変更
        return TRUE;
//@@@ 2001.12.22 End

    }
    return FALSE;
}