当前位置: 首页>>代码示例>>C++>>正文


C++ ARRSIZE函数代码示例

本文整理汇总了C++中ARRSIZE函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRSIZE函数的具体用法?C++ ARRSIZE怎么用?C++ ARRSIZE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ARRSIZE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ini

int CScheduler::LoadFromFile(){

	CString strName;
	CString temp;

	strName.Format(_T("%spreferences.ini"), thePrefs.GetMuleDirectory(EMULE_CONFIGDIR));
	CIni ini(strName, _T("Scheduler"));
	
	UINT max=ini.GetInt(_T("Count"),0);
	UINT count=0;

	while (count<max) {
		strName.Format(_T("Schedule#%i"),count);
		temp=ini.GetString(_T("Title"),_T(""),strName);
		if (temp!=_T("")) {
			Schedule_Struct* news= new Schedule_Struct();
			news->title=temp;
			news->day=ini.GetInt(_T("Day"),0);
			news->enabled=ini.GetBool(_T("Enabled"));
			news->time=ini.GetInt(_T("StartTime"));
			news->time2=ini.GetInt(_T("EndTime"));
			ini.SerGet(true, news->actions,
				ARRSIZE(news->actions), _T("Actions"));
			ini.SerGet(true, news->values,
				ARRSIZE(news->values), _T("Values"));

			AddSchedule(news);
			count++;
		} else break;
	}

	return count;
}
开发者ID:techpub,项目名称:archive-code,代码行数:33,代码来源:Scheduler.cpp

示例2: InitWindowStyles

BOOL CMetaDataDlg::OnInitDialog()
{
	CResizablePage::OnInitDialog();
	InitWindowStyles(this);

	AddAnchor(IDC_TAGS, TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDC_TOTAL_TAGS, BOTTOM_LEFT, BOTTOM_RIGHT);
	
	GetDlgItem(IDC_TOTAL_TAGS)->SetWindowText(GetResString(IDS_METATAGS));

	m_tags.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);
	m_tags.ReadColumnStats(ARRSIZE(_aColumns), _aColumns);
	m_tags.CreateColumns(ARRSIZE(_aColumns), _aColumns);

	m_pMenuTags = new CMenu();
	if (m_pMenuTags->CreatePopupMenu())
	{
		m_pMenuTags->AppendMenu(MF_ENABLED | MF_STRING, MP_COPYSELECTED, GetResString(IDS_COPY));
		m_pMenuTags->AppendMenu(MF_SEPARATOR);
		m_pMenuTags->AppendMenu(MF_ENABLED | MF_STRING, MP_SELECTALL, GetResString(IDS_SELECTALL));
	}
	m_tags.m_pMenu = m_pMenuTags;
	m_tags.m_pParent = this;

	return TRUE;  // return TRUE unless you set the focus to a control
				  // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:axxapp,项目名称:winxgui,代码行数:27,代码来源:MetaDataDlg.cpp

示例3: while

void CSharedDirsTreeCtrl::FileSystemTreeCreateTree(){
	TCHAR drivebuffer[500];
	::GetLogicalDriveStrings(ARRSIZE(drivebuffer), drivebuffer); // e.g. "a:\ c:\ d:\"

	const TCHAR* pos = drivebuffer;
	while(*pos != _T('\0')){

		// Copy drive name
		TCHAR drive[4];
		_tcsncpy(drive, pos, ARRSIZE(drive));
		drive[ARRSIZE(drive) - 1] = _T('\0');

		switch(drive[0]){
			case _T('a'):
			case _T('A'):
			case _T('b'):
			case _T('B'):
			// Skip floppy disk
			break;
		default:
			drive[2] = _T('\0');
			FileSystemTreeAddChildItem(m_pRootUnsharedDirectries, drive, true); // e.g. ("c:")
		}

		// Point to the next drive (4 chars interval)
		pos = &pos[4];
	}
}
开发者ID:machado2,项目名称:emule,代码行数:28,代码来源:SharedDirsTreeCtrl.cpp

示例4: DBpatch_3020001

int	DBpatch_3020001(void)
{
	DB_RESULT		result;
	zbx_vector_uint64_t	eventids;
	DB_ROW			row;
	zbx_uint64_t		eventid;
	int			sources[] = {EVENT_SOURCE_TRIGGERS, EVENT_SOURCE_INTERNAL};
	int			objects[] = {EVENT_OBJECT_ITEM, EVENT_OBJECT_LLDRULE}, i;

	zbx_vector_uint64_create(&eventids);

	for (i = 0; i < (int)ARRSIZE(sources); i++)
	{
		result = DBselect(
				"select p.eventid"
				" from problem p"
				" where p.source=%d and p.object=%d and not exists ("
					"select null"
					" from triggers t"
					" where t.triggerid=p.objectid"
				")",
				sources[i], EVENT_OBJECT_TRIGGER);

		while (NULL != (row = DBfetch(result)))
		{
			ZBX_STR2UINT64(eventid, row[0]);
			zbx_vector_uint64_append(&eventids, eventid);
		}
		DBfree_result(result);
	}

	for (i = 0; i < (int)ARRSIZE(objects); i++)
	{
		result = DBselect(
				"select p.eventid"
				" from problem p"
				" where p.source=%d and p.object=%d and not exists ("
					"select null"
					" from items i"
					" where i.itemid=p.objectid"
				")",
				EVENT_SOURCE_INTERNAL, objects[i]);

		while (NULL != (row = DBfetch(result)))
		{
			ZBX_STR2UINT64(eventid, row[0]);
			zbx_vector_uint64_append(&eventids, eventid);
		}
		DBfree_result(result);
	}

	zbx_vector_uint64_sort(&eventids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);

	if (0 != eventids.values_num)
		DBexecute_multiple_query("delete from problem where", "eventid", &eventids);

	zbx_vector_uint64_destroy(&eventids);

	return SUCCEED;
}
开发者ID:zabbix,项目名称:zabbix,代码行数:60,代码来源:dbupgrade_3020.c

示例5: strError

bool CKnownFileList::LoadKnownFiles()
{
	CString fullpath = thePrefs.GetMuleDirectory(EMULE_CONFIGDIR);
	fullpath.Append(KNOWN_MET_FILENAME);
	CSafeBufferedFile file;
	CFileException fexp;
	if (!file.Open(fullpath,CFile::modeRead|CFile::osSequentialScan|CFile::typeBinary|CFile::shareDenyWrite, &fexp)){
		if (fexp.m_cause != CFileException::fileNotFound){
			CString strError(_T("Failed to load ") KNOWN_MET_FILENAME _T(" file"));
			TCHAR szError[MAX_CFEXP_ERRORMSG];
			if (fexp.GetErrorMessage(szError, ARRSIZE(szError))){
				strError += _T(" - ");
				strError += szError;
			}
			LogError(LOG_STATUSBAR, _T("%s"), strError);
		}
		return false;
	}
	setvbuf(file.m_pStream, NULL, _IOFBF, 16384);

	CKnownFile* pRecord = NULL;
	try {
		uint8 header = file.ReadUInt8();
		if (header != MET_HEADER && header != MET_HEADER_I64TAGS){
			file.Close();
			LogError(LOG_STATUSBAR, GetResString(IDS_ERR_SERVERMET_BAD));
			return false;
		}
		AddDebugLogLine(false, _T("Known.met file version is %u (%s support 64bit tags)"), header, (header == MET_HEADER) ? _T("doesn't") : _T("does")); 

		UINT RecordsNumber = file.ReadUInt32();
		for (UINT i = 0; i < RecordsNumber; i++) {
			pRecord = new CKnownFile();
			if (!pRecord->LoadFromFile(&file)){
				TRACE(_T("*** Failed to load entry %u (name=%s  hash=%s  size=%I64u  parthashs=%u expected parthashs=%u) from known.met\n"), i, 
					pRecord->GetFileName(), md4str(pRecord->GetFileHash()), pRecord->GetFileSize(), pRecord->GetHashCount(), pRecord->GetED2KPartHashCount());
				delete pRecord;
				pRecord = NULL;
				continue;
			}
			SafeAddKFile(pRecord);
			pRecord = NULL;
		}
		file.Close();
	}
	catch(CFileException* error){
		if (error->m_cause == CFileException::endOfFile)
			LogError(LOG_STATUSBAR, GetResString(IDS_ERR_SERVERMET_BAD));
		else{
			TCHAR buffer[MAX_CFEXP_ERRORMSG];
			error->GetErrorMessage(buffer, ARRSIZE(buffer));
			LogError(LOG_STATUSBAR, GetResString(IDS_ERR_SERVERMET_UNKNOWN),buffer);
		}
		error->Delete();
		delete pRecord;
		return false;
	}

	return true;
}
开发者ID:acat,项目名称:emule,代码行数:60,代码来源:KnownFileList.cpp

示例6: AddLogTextV

void AddLogTextV(UINT uFlags, EDebugLogPriority dlpPriority, LPCTSTR pszLine, va_list argptr)
{
	ASSERT(pszLine != NULL);

	if ((uFlags & LOG_DEBUG) && !(thePrefs.GetVerbose() && dlpPriority >= thePrefs.GetVerboseLogPriority()))
		return;	

	TCHAR szLogLine[1000];
	if (_vsntprintf(szLogLine, ARRSIZE(szLogLine), pszLine, argptr) == -1)
		szLogLine[ARRSIZE(szLogLine) - 1] = _T('\0');
	
	if (theApp.emuledlg)
		theApp.emuledlg->AddLogText(uFlags, szLogLine);
	else
	{
		TRACE(_T("App Log: %s\n"), szLogLine);

		TCHAR szFullLogLine[1060];
		int iLen = _sntprintf(szFullLogLine, ARRSIZE(szFullLogLine), _T("%s: %s\r\n"), CTime::GetCurrentTime().Format(thePrefs.GetDateTimeFormat4Log()), szLogLine);
		if (iLen >= 0)
		{
			if (!(uFlags & LOG_DEBUG))
			{
				if (thePrefs.GetLog2Disk())
					theLog.Log(szFullLogLine, iLen);
			}

			if (thePrefs.GetVerbose() && ((uFlags & LOG_DEBUG) || thePrefs.GetFullVerbose()))
			{
				if (thePrefs.GetDebug2Disk())
					theVerboseLog.Log(szFullLogLine, iLen);
			}
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:resurrection,代码行数:35,代码来源:Log.cpp

示例7: SendMessage

void CDirectoryTreeCtrl::Init(void)
{
	SendMessage(CCM_SETUNICODEFORMAT, TRUE);

	ShowWindow(SW_HIDE);
	DeleteAllItems();

	ModifyStyle( 0, TVS_CHECKBOXES );

	// START: added by FoRcHa /////////////
	WORD wWinVer = thePrefs.GetWindowsVersion();	// maybe causes problems on 98 & nt4
	if(wWinVer == _WINVER_2K_ || wWinVer == _WINVER_XP_ || wWinVer == _WINVER_ME_)		
	{
		SHFILEINFO shFinfo;
		HIMAGELIST hImgList = NULL;

		// Get the system image list using a "path" which is available on all systems. [patch by bluecow]
		hImgList = (HIMAGELIST)SHGetFileInfo(_T("."), 0, &shFinfo, sizeof(shFinfo),
												SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
		if(!hImgList)
		{
			TRACE(_T("Cannot retrieve the Handle of SystemImageList!"));
			//return;
		}

		m_image.m_hImageList = hImgList;
		SetImageList(&m_image, TVSIL_NORMAL);
	}
	////////////////////////////////


	TCHAR drivebuffer[500];
	::GetLogicalDriveStrings(ARRSIZE(drivebuffer), drivebuffer); // e.g. "a:\ c:\ d:\"

	const TCHAR* pos = drivebuffer;
	while(*pos != _T('\0')){

		// Copy drive name
		TCHAR drive[4];
		_tcsncpy(drive, pos, ARRSIZE(drive));
		drive[ARRSIZE(drive) - 1] = _T('\0');

		switch(drive[0]){
			case _T('a'):
			case _T('A'):
			case _T('b'):
			case _T('B'):
			// Skip floppy disk
			break;
		default:
			drive[2] = _T('\0');
			AddChildItem(NULL, drive); // e.g. ("c:")
		}

		// Point to the next drive (4 chars interval)
		pos = &pos[4];
	}
	ShowWindow(SW_SHOW);
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:59,代码来源:DirectoryTreeCtrl.cpp

示例8: InitWindowStyles

BOOL CIPFilterDlg::OnInitDialog()
{
	CResizableDialog::OnInitDialog();
	InitWindowStyles(this);

	AddAnchor(IDC_IPFILTER, TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDC_TOTAL_IPFILTER_LABEL, BOTTOM_LEFT);
	AddAnchor(IDC_TOTAL_IPFILTER, BOTTOM_LEFT);
	AddAnchor(IDC_TOTAL_IPS_LABEL, BOTTOM_LEFT);
	AddAnchor(IDC_TOTAL_IPS, BOTTOM_LEFT);
	AddAnchor(IDC_COPY, BOTTOM_RIGHT);
	AddAnchor(IDC_REMOVE, BOTTOM_RIGHT);
	AddAnchor(IDC_APPEND, BOTTOM_RIGHT);
	AddAnchor(IDC_SAVE, BOTTOM_RIGHT);
	AddAnchor(IDOK, BOTTOM_RIGHT);
	EnableSaveRestore(PREF_INI_SECTION);

	ASSERT( m_ipfilter.GetStyle() & LVS_OWNERDATA );
	m_ipfilter.SendMessage(CCM_SETUNICODEFORMAT, TRUE);
	m_ipfilter.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
	m_ipfilter.EnableHdrCtrlSortBitmaps();
	m_ipfilter.ReadColumnStats(ARRSIZE(_aColumns), _aColumns);
	m_ipfilter.CreateColumns(ARRSIZE(_aColumns), _aColumns);
  	m_ipfilter.InitColumnOrders(ARRSIZE(_aColumns), _aColumns);
	m_ipfilter.UpdateSortColumn(ARRSIZE(_aColumns), _aColumns);

	SetIcon(m_icoDlg = theApp.LoadIcon(_T("IPFilter")), FALSE);

	InitIPFilters();
	
	m_pMenuIPFilter = new CMenu();
	if (m_pMenuIPFilter->CreatePopupMenu())
	{
		m_pMenuIPFilter->AppendMenu(MF_ENABLED | MF_STRING, MP_COPYSELECTED, GetResString(IDS_COPY));
		m_pMenuIPFilter->AppendMenu(MF_ENABLED | MF_STRING, MP_REMOVE, GetResString(IDS_REMOVE));
		m_pMenuIPFilter->AppendMenu(MF_SEPARATOR);
		m_pMenuIPFilter->AppendMenu(MF_ENABLED | MF_STRING, MP_SELECTALL, GetResString(IDS_SELECTALL));
		m_pMenuIPFilter->AppendMenu(MF_SEPARATOR);
		m_pMenuIPFilter->AppendMenu(MF_ENABLED | MF_STRING, MP_FIND, GetResString(IDS_FIND));
	}
	m_ipfilter.m_pMenu = m_pMenuIPFilter;
	m_ipfilter.m_pParent = this;

	
	// localize
	SetWindowText(GetResString(IDS_IPFILTER));
	SetDlgItemText(IDC_STATICIPLABEL,GetResString(IDS_IP_RULES));
	SetDlgItemText(IDC_TOTAL_IPFILTER_LABEL,GetResString(IDS_TOTAL_IPFILTER_LABEL));
	SetDlgItemText(IDC_TOTAL_IPS_LABEL,GetResString(IDS_TOTAL_IPS_LABEL));
	SetDlgItemText(IDC_COPY,GetResString(IDS_COPY));
	SetDlgItemText(IDC_REMOVE,GetResString(IDS_DELETESELECTED));
	SetDlgItemText(IDC_APPEND,GetResString(IDS_APPEND));
	SetDlgItemText(IDC_SAVE,GetResString(IDS_SAVE));
	SetDlgItemText(IDOK,GetResString(IDS_FD_CLOSE));

	return TRUE;  // return TRUE unless you set the focus to a control
				  // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:58,代码来源:IPFilterDlg.cpp

示例9: ASSERT

void CMiniMule::UpdateContent(UINT uUpDatarate, UINT uDownDatarate)
{
    ASSERT( GetCurrentThreadId() == _uMainThreadId );
    if (m_bResolveImages)
    {
        static const LPCTSTR _apszConnectedImgs[] =
            {
                _T("CONNECTEDNOTNOT.GIF"),
                _T("CONNECTEDNOTLOW.GIF"),
                _T("CONNECTEDNOTHIGH.GIF"),
                _T("CONNECTEDLOWNOT.GIF"),
                _T("CONNECTEDLOWLOW.GIF"),
                _T("CONNECTEDLOWHIGH.GIF"),
                _T("CONNECTEDHIGHNOT.GIF"),
                _T("CONNECTEDHIGHLOW.GIF"),
                _T("CONNECTEDHIGHHIGH.GIF")
            };

        UINT uIconIdx = theApp.emuledlg->GetConnectionStateIconIndex();
        if (uIconIdx >= ARRSIZE(_apszConnectedImgs))
        {
            ASSERT(0);
            uIconIdx = 0;
        }

        TCHAR szModulePath[_MAX_PATH];
        if (GetModuleFileName(AfxGetResourceHandle(), szModulePath, ARRSIZE(szModulePath)))
        {
            CString strFilePathUrl(CreateFilePathUrl(szModulePath, INTERNET_SCHEME_RES));
            CComPtr<IHTMLImgElement> elm;
            GetElementInterface(_T("connectedImg"), &elm);
            if (elm)
            {
                CString strResourceURL;
                strResourceURL.Format(_T("%s/%s"), strFilePathUrl, _apszConnectedImgs[uIconIdx]);
                elm->put_src(CComBSTR(strResourceURL));
            }
        }
    }

    SetElementHtml(_T("connected"), CComBSTR(theApp.IsConnected() ? GetResString(IDS_YES) : GetResString(IDS_NO)));
    SetElementHtml(_T("upRate"), CComBSTR(theApp.emuledlg->GetUpDatarateString(uUpDatarate)));
    SetElementHtml(_T("downRate"), CComBSTR(theApp.emuledlg->GetDownDatarateString(uDownDatarate)));
    UINT uCompleted = 0;
    if (thePrefs.GetRemoveFinishedDownloads())
        uCompleted = thePrefs.GetDownSessionCompletedFiles();
    else if (theApp.emuledlg && theApp.emuledlg->transferwnd && theApp.emuledlg->transferwnd->downloadlistctrl.m_hWnd)
    {
        int iTotal;
        uCompleted = theApp.emuledlg->transferwnd->downloadlistctrl.GetCompleteDownloads(-1, iTotal);	 // [Ded]: -1 to get the count of all completed files in all categories
    }
    SetElementHtml(_T("completed"), CComBSTR(CastItoIShort(uCompleted, false, 0)));
    SetElementHtml(_T("freeSpace"), CComBSTR(CastItoXBytes(GetFreeTempSpace(-1), false, false)));
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:54,代码来源:MiniMule.cpp

示例10: GetDlgItem

BOOL CPPgProxy::OnApply()
{
	USES_CONVERSION;
	thePrefs.SetProxyASCWOP(IsDlgButtonChecked(IDC_ASCWOP));
	proxy.UseProxy=(IsDlgButtonChecked(IDC_ENABLEPROXY));
	proxy.EnablePassword = ((CButton*)GetDlgItem(IDC_ENABLEAUTH))->GetCheck();
	proxy.type = ((CComboBox*)GetDlgItem(IDC_PROXYTYPE))->GetCurSel();

	if(GetDlgItem(IDC_PROXYNAME)->GetWindowTextLength())
	{ 
		GetDlgItem(IDC_PROXYNAME)->GetWindowText(proxy.name, ARRSIZE(proxy.name));
	}
	else
	{
		proxy.name[0] = _T('\0');
        proxy.UseProxy = false;
	}

	if(GetDlgItem(IDC_PROXYPORT)->GetWindowTextLength())
	{ 
		TCHAR buffer[6];
		GetDlgItem(IDC_PROXYPORT)->GetWindowText(buffer,ARRSIZE(buffer));
		proxy.port = (_tstoi(buffer)) ? _tstoi(buffer) : 1080;
	}
	else
		proxy.port = 1080;

	if(GetDlgItem(IDC_USERNAME_A)->GetWindowTextLength())
	{ 
		CString strUser;
		GetDlgItem(IDC_USERNAME_A)->GetWindowText(strUser);
		_snprintf(proxy.user, ARRSIZE(proxy.user), "%s", T2CA(strUser));
	}
	else
	{
		proxy.user[0] = '\0';
		proxy.EnablePassword = false;
	}

	if(GetDlgItem(IDC_PASSWORD)->GetWindowTextLength())
	{ 
		CString strPasswd;
		GetDlgItem(IDC_PASSWORD)->GetWindowText(strPasswd);
		_snprintf(proxy.password, ARRSIZE(proxy.password), "%s", T2CA(strPasswd));
	}
	else
	{
		proxy.password[0] = '\0';
		proxy.EnablePassword = false;
	}
	thePrefs.SetProxySettings(proxy);
	LoadSettings();
	return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:54,代码来源:PPGProxy.cpp

示例11: Read

CString CFileDataIO::ReadString(bool bOptUTF8, UINT uRawSize)
{
#ifdef _UNICODE
	const UINT uMaxShortRawSize = SHORT_RAW_ED2K_UTF8_STR;
	if (uRawSize <= uMaxShortRawSize)
	{
		char acRaw[uMaxShortRawSize];
		Read(acRaw, uRawSize);
		if (uRawSize >= 3 && (UCHAR)acRaw[0] == 0xEFU && (UCHAR)acRaw[1] == 0xBBU && (UCHAR)acRaw[2] == 0xBFU)
		{
			WCHAR awc[uMaxShortRawSize];
			int iChars = ByteStreamToWideChar(acRaw + 3, uRawSize - 3, awc, ARRSIZE(awc));
			if (iChars >= 0)
				return CStringW(awc, iChars);
		}
		else if (bOptUTF8)
		{
			WCHAR awc[uMaxShortRawSize];
			//int iChars = ByteStreamToWideChar(acRaw, uRawSize, awc, ARRSIZE(awc));
			int iChars = utf8towc(acRaw, uRawSize, awc, ARRSIZE(awc));
			if (iChars >= 0)
				return CStringW(awc, iChars);
		}
		return CStringW(acRaw, uRawSize); // use local codepage
	}
	else
	{
		Array<char> acRaw(uRawSize);
		Read(acRaw, uRawSize);
		if (uRawSize >= 3 && (UCHAR)acRaw[0] == 0xEFU && (UCHAR)acRaw[1] == 0xBBU && (UCHAR)acRaw[2] == 0xBFU)
		{
			Array<WCHAR> awc(uRawSize);
			int iChars = ByteStreamToWideChar(acRaw + 3, uRawSize - 3, awc, uRawSize);
			if (iChars >= 0)
				return CStringW(awc, iChars);
		}
		else if (bOptUTF8)
		{
			Array<WCHAR> awc(uRawSize);
			//int iChars = ByteStreamToWideChar(acRaw, uRawSize, awc, uRawSize);
			int iChars = utf8towc(acRaw, uRawSize, awc, uRawSize);
			if (iChars >= 0)
				return CStringW(awc, iChars);
		}
		return CStringW(acRaw, uRawSize); // use local codepage
	}
#else
	CStringA strA;
	Read(strA.GetBuffer(uRawSize), uRawSize);
	strA.ReleaseBuffer(uRawSize);
	return strA;
#endif
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:53,代码来源:SafeFile.cpp

示例12: ustring_GetCurrentDir

int ustring_GetCurrentDir (lua_State *L)
{
	wchar_t buf[256];
	DWORD num = GetCurrentDirectoryW(ARRSIZE(buf), buf);
	if(num) {
		if(num < ARRSIZE(buf))
			push_utf8_string(L, buf, -1);
		else {
			wchar_t* alloc = (wchar_t*) malloc(num * sizeof(wchar_t));
			num = GetCurrentDirectoryW(num, alloc);
			if(num) push_utf8_string(L, alloc, -1);
			free(alloc);
		}
	}
	return num ? 1 : SysErrorReturn(L);
}
开发者ID:FarGroup,项目名称:FarManager,代码行数:16,代码来源:ustring.c

示例13: Localize

void CPPgServer::Localize(void)
{
	static const uint16 s_auResTbl[][2] =
	{
		{ IDC_SRVCONTIMEOUT_LBL, IDS_SRVCONTIMEOUT_LBL },
		{ IDC_SRV_SEC, IDS_SECS },
		{ IDC_REMOVEDEAD, IDS_PW_RDEAD },
		{ IDC_RETRIES_LBL, IDS_PW_RETRIES },
		{ IDC_SERVERKEEPALIVE_LBL, IDS_PW_KEEPALIVE },
		{ IDC_SRV_MIN, IDS_MINS },
		{ IDC_UPDATESERVERCONNECT, IDS_PW_USC },
		{ IDC_ADDSRVFROMCLIENTS, IDS_ADDSRVFROMCLIENTS },
		{ IDC_AUTOSERVER, IDS_PW_USS },
		{ IDC_SCORE, IDS_PW_SCORE },
		{ IDC_RESTARTWAITING, IDS_RESTARTWAITING },
		{ IDC_SMARTIDCHECK, IDS_SMARTLOWIDCHECK },
		{ IDC_AUTOCONNECT, IDS_PW_AUTOCON },
		{ IDC_RECONN, IDS_PW_RECON },
		{ IDC_MANUALSERVERHIGHPRIO, IDS_MANUALSERVERHIGHPRIO },
		{ IDC_AUTOCONNECTSTATICONLY, IDS_PW_AUTOCONNECTSTATICONLY },
		{ IDC_ICC_BUTTON, IDS_ICC_BUTTON },
		{ IDC_USE_AUX_PORT_CHECKBOX, IDS_USE_AUX_PORT_CHECKBOX }
	};

	if (::IsWindow(m_hWnd))
	{
		CString	strRes;

		for (uint32 i = 0; i < ARRSIZE(s_auResTbl); i++)
		{
			::GetResString(&strRes, static_cast<UINT>(s_auResTbl[i][1]));
			SetDlgItemText(s_auResTbl[i][0], strRes);
		}
	}
}
开发者ID:rusingineer,项目名称:EmulePlus,代码行数:35,代码来源:PPgServer.cpp

示例14: svc_install_event_source

static int	svc_install_event_source(const char *path)
{
	HKEY	hKey;
	DWORD	dwTypes = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
	wchar_t	execName[MAX_PATH];
	wchar_t	regkey[256], *wevent_source;

	svc_get_fullpath(path, execName, MAX_PATH);

	wevent_source = zbx_utf8_to_unicode(ZABBIX_EVENT_SOURCE);
	StringCchPrintf(regkey, ARRSIZE(regkey), EVENTLOG_REG_PATH TEXT("System\\%s"), wevent_source);
	zbx_free(wevent_source);

	if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_LOCAL_MACHINE, regkey, 0, NULL, REG_OPTION_NON_VOLATILE,
			KEY_SET_VALUE, NULL, &hKey, NULL))
	{
		zbx_error("unable to create registry key: %s", strerror_from_system(GetLastError()));
		return FAIL;
	}

	RegSetValueEx(hKey, TEXT("TypesSupported"), 0, REG_DWORD, (BYTE *)&dwTypes, sizeof(DWORD));
	RegSetValueEx(hKey, TEXT("EventMessageFile"), 0, REG_EXPAND_SZ, (BYTE *)execName,
			(DWORD)(wcslen(execName) + 1) * sizeof(wchar_t));
	RegCloseKey(hKey);

	zbx_error("event source [%s] installed successfully", ZABBIX_EVENT_SOURCE);

	return SUCCEED;
}
开发者ID:HupuInc,项目名称:zabbix,代码行数:29,代码来源:service.c

示例15: execute

void execute(struct wdata *data)
{
	char tmp[CMD_BUFSIZE + 1];
	char *name;
	int i;
	struct arg arg;

	strcpy(tmp, cmd_data.buf);

	name = strtok(tmp, " ");
	arg.s = strtok(NULL, " ");

	if (!name) {
		/* no command entered, leave cmd state */
		set_message(M_INFO, "");
	} else {
		for (i = 0; i < ARRSIZE(cmds); i++) {
			if (streq(name, cmds[i].name)) {
				cmds[i].func(data, &arg);
				return;
			}
		}

		/* no command found, print error message */
		set_message(M_ERROR, "no such command: '%s' ", name);
	}
}
开发者ID:dstenb,项目名称:tfm,代码行数:27,代码来源:cmd_state.c


注:本文中的ARRSIZE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。