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


C++ Attach函数代码示例

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


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

示例1: _ASSERT_VALID

// Constructor. Initializes to a handle.
ClsDC::ClsDC( HDC hDC )
{
	_ASSERT_VALID( hDC ); // Must be valid.

	// Clear handle.
	m_hDC = NULL;

	// Attach the handle.
	Attach( hDC );

	// Add us to the global list.
	global_dc_list.AddHead( this );
}
开发者ID:jcbaar,项目名称:ClassLib,代码行数:14,代码来源:dc.cpp

示例2: GetWindowsDirectory

CSysImageList::CSysImageList()
{
	SHFILEINFO ssfi;
	TCHAR windir[MAX_PATH];
	GetWindowsDirectory(windir, _countof(windir));  // MAX_PATH ok.
	HIMAGELIST hSystemImageList =
		(HIMAGELIST)SHGetFileInfo(
			windir,
			0,
			&ssfi, sizeof ssfi,
			SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
	Attach(hSystemImageList);
}
开发者ID:chengn,项目名称:TortoiseGit,代码行数:13,代码来源:SysImageList.cpp

示例3: Attach

void Transmogrify::Spawn(float duration, int targetUUID)
{
	mDuration = duration;

	for (Explorer& e : Factory<Explorer>())
	{
		// Only affects clients who are not the target
		if (e.mNetworkID->mUUID == targetUUID && !e.mNetworkID->mHasAuthority)
		{
			Attach(&e);
		}
	}
}
开发者ID:igm-capstone,项目名称:capstone-game-cpp,代码行数:13,代码来源:Transmogrify.cpp

示例4: getprotobyname

SOCKET Socket::CreateSocket(int af,int type, const std::string& protocol)
{
	struct protoent *p = NULL;
	SOCKET s;

#ifdef ENABLE_POOL
	m_socket_type = type;
	m_socket_protocol = protocol;
#endif
	if (protocol.size())
	{
		p = getprotobyname( protocol.c_str() );
		if (!p)
		{
			Handler().LogError(this, "getprotobyname", Errno, StrError(Errno), LOG_LEVEL_FATAL);
			SetCloseAndDelete();
#ifdef ENABLE_EXCEPTIONS
			throw Exception(std::string("getprotobyname() failed: ") + StrError(Errno));
#endif
			return INVALID_SOCKET;
		}
	}
	int protno = p ? p -> p_proto : 0;

	s = socket(af, type, protno);
	if (s == INVALID_SOCKET)
	{
		Handler().LogError(this, "socket", Errno, StrError(Errno), LOG_LEVEL_FATAL);
		SetCloseAndDelete();
#ifdef ENABLE_EXCEPTIONS
		throw Exception(std::string("socket() failed: ") + StrError(Errno));
#endif
		return INVALID_SOCKET;
	}
	Attach(s);
	OnOptions(af, type, protno, s);
	Attach(INVALID_SOCKET);
	return s;
}
开发者ID:Omniasoft,项目名称:BellPi,代码行数:39,代码来源:Socket.cpp

示例5: Attach

HRESULT Kernel::GetWaitChainInfo(WaitSnapshot& snapshot)
{
	_pCurrentSnapshot = &snapshot;
	HRESULT hr = Attach();
	if(SUCCEEDED(hr))
	{
		snapshot.Initialize(_KProcess, _OSProcessId);
		hr = ProcessHandles();
		hr = ProcessThreadWaitList();
	}
	_pCurrentSnapshot = NULL;
	return hr;
}
开发者ID:Sequential,项目名称:DebugInspector,代码行数:13,代码来源:Kernel.cpp

示例6: LKASSERT

void LKWindowSurface::Create(Window& Wnd){
#ifdef WIN32
    HWND hWnd = Wnd.Handle();
    LKASSERT(hWnd);
    LKASSERT(::IsWindow(hWnd));

    if(!Attach(::GetDC(hWnd))) {
        LKASSERT(false);
    }
#else
    _pCanvas = new WindowCanvas(Wnd);
#endif
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:13,代码来源:LKWindowSurface.cpp

示例7: switch

// open the file
bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
{
    int flags = O_BINARY;

    switch ( mode )
    {
        case read:
            flags |= O_RDONLY;
            break;

        case write_append:
            if ( wxFile::Exists(szFileName) )
            {
                flags |= O_WRONLY | O_APPEND;
                break;
            }
            //else: fall through as write_append is the same as write if the
            //      file doesn't exist

        case write:
            flags |= O_WRONLY | O_CREAT | O_TRUNC;
            break;

        case write_excl:
            flags |= O_WRONLY | O_CREAT | O_EXCL;
            break;

        case read_write:
            flags |= O_RDWR;
            break;
    }

#ifdef __WINDOWS__
    // only read/write bits for "all" are supported by this function under
    // Windows, and VC++ 8 returns EINVAL if any other bits are used in
    // accessMode, so clear them as they have at best no effect anyhow
    accessMode &= wxS_IRUSR | wxS_IWUSR;
#endif // __WINDOWS__

    int fd = wxOpen( szFileName, flags ACCESS(accessMode));

    if ( fd == -1 )
    {
        wxLogSysError(_("can't open file '%s'"), szFileName);
        return false;
    }
    else {
        Attach(fd);
        return true;
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:52,代码来源:file.cpp

示例8: Close

    Handle& Handle::operator=(Handle& h)
    {
        if (mHandle_ != h)
        {
            if (NULL != mHandle_)
            {
                Close();
            }

            Attach(h.Detach());
        }

        return *this;
    }
开发者ID:crezul,项目名称:my-self-education-sync-lib,代码行数:14,代码来源:Handle.cpp

示例9: Attach

///////////////////////////////////////////////////////////////////////////////
// AttachFromVariant: Attach a Variant SafeArray
bool CSafeArrayHelper::AttachFromVariant(VARIANT* pVariant)
{
	if (NULL != pVariant)
	{
		if (pVariant->vt & VT_ARRAY)
		{
			LPSAFEARRAY psa = pVariant->parray;
			if (pVariant->vt & VT_BYREF)	// VB use this...
				psa = *pVariant->pparray;
			return Attach( psa );
		}
	}
	return false;
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:16,代码来源:SafeArrayHelper.cpp

示例10: parentMatrix

DemoEntity::DemoEntity(DemoEntityManager& world, const dScene* scene, dScene::dTreeNode* rootSceneNode, dTree<DemoMesh*, dScene::dTreeNode*>& 	 	meshCache, DemoEntityManager::EntityDictionary& entityDictionary, DemoEntity* parent)
	:dClassInfo()
	,dHierarchy<DemoEntity>() 
	,m_matrix(GetIdentityMatrix()) 
	,m_curPosition (0.0f, 0.0f, 0.0f, 1.0f)
	,m_nextPosition (0.0f, 0.0f, 0.0f, 1.0f)
	,m_curRotation (1.0f, 0.0f, 0.0f, 0.0f)
	,m_nextRotation (1.0f, 0.0f, 0.0f, 0.0f)
	,m_lock (0)
	,m_mesh (NULL)
{
	// add this entity to the dictionary
	entityDictionary.Insert(this, rootSceneNode);

	// if this is a child mesh set it as child of th entity
	dMatrix parentMatrix (GetIdentityMatrix());
	if (parent) {
		Attach (parent);

		dScene::dTreeNode* parentNode = scene->FindParentByType(rootSceneNode, dSceneNodeInfo::GetRttiType());
		dSceneNodeInfo* parentInfo = (dSceneNodeInfo*) parentNode;
		parentMatrix = parentInfo->GetTransform();
	}

	dSceneNodeInfo* info = (dSceneNodeInfo*) scene->GetInfoFromNode (rootSceneNode);
//	SetMatrix(info->GetTransform() * parentMatrix.Inverse4x4());
	dMatrix matrix (info->GetTransform() * parentMatrix.Inverse4x4());
	dQuaternion rot (matrix);

	// set the matrix twice in oder to get cur and next position
	SetMatrix(world, rot, matrix.m_posit);
	SetMatrix(world, rot, matrix.m_posit);


	// if this node has a mesh, find it and attach it to this entity
	dScene::dTreeNode* meshNode = scene->FindChildByType(rootSceneNode, dMeshNodeInfo::GetRttiType());
	if (meshNode) {
		DemoMesh* mesh = meshCache.Find(meshNode)->GetInfo();
		SetMesh(mesh);
	}

	// add all of the children nodes as child nodes
	for (void* child = scene->GetFirstChild(rootSceneNode); child; child = scene->GetNextChild (rootSceneNode, child)) {
		dScene::dTreeNode* node = scene->GetNodeFromLink(child);
		dNodeInfo* info = scene->GetInfoFromNode(node);
		if (info->GetTypeId() == dSceneNodeInfo::GetRttiType()) {
			new DemoEntity (world, scene, node, meshCache, entityDictionary, this);
		}
	}
}
开发者ID:Naddiseo,项目名称:Newton-Dynamics-fork,代码行数:50,代码来源:DemoEntity.cpp

示例11: Create

    __checkReturn HRESULT Create(__in DWORD threadCount)
    {
        Attach(::CreateIoCompletionPort(INVALID_HANDLE_VALUE,
                                        0, // no existing port
                                        0, // ignored
                                        threadCount));

        if (0 == m_h)
        {
            return HRESULT_FROM_WIN32(::GetLastError());
        }

        return S_OK;
    }
开发者ID:daewoolanos,项目名称:gwca,代码行数:14,代码来源:Communicator.cpp

示例12: xSemaphoreCreateMutex

bool CMutex::Create() {

#if ( configUSE_MUTEXES == 1 )

	SemaphoreHandle_t handle;

	handle = xSemaphoreCreateMutex();

	if (handle != NULL)
		Attach(handle);
#endif

	return IsValid();
}
开发者ID:dessel,项目名称:stf12,代码行数:14,代码来源:CMutex.cpp

示例13: AttachBlackOfScreen

    ///////////////////////////////////////////////////////////////////////
    ///  Function: AttachBlackOfScreen
    ///
    ///    Author: $author$
    ///      Date: 2/8/2013
    ///////////////////////////////////////////////////////////////////////
    virtual XosError AttachBlackOfScreen(Screen* xScreen, bool onlyFreed=false) 
    {
        XosError error = XOS_ERROR_FAILED;
        XosError error2;

        if ((error2 = Freed(onlyFreed)))
            return error2;

        if ((xScreen)) {
            Attach(XBlackPixelOfScreen(xScreen));
            error = XOS_ERROR_NONE;
        }
        return error;
    }
开发者ID:medusade,项目名称:mxde,代码行数:20,代码来源:XosXColor.hpp

示例14: Printf

int ProfilerHandler::Load() {
  amx_path_ = fileutils::ToUnixPath(amx_path_finder_->Find(amx()));
  amx_name_ = fileutils::GetDirectory(amx_path_)
            + "/"
            + fileutils::GetBaseName(amx_path_);

  if (amx_path_.empty()) {
    Printf("Could not find AMX file (try setting AMX_PATH?)");
  }
  if (ShouldBeProfiled(amx_path_)) {
    Attach();
  }
  return AMX_ERR_NONE;
}
开发者ID:Zeex,项目名称:samp-plugin-profiler,代码行数:14,代码来源:profilerhandler.cpp

示例15: Initialize

    HRESULT Initialize(PCWSTR serverName,
                       INTERNET_PORT portNumber,
                       const WinHttpSession& session)
    {
        if (!Attach(::WinHttpConnect(session.m_handle,
                                     serverName,
                                     portNumber,
                                     0))) // reserved
        {
            return HRESULT_FROM_WIN32(::GetLastError());
        }

        return S_OK;
    }
开发者ID:vit2000005,项目名称:happy_trader,代码行数:14,代码来源:wininetwrap.hpp


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