//=================================================================================================
	void Assignment()
	{
		axStringA strA("test");
		axStringW strW(L"test");

		axStringA strCopyA = strA;
		axStringW strCopyW = strW;

		axUTest(strCopyA == strA);
		axUTest(strCopyW == strW);

		axUTest(strCopyA.Sz() != strA.Sz());
		axUTest(strCopyW.Sz() != strW.Sz());

		strA = "assignment";
		strW = L"assignment";

		strCopyA = strA;
		strCopyW = strW;

		axUTest(strCopyA == strA);
		axUTest(strCopyW == strW);

		axUTest(strCopyA.Sz() != strA.Sz());
		axUTest(strCopyW.Sz() != strW.Sz());
	}
Beispiel #2
0
void CWebSocket::SendContent(LPCSTR szStdResponse, const CString& rstr)
{
#ifdef _UNICODE
    CStringA strA(wc2utf8(rstr));
    SendContent(szStdResponse, strA, strA.GetLength());
#else
    SendContent(szStdResponse, rstr, rstr.GetLength());
#endif
}
Beispiel #3
0
void VDShowHelp(HWND hwnd, const wchar_t *filename) {
	try {
		VDStringW helpFile(VDGetHelpPath());

		if (!VDDoesPathExist(helpFile.c_str()))
			throw MyError("Cannot find help file: %ls", helpFile.c_str());

		// If we're on Windows NT, check for the ADS and/or network drive.
		if (VDIsWindowsNT()) {
			VDStringW helpFileADS(helpFile);
			helpFileADS += L":Zone.Identifier";
			if (VDDoesPathExist(helpFileADS.c_str())) {
				int rv = MessageBox(hwnd, "VirtualDub has detected that its help file, VirtualDub.chm, has an Internet Explorer download location marker on it. This may prevent the help file from being displayed properly, resulting in \"Action canceled\" errors being displayed. Would you like to remove it?", "VirtualDub warning", MB_YESNO|MB_ICONEXCLAMATION);

				if (rv == IDYES)
					DeleteFileW(helpFileADS.c_str());
			}
		}

		if (filename) {
			helpFile.append(L"::/");
			helpFile.append(filename);
		}

		VDStringW helpCommand(VDStringW(L"\"hh.exe\" \"") + helpFile + L'"');

		PROCESS_INFORMATION pi;
		BOOL retval;

		// CreateProcess will actually modify the string that it gets, soo....
		if (VDIsWindowsNT()) {
			STARTUPINFOW si = {sizeof(STARTUPINFOW)};
			std::vector<wchar_t> tempbufW(helpCommand.size() + 1, 0);
			helpCommand.copy(&tempbufW[0], tempbufW.size());
			retval = CreateProcessW(NULL, &tempbufW[0], NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi);
		} else {
			STARTUPINFOA si = {sizeof(STARTUPINFOA)};
			VDStringA strA(VDTextWToA(helpCommand));
			std::vector<char> tempbufA(strA.size() + 1, 0);
			strA.copy(&tempbufA[0], tempbufA.size());
			retval = CreateProcessA(NULL, &tempbufA[0], NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi);
		}

		if (retval) {
			CloseHandle(pi.hThread);
			CloseHandle(pi.hProcess);
		} else
			throw MyWin32Error("Cannot launch HTML Help: %%s", GetLastError());
	} catch(const MyError& e) {
		e.post(hwnd, g_szError);
	}
}
Beispiel #4
0
/*----------------------------------------------------------------------------------------------
	Process notifications from user.
----------------------------------------------------------------------------------------------*/
bool GeneralPropDlgTab::OnNotifyChild(int ctid, NMHDR * pnmh, long & lnRet)
{
	AssertPtr(pnmh);
	if (m_fInitialized)
	{
		switch (pnmh->code)
		{
		case EN_KILLFOCUS:
			{
				if (pnmh->idFrom == m_ctidName)
				{
					StrAppBufHuge strbh;
					int cch = ::SendDlgItemMessage(m_hwnd, m_ctidName, WM_GETTEXT,
						strbh.kcchMaxStr, (LPARAM)strbh.Chars());
					strbh.SetLength(cch);
					if (cch)
					{
						FixString(strbh);
						::SetWindowText(::GetDlgItem(m_hwnd, m_ctidName), strbh.Chars());
						if (!m_ppropd->CheckName(strbh.Chars()))
						{
							StrApp strA(kstidTlsLstsNameExist);
							StrApp strB(kstidTlsLstsNameExistC);
							::MessageBox(m_hwnd, strA.Chars(), strB.Chars(),
								MB_OK | MB_ICONINFORMATION);
							::SetFocus(::GetDlgItem(m_hwnd, m_ctidName));
							return false;
						}
						m_ppropd->SetName(strbh.Chars());
					}
					else
						// List must have a name.
						::SetWindowText(::GetDlgItem(m_hwnd, m_ctidName),
							m_ppropd->GetName());
				}
				else if (pnmh->idFrom == kctidGeneralPropTabDescription)
				{
					StrAppBufHuge strbh;
					int cch = ::SendDlgItemMessage(m_hwnd, kctidGeneralPropTabDescription,
						WM_GETTEXT, strbh.kcchMaxStr, (LPARAM)strbh.Chars());
					strbh.SetLength(cch);
					FixString(strbh);
					::SetWindowText(::GetDlgItem(m_hwnd, kctidGeneralPropTabDescription),
						strbh.Chars());
					m_ppropd->SetDescription(strbh.Chars());
				}
			}
			break;
		}
	}
	return AfWnd::OnNotifyChild(ctid, pnmh, lnRet);
}
Beispiel #5
0
 inline bool compareTwoHashes(uint8_t hashA[32], uint8_t hashB[32])
 {
     char bufA[65];
     char bufB[65];
     hashToString(hashA, bufA);
     hashToString(hashB, bufB);
     std::string strA(bufA);
     std::string strB(bufB);
     if(strA == strB) {
         return true;
     }
     return false;
 }
	//=================================================================================================
	void Length()
	{
		axStringA strA("test");
		axStringW strW(L"test");

		axUTest(strA.GetLength() == 4);
		axUTest(strW.GetLength() == 4);

		strA = "assignment";
		strW = L"assignment";

		axUTest(strA.GetLength() == 10);
		axUTest(strW.GetLength() == 10);
	}
	//=================================================================================================
	void Getter()
	{
		axStringA strA("test");
		axStringW strW(L"test");

		axUTest(strA[0] == 't');
		axUTest(strW[0] == L't');

		axUTest(strA[1] == 'e');
		axUTest(strW[1] == L'e');

		axUTest(strA[2] == 's');
		axUTest(strW[2] == L's');

		axUTest(strA[3] == 't');
		axUTest(strW[3] == L't');

		axUTest(strA[4] == '\0');
		axUTest(strW[4] == L'\0');
	}
Beispiel #8
0
void CWebSocket::SendContent(LPCSTR szStdResponse, const CString& rstr)
{
	CStringA strA(wc2utf8(rstr));
	SendContent(szStdResponse, strA, strA.GetLength());
}