Пример #1
0
stBlock* CV8File::GetBlockByName(char *BlockName)
{

	wchar_t *unicode_string = NULL, *pCurBlockName;

	ansi_to_unicode(BlockName, &unicode_string, -1);

	UINT i;

	for (i=0; i < FileHeader.blocks_num; i++)
	{
		pCurBlockName = (wchar_t*)(pBlocks[i].pHeader + 12 + 8);
		if (!wcscmp(unicode_string, pCurBlockName))
		{
			if (unicode_string)
				free(unicode_string);

			if (pBlocks[i].NeedUnpack)
			{
				BYTE *DataOut = NULL;
				Unpack(pBlocks + i, DataOut);
				if (DataOut)
					free(DataOut);
			}


			return &pBlocks[i];
		}
	}

	if (unicode_string)
		free(unicode_string);
	return NULL;
}
Пример #2
0
void BTIPerfClient::PrintBuffer(char *buffer,char *speed)
{
//	m_csReport.AddString((const unsigned short *)buffer);
	int nInserted = m_lbResult.AddString(ansi_to_unicode(buffer));
	m_lbResult.SetCurSel(nInserted );

	if (m_fStatistics !=NULL)
	{
		fprintf(m_fStatistics,"%s",buffer);
		fflush(m_fStatistics);
	}
	if (speed!=0)
	{
		CString ss(speed);
		//GetDlgItem(IDC_CLIENT_VALUES)->SetWindowText(ss);
	}
//	GetGlobalLog()->LogEvent(EVENT_DEBUG,buffer);
}
Пример #3
0
UnicodeString ansi_to_unicode(const AnsiString& a_str) {
  UnicodeString u_str;
  ansi_to_unicode(u_str, a_str);
  return u_str;
}
Пример #4
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
#ifdef __EXPIRATION__
	// Program Expiration routines
	CTime expirationTime(2010,	// year
		2,					// month
		30,					// date
		23,					// hour 24
		59,					// minute
		59);				// second
	CTime currentTime = CTime::GetCurrentTime();

    CTimeSpan leftTime = expirationTime - currentTime;   

	// 사용 기간이 남았을 경우
	if(leftTime.GetTotalSeconds() > 0)
    {
		 CString msg;
		 msg = L"";
		 msg += L"This is a trial version of BTools2\n";
		 msg += expirationTime.Format(L"Expiration date :\n %Y-%m-%d  %H:%M:%S\n\n");
		 msg += leftTime.Format(L"%D day(s) and\n %H:%M:%S left" );
     
		 // 사용 기간이 3일 미만 남았을 경우
		 if(leftTime.GetDays() < 7)
		 {
			 msg = leftTime.Format(L"This software will expire after %D day(s)");// %H Hour(s) %M Minute(s)");
			 //AtlMessageBox(NULL, msg.GetBuffer(), L"Expiration Warning");
		 }
		 //AfxMessageBox(msg);
    }
    else // 사용 기간이 만료된 경우
    {
		CString msg("This is a trial version of BTools2\n"
				"If you want to use this software more\n"
				"Please contact to me.\[email protected]\n"
				"Thank you for your interest\n");

		msg += expirationTime.Format(L"Expiration date :\n %Y-%m-%d  %H:%M\n\n");
		msg += leftTime.Format(L"%D day(s) and\n %H:%M:%S passed" );
        //msg.Format(L"This software is submitted for the Windows Mobile Contest");
		//AtlMessageBox(NULL, msg.GetBuffer(), L"Warning");
		return FALSE;
	 }

#endif

#ifdef __TSTORE_ARM__0
	// ARM
	T_RETURN ret;
	TAPPID *APPID = TSTORE_APPLICATION_ID;

	bool aSuccess=true;

	T_RETURN res; 
	ARM_PLUGIN_Initialize(&res,APPID);
	if (res.code == ARM_SUCCESS) 
	{
		ARM_PLUGIN_CheckLicense(&res); 
		if (res.code == ARM_SUCCESS) 
		{ 
			ARM_PLUGIN_RequestLicense(&res); 
			if (res.code !=ARM_SUCCESS) 
			{ //실패시 구현 
				aSuccess=false;
				TCHAR wszMsg[1024];
				if(ret.pMsg)
				{
					ansi_to_unicode(ret.pMsg, strlen(ret.pMsg), wszMsg, 1024);
					::AtlMessageBox(NULL, wszMsg, L"[ARM]Request License");
				}
			}
		
		} 
		else 
		{//실패시 메시 구현 
			aSuccess=false;

			TCHAR wszMsg[1024];

			switch(res.code)
			{
			case CLICENSE_DENY:
			case CLICENSE_NOT_EXIST:
			case CLICENSE_EXPIRED:
			case CLICENSE_INVALID:
				{
					if(ret.pMsg)
					{
						ansi_to_unicode(ret.pMsg, strlen(ret.pMsg), wszMsg, 1024);
						::AtlMessageBox(NULL, wszMsg, L"[ARM]Check License");
					}
				}

			default:
				;
			}
		} 
	} 
	else 
	{ 
		aSuccess=false; 
	} 
	ARM_PLUGIN_Uninitialize(&res); 


	//if (! aSuccess) return 0;//PostQuitMessage(0); 

#endif

	//CAboutDlg aboutDlg;	aboutDlg.DoModal();
    //
	HRESULT hRes = CBTools2Frame::ActivatePreviousInstance(hInstance, lpstrCmdLine);

	if(FAILED(hRes) || S_FALSE == hRes)
	{
		return hRes;
	}

	hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	AtlInitCommonControls(ICC_DATE_CLASSES);
	SHInitExtraControls();

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = CBTools2Frame::AppRun(lpstrCmdLine, nCmdShow);

	_Module.Term();
	::CoUninitialize();

	return nRet;
}