• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AfxIsValidString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: while

void COXNetBrowseTree::Cleanup()
// --- In  :
// --- Out : 
// --- Returns :
// --- Effect : Clean up the internal structures
{
	// Clean up the association map between tree item handles and net resource infos
	POSITION pos;
	HTREEITEM hTreeItem;
	NETRESOURCE* pNetResource;
	pos = m_resourceMap.GetStartPosition();
	while (pos != NULL)
	{
		m_resourceMap.GetNextAssoc(pos, hTreeItem, pNetResource);
		// ... First delete the strings
		ASSERT(pNetResource->lpLocalName == NULL || AfxIsValidString(pNetResource->lpLocalName));
		ASSERT(pNetResource->lpRemoteName == NULL || AfxIsValidString(pNetResource->lpRemoteName));
		ASSERT(pNetResource->lpComment == NULL || AfxIsValidString(pNetResource->lpComment));
		ASSERT(pNetResource->lpProvider == NULL || AfxIsValidString(pNetResource->lpProvider));
		delete[] pNetResource->lpLocalName;
		delete[] pNetResource->lpRemoteName;
		delete[] pNetResource->lpComment;
		delete[] pNetResource->lpProvider;
		ASSERT(AfxIsValidAddress(pNetResource, sizeof(NETRESOURCE)));
		delete pNetResource;
	}
	m_resourceMap.RemoveAll();
}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:28,代码来源:OXNetBrowseTree.cpp


示例2: ASSERT

BOOL CTrayIcon::ShowBalloon(LPCTSTR szText, LPCTSTR szTitle, DWORD dwIcon, UINT uTimeout)
{
    // Verify input parameters.
	if (uTimeout <= 0)
		return FALSE;

    // The balloon tooltip text can be up to 255 chars long.
    ASSERT(AfxIsValidString(szText));
    ASSERT(lstrlen(szText) < 256);

    // The balloon title text can be up to 63 chars long.
    if (szTitle)
    {
        ASSERT(AfxIsValidString( szTitle));
        ASSERT(lstrlen(szTitle) < 64);
    }

    // dwBalloonIcon must be valid.
    ASSERT(NIIF_NONE == dwIcon    || NIIF_INFO == dwIcon ||
           NIIF_WARNING == dwIcon || NIIF_ERROR == dwIcon);

    // The timeout must be between 10 and 30 seconds.
    uTimeout = min(max(uTimeout, 10), 30);

	NOTIFYICONDATA_TI nid;

	nid.cbSize = sizeof(nid);
	nid.hWnd = GetSafeHwnd();
	nid.uID = GetDlgCtrlID();
	nid.uFlags = NIF_INFO;

//fabio_2005
#if _MSC_VER >= 1300
    _tcsncpy_s(nid.szInfo, szText, 256);

    if (szTitle)
        _tcsncpy_s(nid.szInfoTitle, szTitle, 64);
#else
    _tcsncpy(nid.szInfo, szText, 256);

    if (szTitle)
        _tcsncpy(nid.szInfoTitle, szTitle, 64);
#endif

    else
        nid.szInfoTitle[0] = _T('\0');

    nid.dwInfoFlags = dwIcon;
    nid.uTimeout = uTimeout * 1000;   // convert time to ms

	// if the icon is not showing then show it temporarily
	if (!m_bVisible)
	{
		m_bTemporaryIcon = TRUE;
		ShowTrayIcon(TRUE);
	}

    return Shell_NotifyIcon(NIM_MODIFY, (PNOTIFYICONDATA)&nid);
}
开发者ID:jithuin,项目名称:infogeezer,代码行数:59,代码来源:TRAYICON.CPP


示例3: ASSERT

bool CXTPTrayIcon::ShowBalloonTip(LPCTSTR lpszInfo, LPCTSTR lpszInfoTitle/*= NULL*/, DWORD dwInfoFlags/*= NIIF_NONE*/, UINT uTimeout/*= 10*/)
{
	bool bResult = false;

	if (IsShellVersion5() && lpszInfo)
	{
		// The balloon tooltip text can be up to 255 chars long.
		ASSERT(AfxIsValidString(lpszInfo));
		ASSERT(lstrlen(lpszInfo) < 256);

		// The balloon title text can be up to 63 chars long.
		if (lpszInfoTitle)
		{
			ASSERT(AfxIsValidString(lpszInfoTitle));
			ASSERT(lstrlen(lpszInfoTitle) < 64);
		}

		// dwInfoFlags must be valid.
		ASSERT(NIIF_NONE == dwInfoFlags ||
				NIIF_INFO == dwInfoFlags ||
				NIIF_WARNING == dwInfoFlags ||
				NIIF_ERROR == dwInfoFlags);

		// The timeout must be between 10 and 30 seconds.
		ASSERT(uTimeout >= 10 && uTimeout <= 30);

		m_niData.uFlags |= NIF_INFO;

		STRNCPY_S(m_niData.szInfo, _countof(m_niData.szInfo), lpszInfo, 255);

		if (lpszInfoTitle)
		{
			STRNCPY_S(m_niData.szInfoTitle, _countof(m_niData.szInfoTitle), lpszInfoTitle, 63);
		}
		else
		{
			m_niData.szInfoTitle[0] = _T('\0');
		}

		m_niData.uTimeout = (uTimeout * 1000); // convert time to millisecs
		m_niData.dwInfoFlags = dwInfoFlags;

		if (ShellNotify(NIM_MODIFY))
		{
			bResult = true;
		}

		// Zero out the balloon text string so that later operations won't redisplay
		// the balloon.
		m_niData.szInfo[0] = _T('\0');
	}

	return bResult;
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:54,代码来源:XTPTrayIcon.cpp


示例4: ASSERT

void CTag::AssertValid() const
{
	CObject::AssertValid();

	ASSERT( m_uType != 0 );
	ASSERT( m_uName != 0 && m_pszName == NULL || m_uName == 0 && m_pszName != NULL );
	ASSERT( m_pszName == NULL || AfxIsValidString(m_pszName) );
	if (IsStr())
		ASSERT( m_pstrVal != NULL && AfxIsValidString(*m_pstrVal) );
	else if (IsHash())
		ASSERT( m_pData != NULL && AfxIsValidAddress(m_pData, 16) );
	else if (IsBlob())
		ASSERT( m_pData != NULL && AfxIsValidAddress(m_pData, m_nBlobSize) );
}
开发者ID:SomeSupport,项目名称:eMule,代码行数:14,代码来源:packets.cpp


示例5: ASSERT

BOOL COXRegistryValFile::Open(HKEY hkey, LPCTSTR lpszKey, LPCTSTR lpszValue, LONG& error)
	{
	ASSERT(AfxIsValidString(lpszKey));
	ASSERT(AfxIsValidString(lpszValue));
	m_value = lpszValue;

	error = ::RegCreateKey(hkey, lpszKey, &m_key);
	if (ERROR_SUCCESS != error)
		return FALSE;
	DWORD dwType;
	DWORD dwSize;
	if (ERROR_SUCCESS == ::RegQueryValueEx(m_key, m_value, NULL, &dwType, NULL, &dwSize))
		{
		// the value already exists, check the type
		if (dwType != REG_BINARY)
			{
			error = 0;		// wrong type exists
			return FALSE;
			}

		// the value exists and has the right type
		BYTE * pData = NULL;
		try
			{
			pData = new BYTE[dwSize];
			}
		catch(...)
			{
			error = 0;		// memory low
			return FALSE;
			}

		error = ::RegQueryValueEx(m_key, m_value, NULL, &dwType, pData, &dwSize);
		if (ERROR_SUCCESS != error)
			{
			delete [] pData;
			return FALSE;
			}

		Write(pData, dwSize);
		SeekToBegin();

		delete [] pData;
		return TRUE;
		}

	error = 0;
	return TRUE;
	}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:49,代码来源:OXRegistryValFile.cpp


示例6: AddRecord

BOOL CPtrListExt :: AddRecord (COleVariant varBookmark, const char *pAbfallArt, BOOL bFirst/* = TRUE*/)
{
	ASSERT (NULL != pAbfallArt && AfxIsValidString (pAbfallArt));
	ASSERT (*pAbfallArt);

	try
	{
		CString strArt (pAbfallArt);
		CRecordInfo *pInfo = new CRecordInfo (strArt, varBookmark);
		AddTail (pInfo);					

	//	ggf. als 1. Satz setzen
		if (bFirst)
			return SetFirstRecord (varBookmark);

		return TRUE;
	}
	catch (CDaoException *e)
	{
		:: DisplayDaoException (e);
		e -> Delete ();
	}
	catch (CException *e)
	{
		e -> ReportError ();
		e -> Delete ();
	}

	return FALSE;
}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:30,代码来源:Abfset.cpp


示例7: ASSERT_VALID

COleClientItem* COleLinkingDoc::OnFindEmbeddedItem(LPCTSTR lpszItemName)
{
	ASSERT_VALID(this);
	ASSERT(AfxIsValidString(lpszItemName));

	// default implementation walks list of client items looking for
	//  a case sensitive match

	POSITION pos = GetStartPosition();
	COleClientItem* pItem;
	while ((pItem = GetNextClientItem(pos)) != NULL)
	{
		// a client item is running if there is a match in name
		//  and the m_lpObject is also running.
		TCHAR szItemName[OLE_MAXITEMNAME];
		pItem->GetItemName(szItemName, _countof(szItemName));
		if (lstrcmp(szItemName, lpszItemName) == 0)
			return pItem;
	}

	TRACE(traceOle, 1, "Warning: default COleLinkingDoc::OnFindEmbeddedItem\n");
	TRACE(traceOle, 1, _T("\timplementation failed to find item '%s'.\n"), lpszItemName);

	return NULL;    // no matching item found
}
开发者ID:jbeaurain,项目名称:omaha_vs2010,代码行数:25,代码来源:olelink.cpp


示例8: ASSERT

const CFileName& CFileName::Append(LPCTSTR lpsz)
{
  ASSERT(lpsz == NULL || AfxIsValidString(lpsz));
  CString::ConcatInPlace(SafeStrlen(lpsz), lpsz);
  return *this;
  
}
开发者ID:Robertysc,项目名称:ecos,代码行数:7,代码来源:FileName.cpp


示例9: ASSERT

BOOL CNamedPipeException::GetErrorMessage(LPTSTR pstrError, UINT nMaxError, PUINT pnHelpContext)
{
  //Validate our parameters
	ASSERT(pstrError != NULL && AfxIsValidString(pstrError, nMaxError));

	if (pnHelpContext != NULL)
		*pnHelpContext = 0;

  //What will be the return value from this function (assume the worst)
  BOOL bSuccess = FALSE;

	LPTSTR lpBuffer;
	DWORD dwReturn = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
			                           NULL,  m_dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
			                           reinterpret_cast<LPTSTR>(&lpBuffer), 0, NULL);
	if (dwReturn == 0)
		*pstrError = _T('\0');
	else
	{
    bSuccess = TRUE;
    Checked::tcsncpy_s(pstrError, nMaxError, lpBuffer, _TRUNCATE);
		LocalFree(lpBuffer);
	}

	return bSuccess;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:26,代码来源:npipe.cpp


示例10: ASSERT

BOOL CDialog::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
	ASSERT(HIWORD(lpszTemplateName) == 0 ||
		AfxIsValidString(lpszTemplateName));

	m_lpszTemplateName = lpszTemplateName;  // used for help
	if (HIWORD(m_lpszTemplateName) == 0 && m_nIDHelp == 0)
		m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);

#ifdef _DEBUG
	if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE))
	{
		ASSERT(FALSE);          // invalid dialog template name
		PostNcDestroy();        // cleanup if Create fails too soon
		return FALSE;
	}
#endif //_DEBUG

	HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
	HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
	HGLOBAL hTemplate = LoadResource(hInst, hResource);
	BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst);
	FreeResource(hTemplate);

	return bResult;
}
开发者ID:anyue100,项目名称:winscp,代码行数:26,代码来源:dlgcore.cpp


示例11: ASSERT

COleObjectFactory::COleObjectFactory(REFCLSID clsid,
	CRuntimeClass* pRuntimeClass, BOOL bMultiInstance, LPCTSTR lpszProgID)
{
	ASSERT(pRuntimeClass == NULL ||
		pRuntimeClass->IsDerivedFrom(RUNTIME_CLASS(CCmdTarget)));
	ASSERT(AfxIsValidAddress(&clsid, sizeof(CLSID), FALSE));
	ASSERT(lpszProgID == NULL || AfxIsValidString(lpszProgID));

	// initialize to unregistered state
	m_dwRegister = 0;   // not registered yet
	m_bRegistered = FALSE;
	m_clsid = clsid;
	m_pRuntimeClass = pRuntimeClass;
	m_bMultiInstance = bMultiInstance;
	m_lpszProgID = lpszProgID;
	m_bOAT = (BYTE) OAT_UNKNOWN;

	// licensing information
	m_bLicenseChecked = FALSE;
	m_bLicenseValid = FALSE;

	// add this factory to the list of factories
	m_pNextFactory = NULL;
	AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
	AfxLockGlobals(CRIT_OBJECTFACTORYLIST);
	pModuleState->m_factoryList.AddHead(this);
	AfxUnlockGlobals(CRIT_OBJECTFACTORYLIST);

	ASSERT_VALID(this);
}
开发者ID:anyue100,项目名称:winscp,代码行数:30,代码来源:olefact.cpp


示例12: Teilen

BOOL CxString :: Teilen( CString& h, CString& r, const char* pat, BOOL trimmen )
{
	CxString	head = h;
	CxString	rest = r;
	BOOL		result = FALSE;

	ASSERT( AfxIsValidString( pat ));
	if ( *pat == '\0' )
	{
		head = *this;
		rest = "";

		if ( trimmen )
		{
			head.TrimAll();
			rest.TrimAll();
		}
		h = head;
		r = rest;
		return TRUE;
	}
	if ( *(pat + 1 ) == '\0' )
		return Teilen( h, r, *pat, trimmen );

	int			i = Find( pat );
	int			len = lstrlen( pat );

	if ( len >= GetLength())
		return FALSE;

	if ( i >= 0 )
	{	if ( i == 0 )	// pat steht am Anfang
		{
			head.Empty();
			rest = Mid( len );
		}
		else
		{
			head = Left( i );
			if (( i + len ) < GetLength())
				rest = Mid( i + len );
			else
				rest = "";
			result = TRUE;
	}	}
	else
	{	// pat nicht gefunden!
		head = *this;
		rest.Empty();
	}

	if ( trimmen )
	{	head.TrimAll();
		rest.TrimAll();
	}

	h = head;
	r = rest;
	return result;
}	// Teilen
开发者ID:hkaiser,项目名称:TRiAS,代码行数:60,代码来源:CXSTRING.CPP


示例13: ASSERT

BOOL COleException::GetErrorMessage(LPTSTR lpszError, UINT nMaxError,
		PUINT pnHelpContext)
{
	ASSERT(lpszError != NULL && AfxIsValidString(lpszError, nMaxError));

	if (pnHelpContext != NULL)
		*pnHelpContext = 0;

	LPTSTR lpBuffer;
	if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
				FORMAT_MESSAGE_FROM_SYSTEM,
				NULL, m_sc,
				MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
				(LPTSTR) &lpBuffer, 0, NULL) == 0)
	{
		*lpszError = '\0';
		return FALSE;
	}
	else
	{
		lstrcpyn(lpszError, lpBuffer, nMaxError);
		LocalFree(lpBuffer);
		return TRUE;
	}
}
开发者ID:Rupan,项目名称:winscp,代码行数:25,代码来源:olemisc.cpp


示例14: ASSERT_VALID

BOOL CFolderDialog::GetRootFolder(IN OUT LPTSTR pszPath)
{
	ASSERT_VALID(this);
	ASSERT(AfxIsValidString(pszPath, MAX_PATH));

	return ::SHGetPathFromIDList(m_bi.pidlRoot, pszPath);
}
开发者ID:Rarder44,项目名称:TamrielUnlimitedIT_Installer_Uninstaller,代码行数:7,代码来源:FolderDlg.cpp


示例15: ASSERT_VALID

BOOL COleClientItem::ActivateAs(LPCTSTR lpszUserType,
                                REFCLSID clsidOld, REFCLSID clsidNew)
{
    ASSERT_VALID(this);
    ASSERT(lpszUserType == NULL || AfxIsValidString(lpszUserType));
    ASSERT(m_lpObject != NULL);

    // enable activate as
    m_scLast = _AfxOleDoTreatAsClass(lpszUserType, clsidOld, clsidNew);
    if (FAILED(m_scLast))
        return FALSE;

    // reload all items in this doucment
    COleDocument* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    POSITION pos = pDoc->GetStartPosition();
    COleClientItem* pItem;
    while ((pItem = pDoc->GetNextClientItem(pos)) != NULL)
    {
        // reload it, so activate as works as appropriate
        pItem->Reload();
    }

    ASSERT_VALID(this);
    return TRUE;
}
开发者ID:shuowen,项目名称:OpenNT,代码行数:26,代码来源:olecli3.cpp


示例16: _AfxLoadStreamFromPropset

LPSTREAM AFXAPI _AfxLoadStreamFromPropset(CPropertySection& psec, LPCTSTR pszPropName,
	DWORD& vtType)
{
	ASSERT(AfxIsValidString(pszPropName));

	vtType = VT_EMPTY;

	DWORD dwPropID;
	CProperty* pprop = NULL;
	LPSTREAM pstm = NULL;

	if (psec.GetID(pszPropName, &dwPropID) &&
		((pprop = psec.GetProperty(dwPropID)) != NULL))
	{
		vtType = pprop->GetType();

		if ((vtType == VT_BLOB) || (vtType == VT_BLOB_PROPSET))
		{
			pstm = _AfxCreateMemoryStream();

			if (pstm != NULL)
			{
				if (!_AfxInitStreamDataFromBlobProp(pstm, pprop))
				{
					pstm->Release();
					pstm = NULL;
				}
			}
		}
	}

	return pstm;
}
开发者ID:anyue100,项目名称:winscp,代码行数:33,代码来源:ctlpset.cpp


示例17: AfxGetFileTitle

UINT AFXAPI AfxGetFileTitle(LPCTSTR lpszPathName, LPTSTR lpszTitle, UINT nMax)
{
	ASSERT(lpszTitle == NULL ||
		AfxIsValidAddress(lpszTitle, _MAX_FNAME));
	ASSERT(AfxIsValidString(lpszPathName, FALSE));

#ifndef _MAC
	// use a temporary to avoid bugs in ::GetFileTitle when lpszTitle is NULL
	TCHAR szTemp[_MAX_PATH];
	LPTSTR lpszTemp = lpszTitle;
	if (lpszTemp == NULL)
	{
		lpszTemp = szTemp;
		nMax = _countof(szTemp);
	}
	if (AfxDllGetFileTitle(lpszPathName, lpszTemp, (WORD)nMax) != 0)
	{
		// when ::GetFileTitle fails, use cheap imitation
		return AfxGetFileName(lpszPathName, lpszTitle, nMax);
	}
	return lpszTitle == NULL ? lstrlen(lpszTemp)+1 : 0;
#else
	return AfxDllGetFileTitle(lpszPathName, lpszTitle, (WORD)nMax);
#endif
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:25,代码来源:filecore.cpp


示例18: ASSERT

// nPointSize is actually scaled 10x
BOOL CxEditView::CMyFont::CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, CDC* pDC)
{
   ASSERT(AfxIsValidString(lpszFaceName));

   LOGFONT logFont;
   memset(&logFont, 0, sizeof(LOGFONT));
   logFont.lfCharSet = DEFAULT_CHARSET;
   logFont.lfHeight = nPointSize;
   lstrcpyn(logFont.lfFaceName, lpszFaceName, _countof(logFont.lfFaceName));

   HDC hDC;
   if (pDC != NULL)
   {
      ASSERT_VALID(pDC);
      ASSERT(pDC->m_hAttribDC != NULL);
      hDC = pDC->m_hAttribDC;
   }
   else
      hDC = ::GetDC(NULL);

   // convert nPointSize to logical units based on pDC
   POINT pt;
   pt.y = ::GetDeviceCaps(hDC, LOGPIXELSY) * logFont.lfHeight;
   pt.y /= 720;    // 72 points/inch, 10 decipoints/point
   ::DPtoLP(hDC, &pt, 1);
   POINT ptOrg = { 0, 0 };
   ::DPtoLP(hDC, &ptOrg, 1);
   logFont.lfHeight = -abs(pt.y - ptOrg.y);

   if (pDC == NULL)
      ::ReleaseDC(NULL, hDC);

   return CreateFontIndirect(&logFont);

}
开发者ID:burzumishi,项目名称:arnold,代码行数:36,代码来源:edit.cpp


示例19: CCommonDialog

CFolderDialog::CFolderDialog( IN LPCTSTR pszTitle	 /*NULL*/,
							  IN LPCTSTR pszSelPath	 /*NULL*/,
							  IN CWnd*	 pWndParent	 /*NULL*/,
							  IN UINT	 uFlags		 /*BIF_RETURNONLYFSDIRS*/ )
			 : CCommonDialog( pWndParent )
			 , m_hWnd( NULL )
{	
	ASSERT( AfxIsValidString( pszSelPath, MAX_PATH ) );
	
	::ZeroMemory( &m_bi, sizeof( BROWSEINFO ) );
	::ZeroMemory( m_szFolPath, MAX_PATH );
	::ZeroMemory( m_szSelPath, MAX_PATH );
	
	if( pszSelPath != NULL )
		SetSelectedFolder( pszSelPath );
	
	// Fill data	
	m_bi.hwndOwner	= pWndParent->GetSafeHwnd();
	m_bi.pidlRoot	= NULL;	
	m_bi.lpszTitle	= pszTitle;
	m_bi.ulFlags	= uFlags;
	m_bi.lpfn		= (BFFCALLBACK)BrowseCallbackProc;
	m_bi.lParam		= (LPARAM)this;

	// The size of this buffer is assumed to be MAX_PATH bytes:
	
	m_bi.pszDisplayName = new TCHAR[ MAX_PATH ];
	ASSERT( m_bi.pszDisplayName != NULL );

	::ZeroMemory( m_bi.pszDisplayName, ( MAX_PATH * sizeof( TCHAR ) ) );
}
开发者ID:Zero3K,项目名称:connectfusion,代码行数:31,代码来源:FolderDlg.cpp


示例20: ASSERT

/////////////////////////////////////////////////////////////////////////////
// 输出
/////////////////////////////////////////////////////////////////////////////
void COutputCtrl::vsWrite(LPCTSTR lpszFormat, va_list argList)
{
	ASSERT(AfxIsValidString(lpszFormat, FALSE));

	if(!::IsWindow(m_hWnd))
	{
		return;
	}

	va_list argListSave = argList;
	// make a guess at the maximum length of the resulting string
	int nMaxLen = 0;
	for (LPCTSTR lpsz = lpszFormat; *lpsz != '\0'; lpsz = _tcsinc(lpsz)) {

		// handle '%' character, but watch out for '%%'
		if (*lpsz != '%' || *(lpsz = _tcsinc(lpsz)) == '%') {

			nMaxLen += _tclen(lpsz);
			continue;
		}

		int nItemLen = 0;
		// handle '%' character with format
		int nWidth = 0;
		for (; *lpsz != '\0'; lpsz = _tcsinc(lpsz)) {

			// check for valid flags
			if (*lpsz == '#')
				nMaxLen += 2;   // for '0x'
			else if (*lpsz == '*')
				nWidth = va_arg(argList, int);
			else if (*lpsz == '-' || *lpsz == '+' || *lpsz == '0' ||
				*lpsz == ' ')
				;
			else // hit non-flag character
				break;
		}
		// get width and skip it
		if (nWidth == 0) {

			// width indicated by
			nWidth = _ttoi(lpsz);
			for (; *lpsz != '\0' && _istdigit(*lpsz); lpsz = _tcsinc(lpsz))
				;
		}
		ASSERT(nWidth >= 0);

		int nPrecision = 0;
		if (*lpsz == '.') {

			// skip past '.' separator (width.precision)
			lpsz = _tcsinc(lpsz);

			// get precision and skip it
			if (*lpsz == '*') {

				nPrecision = va_arg(argList, int);
				lpsz = _tcsinc(lpsz);
			}
开发者ID:GFFavourite,项目名称:Script.NET,代码行数:62,代码来源:OutputCtrl.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AfxMessageBox函数代码示例发布时间:2022-05-30
下一篇:
C++ AfxInitExtensionModule函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap