當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。