示例#1
0
static void PVDDoOpen(AOperator *asop, int result)
{
	HeartMsg *sm = container_of(asop, HeartMsg, timer);
	if ((result < 0) || (pvd == NULL)) {
		HeartMsgFree(sm, result);
		return;
	}

	if (sm->object == rt) {
		AOption opt;
		aoption_init(&opt, NULL);

		strcpy_s(opt.name, "version");
		_ltoa_s(login_data.byDVRType, opt.value, 10);
		sm->object->setopt(sm->object, &opt);

		strcpy_s(opt.name, "session_id");
		_ltoa_s(userid, opt.value, 10);
		sm->object->setopt(sm->object, &opt);
	}

	amsg_init(&sm->msg, AMsgType_Option, (char*)sm->option, 0);
	sm->msg.done = &PVDOpenDone;

	result = sm->object->open(sm->object, &sm->msg);
	if (result != 0)
		PVDOpenDone(&sm->msg, result);
}
void Logger::open(DWORD pId)
{
	try
	{
		openService(logNumber, filename);
	}
	catch (std::exception&)
	{
		char buf[10];
		_ltoa_s(logNumber, buf, 10, 10);
		filename = std::string("log_XXX_00_00_00_" + std::string(buf));
	}
	char buf[10];
	_ltoa_s(pId, buf, 10, 10);
	out.open(filename);
	if (!out)
	{
		std::cout << "Can't open file" << std::endl;
		throw OpenFileError("Error opening file.");
	}
	out << "############################################################################" << std::endl;
	out << "============	The log file for a process with initial id:		============" << std::endl <<
		buf << std::endl;
	out << "############################################################################" << std::endl << std::endl;
	out.close();
}
void SettingsDialog::initialiseOptions()
{
	char tmp[15];

	::SendMessage(GetDlgItem(_hSelf, IDC_NOTIFY), BM_SETCHECK, g_options.notifyUpdates ? BST_CHECKED : BST_UNCHECKED, 0);
	
	::SendMessage(GetDlgItem(_hSelf, IDC_SHOWUNSTABLE), BM_SETCHECK, g_options.showUnstable ? BST_CHECKED : BST_UNCHECKED, 0);

	
	_ltoa_s(g_options.daysToCheck, tmp, 15, 10);
	::SetWindowTextA(GetDlgItem(_hSelf, IDC_DAYSTOCHECK), tmp);

	::SendMessage(GetDlgItem(_hSelf, IDC_INSTALLALLUSERS), BM_SETCHECK, g_options.installLocation == INSTALLLOC_APPDATA ? BST_UNCHECKED : BST_CHECKED, 0);

	::EnableWindow(GetDlgItem(_hSelf, IDC_INSTALLALLUSERS), g_options.appDataPluginsSupported);

	tstring info(_T("Plugin Config path is:\r\n"));
	TCHAR path[MAX_PATH];
	path[0] = _T('\0');
	::SendMessage(_nppData->_nppHandle, NPPM_GETPLUGINSCONFIGDIR, MAX_PATH, reinterpret_cast<LPARAM>(path));
	info.append(path);
	info.append(_T("\r\n"));
	if (g_options.appDataPluginsSupported)
	{
		info.append(_T("Plugins in user's AppData directory are enabled. Remove the allowAppDataPlugins.xml file from the Notepad++ directory to disable."));
	}
	else
	{
		info.append(_T("Plugins in user's AppData directory are disabled - to enable in Notepad++ version 5.9.7 onwards place an empty file called allowAppDataPlugins.xml in the Notepad++ directory."));
	}
	
	SetWindowText(GetDlgItem(_hSelf, IDC_INFOTEXT), info.c_str());

}
示例#4
0
int dumpprint(ProxyStream& os, __int64 x)
{
	char Text[100];
	_ltoa_s(int(x),Text,10);
	dumpprint(os, Text);
	return (int)::strlen(Text);
};
示例#5
0
CString LongToStr(long lVal)
{
	CString strRet;
	char buff[20];

	_ltoa_s(lVal, buff, 10);
	strRet = buff;
	return strRet;
}
示例#6
0
std::string str(int32_t value)
{
	char buf[64];
#ifdef USING_VISUAL_2005
	if (_ltoa_s(value, buf, sizeof(buf), 10) == 0)
		return buf;
	else
		return "";
#else
	return ltoa(value, buf, 10);
#endif //USING_VISUAL_2005
}
示例#7
0
文件: ZdCtlTim.cpp 项目: DeegC/10d
zLONG
ZTimer::SetZCtrlState( zLONG  lStatusType,
                       zULONG ulValue )
{
   zLONG lRC = ZMapAct::SetZCtrlState( lStatusType, ulValue );

   // Enabled is used to start/stop the timer thread
   if ( lStatusType == zCONTROL_STATUS_ENABLED )
   {
   // TraceLineI( "ZTimer::SetZCtrlState ENABLED: ", ulValue );

      if ( ulValue )
      {
         if ( ulValue > 1 )
         {
            m_lInterval = ulValue;

#ifdef zREMOTE_SERVER
            zCHAR szInterval[ 32 ];

            _ltoa_s( m_lInterval, szInterval );
            SetRemoteZCtrlAttribute( this, "Timer", "Interval", szInterval );
#endif
         }

         if ( m_bEnabled == FALSE )
         {
#ifdef zREMOTE_SERVER
            SetRemoteZCtrlAttribute( this, "Ctrl", "Enabled", "Y" );
#else
            m_bEnabled = TRUE;
            m_pThread = AfxBeginThread( fnTimerThreadProc,
                                        (zPVOID) this,
                                        THREAD_PRIORITY_NORMAL,
                                        0, NULL );
#endif
         }
      }
      else
      {
         if ( m_bEnabled == TRUE )
         {
            m_bEnabled = FALSE;
#ifdef zREMOTE_SERVER
            SetRemoteZCtrlAttribute( this, "Ctrl", "Enabled", "N" );
#endif
         }
      }
   }

   return( lRC );
}
示例#8
0
文件: ZdCtlTim.cpp 项目: DeegC/10d
// ZTimer - ctor
ZTimer::ZTimer( ZSubtask *pZSubtask,
                CWnd     *pWndParent,
                ZMapAct  *pzmaComposite,
                zVIEW    vDialog,
                zSHORT   nOffsetX,
                zSHORT   nOffsetY,
                zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
        CStatic( ),
        ZMapAct( pZSubtask,             // base class ctor
                 pzmaComposite,
                 pWndParent,
                 this,
                 vDialog,
                 nOffsetX,
                 nOffsetY,
                 pCtrlDef,
                 "Timer" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for ZTimer", (zLONG) this );
#endif

   m_ulMapActFlags &= ~zMAPACT_FOCUS_ENABLED;

   // Make it a hidden window.
   Attr.Style &= ~(WS_TABSTOP | WS_VISIBLE );
   Attr.Style |= WS_DISABLED;
   Attr.X = 0;
   Attr.Y = 0;
   Attr.W = 0;
   Attr.H = 0;

   // Localize settings from XWD.
   m_lInterval = pCtrlDef->StyleX;
   m_bEnabled = TRUE;
   m_pThread = 0;

// TraceLineI( "Timer interval --> ", m_lInterval );
// TraceLineS( "string interval -> ", pCtrlDef->Text );
// TraceLineI( "Timer enabled ---> ", m_bEnabled );

#ifdef zREMOTE_SERVER
   zCHAR szInterval[ 32 ];

   _ltoa_s( m_lInterval, szInterval );
   SetRemoteZCtrlAttribute( this, "Timer", "Interval", szInterval );
#endif

   CreateZ( );
}
//-----------------------------------------------------------------------------//
std::string CCorbaErrorHelper::ToString(const CORBA::SystemException& err)
{
	std::string errDescription;
	TCHAR buf[50];
	memset(buf, 0, sizeof(TCHAR) * 50);
	
	CORBA::Any tmp;
	tmp <<= err;
	CORBA::TypeCode_var tc = tmp.type();

	errDescription = std::string(tc->name()) + _T(" Description: ") + err.NP_minorString();
	errDescription += _T(" Minor code: ");
	errDescription += _ltoa_s(err.minor(), buf, 50, 10);

	return errDescription;
}
示例#10
0
void dumpprint(ProxyStream& os, __int64 x, int Scale, const char*xText)
{
	char Text[100];

	_ltoa_s(int(x),Text + 1,99,10);

	int Dot = 1;
	for(Dot=1; Text[Dot]; Dot++);
	Dot -= Scale;
	Dot--;
	for(int i=0; i < Dot; i++)
		Text[i] = Text[i+1];
	if(Scale > 0) Text[Dot] = '.';	
	else Text[Dot] = 0;
	dumpprint(os,Text);
	dumpprint(os,xText);
};
void Logger::openService(size_t logNum, std::string& fName)
{
	time_t sec = time(NULL);
	tm timeInfo;
	std::string date, temp;
	if (localtime_s(&timeInfo, &sec))
	{
		std::cout << "Can't open file" << std::endl;
		throw LocalTimeError("Error getting local time.");
	}
	char buf1[26];
	if (asctime_s(buf1, 26, &timeInfo))
	{
		std::cout << "Can't open file" << std::endl;
		throw AscTimeError("Error getting time string.");
	}

	char buf2[10];
	_ltoa_s(logNum, buf2, 10, 10);

	fName = ("log_" + std::string(buf1).substr(0, 3) + "_" + std::string(buf1).substr(11, 2) + "_" +
		std::string(buf1).substr(14, 2) + "_" + std::string(buf1).substr(17, 2) + "_" + std::string(buf2) + ".txt");
}
示例#12
0
CString::CString(long int num)
{
	char buffer[65];
	_ltoa_s(num, buffer, 10);
	InitializationString((const char *)buffer);
}
示例#13
0
char* ItoAStatic(int integer)
{
    ASSERT_ZERORET(_ltoa_s(integer, s_ItoACacheBuff, MAX_PATH, 10), NULL);
    return s_ItoACacheBuff;
}