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


C++ AfxIsValidString函数代码示例

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


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


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