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


C++ MMap::Get方法代码示例

本文整理汇总了C++中MMap::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ MMap::Get方法的具体用法?C++ MMap::Get怎么用?C++ MMap::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MMap的用法示例。


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

示例1: EditCtrlProc

LRESULT CFindPanel::EditCtrlProc(HWND hCtrl, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRc = 0;
	CFindPanel* pPanel = NULL;
	g_FindMap.Get(hCtrl, &pPanel);

	if (pPanel) switch (uMsg)
	{
	case WM_KEYDOWN:
	case WM_KEYUP:
	case WM_SYSKEYDOWN:
	case WM_SYSKEYUP:
	case WM_CHAR:
		if (pPanel->OnKeyboard(uMsg, wParam, lParam, lRc))
			goto wrap;
		break;
	case WM_RBUTTONDOWN:
	case WM_RBUTTONUP:
		if (uMsg == WM_RBUTTONUP)
			pPanel->ShowMenu();
		goto wrap;
	}

	if (pPanel && pPanel->mfn_EditProc)
		lRc = ::CallWindowProc(pPanel->mfn_EditProc, hCtrl, uMsg, wParam, lParam);
	else
		lRc = ::DefWindowProc(hCtrl, uMsg, wParam, lParam);
wrap:
	return lRc;
}
开发者ID:Alexander-Shukaev,项目名称:ConEmu,代码行数:30,代码来源:FindPanel.cpp

示例2: Update


//.........这里部分代码省略.........
		if (nTabs <= 1)
		{
			Deactivate();
		}
	}


	// Validation?
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif



	MCHKHEAP
	HANDLE hUpdate = m_Tabs.UpdateBegin();
	_ASSERTE(hUpdate!=NULL);

	bool bStackChanged = false;

	/* ********************* */
	/*          Go           */
	/* ********************* */
	{
		MMap<CVConGroup*,CVirtualConsole*> Groups; Groups.Init(MAX_CONSOLE_COUNT, true);

		for (V = 0; V < MAX_CONSOLE_COUNT; V++)
		{
			//if (!(pVCon = gpConEmu->GetVCon(V))) continue;
			CVConGuard guard;
			if (!CVConGroup::GetVCon(V, &guard))
				continue;
			CVirtualConsole* pVCon = guard.VCon();

			BOOL lbActive = pVCon->isActive(false);

			if (gpSet->bHideInactiveConsoleTabs && !lbActive)
				continue;

			if (gpSet->isOneTabPerGroup)
			{
				CVConGroup *pGr;
				CVConGuard VGrActive;
				if (CVConGroup::isGroup(pVCon, &pGr, &VGrActive))
				{
					CVirtualConsole* pGrVCon;

					if (Groups.Get(pGr, &pGrVCon))
						continue; // эта группа уже есть

					pGrVCon = VGrActive.VCon();
					Groups.Set(pGr, pGrVCon);

					// И показывать таб нужно от "активной" консоли, а не от первой в группе
					if (pVCon != pGrVCon)
					{
						guard = pGrVCon;
						pVCon = pGrVCon;
					}

					if (!lbActive)
					{
						lbActive = pVCon->isActive(true);
开发者ID:negadj,项目名称:ConEmu,代码行数:67,代码来源:TabBar.cpp

示例3: BackWndProc

LRESULT CConEmuChild::BackWndProc(HWND hWnd, UINT messg, WPARAM wParam, LPARAM lParam)
{
	LRESULT result = 0;

	// Logger
	MSG msgStr = {hWnd, messg, wParam, lParam};
	ConEmuMsgLogger::Log(msgStr, ConEmuMsgLogger::msgBack);

	if (gpSetCls->isAdvLogging >= 4)
	{
		gpConEmu->LogMessage(hWnd, messg, wParam, lParam);
	}

	CVConGuard guard;
	CVirtualConsole* pVCon = NULL;
	if (messg == WM_CREATE || messg == WM_NCCREATE)
	{
		LPCREATESTRUCT lp = (LPCREATESTRUCT)lParam;
		guard = (CVirtualConsole*)lp->lpCreateParams;
		pVCon = guard.VCon();
		if (pVCon)
			gVConBkMap.Set(hWnd, pVCon);
	}
	else if (hWnd != ghBkInDestroing)
	{
		if (!gVConBkMap.Get(hWnd, &pVCon) || !guard.Attach(pVCon))
			pVCon = NULL;
	}

	if (messg == WM_SYSCHAR)
	{
		_ASSERTE(FALSE); // по идее, фокуса тут быть не должно
		// Чтобы не пищало
		result = TRUE;
		goto wrap;
	}

	if (!pVCon)
	{
		_ASSERTE(pVCon!=NULL || hWnd==ghBkInDestroing);
		result = DefWindowProc(hWnd, messg, wParam, lParam);
		goto wrap;
	}

	switch (messg)
	{
	case WM_SHOWWINDOW:
			if (wParam)
			{
				HWND hView = pVCon->GetView();
				SetWindowPos(hView, HWND_TOP, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
				SetWindowPos(hWnd, hView, 0, 0, 0,0, SWP_NOSIZE|SWP_NOMOVE);
			}
			break; // DefaultProc
		case WM_SETFOCUS:
			// Если в консоли работает "GUI" окно (GUI режим), то фокус нужно отдать туда.
			{
				// Фокус должен быть в главном окне! За исключением случая работы в GUI режиме.
				pVCon->setFocus();
			}
			return 0;
		case WM_ERASEBKGND:
			result = 0;
			break;
		case WM_PAINT:
			_ASSERTE(hWnd == pVCon->mh_WndBack);
			pVCon->OnPaintGaps();
			break;
		case WM_KEYDOWN:
		case WM_KEYUP:
		case WM_SYSKEYDOWN:
		case WM_SYSKEYUP:
		case WM_MOUSEWHEEL:
		case WM_ACTIVATE:
		case WM_ACTIVATEAPP:
			//case WM_MOUSEACTIVATE:
		case WM_KILLFOCUS:
			//case WM_SETFOCUS:
		case WM_MOUSEMOVE:
		case WM_RBUTTONDOWN:
		case WM_RBUTTONUP:
		case WM_MBUTTONDOWN:
		case WM_MBUTTONUP:
		case WM_LBUTTONDOWN:
		case WM_LBUTTONUP:
		case WM_LBUTTONDBLCLK:
		case WM_MBUTTONDBLCLK:
		case WM_RBUTTONDBLCLK:
		case WM_XBUTTONDOWN:
		case WM_XBUTTONUP:
		case WM_XBUTTONDBLCLK:
		case WM_VSCROLL:
			// Вся обработка в родителе
			{
				switch (messg)
				{
					case WM_VSCROLL:
						switch (LOWORD(wParam))
						{
						case SB_THUMBTRACK:
//.........这里部分代码省略.........
开发者ID:havocbane,项目名称:ConEmu,代码行数:101,代码来源:VConChild.cpp

示例4: ChildWndProc

LRESULT CConEmuChild::ChildWndProc(HWND hWnd, UINT messg, WPARAM wParam, LPARAM lParam)
{
	LRESULT result = 0;

	// Logger
	MSG msgStr = {hWnd, messg, wParam, lParam};
	ConEmuMsgLogger::Log(msgStr, ConEmuMsgLogger::msgCanvas);

	if (gpSetCls->isAdvLogging >= 4)
	{
		gpConEmu->LogMessage(hWnd, messg, wParam, lParam);
	}

	CVConGuard guard;
	CVirtualConsole* pVCon = NULL;
	if (messg == WM_CREATE || messg == WM_NCCREATE)
	{
		LPCREATESTRUCT lp = (LPCREATESTRUCT)lParam;
		guard = (CVirtualConsole*)lp->lpCreateParams;
		pVCon = guard.VCon();
		if (pVCon)
		{
			gVConDcMap.Set(hWnd, pVCon);

			pVCon->m_TAutoCopy.Init(hWnd, TIMER_AUTOCOPY, TIMER_AUTOCOPY_DELAY);

			pVCon->m_TScrollShow.Init(hWnd, TIMER_SCROLL_SHOW, TIMER_SCROLL_SHOW_DELAY);
			pVCon->m_TScrollHide.Init(hWnd, TIMER_SCROLL_HIDE, TIMER_SCROLL_HIDE_DELAY);
			#ifndef SKIP_HIDE_TIMER
			pVCon->m_TScrollCheck.Init(hWnd, TIMER_SCROLL_CHECK, TIMER_SCROLL_CHECK_DELAY);
			#endif
		}
	}
	else if (hWnd != ghDcInDestroing)
	{
		if (!gVConDcMap.Get(hWnd, &pVCon) || !guard.Attach(pVCon))
			pVCon = NULL;
	}


	if (messg == WM_SYSCHAR)
	{
		_ASSERTE(FALSE); // по идее, фокуса тут быть не должно
		// Чтобы не пищало
		result = TRUE;
		goto wrap;
	}

	if (!pVCon)
	{
		_ASSERTE(pVCon!=NULL || hWnd==ghDcInDestroing);
		result = DefWindowProc(hWnd, messg, wParam, lParam);
		goto wrap;
	}

	switch (messg)
	{
		case WM_SHOWWINDOW:
			{
				#ifdef _DEBUG
				HWND hGui = pVCon->GuiWnd();
				if (hGui)
				{
					_ASSERTE(((wParam==0) || pVCon->RCon()->isGuiForceConView()) && "Show DC while GuiWnd exists");
				}
				#endif
				result = DefWindowProc(hWnd, messg, wParam, lParam);
				break;
			}
		case WM_SETFOCUS:
			// Если в консоли работает "GUI" окно (GUI режим), то фокус нужно отдать туда.
			{
				// Фокус должен быть в главном окне! За исключением случая работы в GUI режиме.
				pVCon->setFocus();
			}
			return 0;
		case WM_ERASEBKGND:
			result = 0;
			break;
		case WM_PAINT:
			result = pVCon->OnPaint();
			break;
		case WM_PRINTCLIENT:
			if (wParam && (lParam & PRF_CLIENT))
			{
				pVCon->PrintClient((HDC)wParam, false, NULL);
			}
			break;
		case WM_SIZE:
			#ifdef _DEBUG
			{
				RECT rc; GetClientRect(hWnd, &rc);
				short cx = LOWORD(lParam);
				rc.left = rc.left;
			}
			#endif
			result = pVCon->OnSize(wParam, lParam);
			break;
		case WM_MOVE:
			result = pVCon->OnMove(wParam, lParam);
//.........这里部分代码省略.........
开发者ID:havocbane,项目名称:ConEmu,代码行数:101,代码来源:VConChild.cpp

示例5: FindPaneProc

LRESULT CFindPanel::FindPaneProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	INT_PTR lRc = 0;
	CFindPanel* pPanel = NULL;
	RECT rcClient = {};

	if (uMsg == WM_CREATE)
	{
		if (lParam && ((CREATESTRUCT*)lParam)->lpCreateParams)
		{
			pPanel = (CFindPanel*)((CREATESTRUCT*)lParam)->lpCreateParams;
			pPanel->mh_Pane = hWnd;
		}
	}
	else
	{
		g_FindMap.Get(hWnd, &pPanel);
	}

	if (pPanel && EditIconHint_Process(hWnd, uMsg, wParam, lParam, lRc))
	{
		return lRc;
	}

	switch (uMsg)
	{
	case WM_CREATE:
		if (!pPanel || !((CFindPanel*)((CREATESTRUCT*)lParam)->lpCreateParams)->OnCreate((CREATESTRUCT*)lParam))
		{
			lRc = -1;
			goto wrap;
		}
		break;

	case WM_COMMAND:
		switch (HIWORD(wParam))
		{
		case BN_CLICKED:
			goto wrap;
		}
		break;

	case WM_WINDOWPOSCHANGING:
		if (pPanel)
			pPanel->OnWindowPosChanging((WINDOWPOS*)lParam);
		break;

	case WM_SIZE:
	case WM_MOVE:
		if (pPanel)
			pPanel->OnSize(NULL);
		break;

	case WM_DESTROY:
		if (pPanel)
			pPanel->OnDestroy();
		break;

	case UM_SEARCH:
		if (pPanel)
			pPanel->OnSearch();
		break;
	}

	lRc = ::DefWindowProc(hWnd, uMsg, wParam, lParam);
wrap:
	return lRc;
}
开发者ID:Alexander-Shukaev,项目名称:ConEmu,代码行数:68,代码来源:FindPanel.cpp

示例6: GetMainThreadId

/// Returns ThreadID of main thread
///
/// If the process was started by standard ConEmuC/ConEmuHk functions,
/// this function is called with (bUseCurrentAsMain==true) from DllMain.
/// Otherwise we must enumerate **all** processes in system, there is no
/// way to enumerate only current process threads unfortunately.
/// Also, enumerating threads may cause noticeable lags, but we can't
/// do anything with that... However, this is rare situation, and in most
/// cases main thread ID is initialized with (bUseCurrentAsMain==true).
DWORD GetMainThreadId(bool bUseCurrentAsMain)
{
	// Найти ID основной нити
	if (!gnHookMainThreadId)
	{
		if (bUseCurrentAsMain)
		{
			// Only one thread is expected at the moment
			gnHookMainThreadId = GetCurrentThreadId();
		}
		else
		{
			DWORD dwPID = GetCurrentProcessId();

			#ifdef FORCE_GETMAINTHREAD_PRINTF
			wchar_t szInfo[160], szTail[32];
			msprintf(szInfo, countof(szInfo), L"\x1B[1;31;40m" L"*** [PID=%u %s] GetMainThreadId is using CreateToolhelp32Snapshot", dwPID, gsExeName);
			wcscpy_c(szTail, L"\x1B[1;31;40m" L" ***" L"\x1B[0m" L"\n");
			WriteProcessed2(szInfo, wcslen(szInfo), NULL, wps_Error);
			#endif

			// Unfortunately, dwPID is ignored in TH32CS_SNAPTHREAD
			HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, dwPID);

			if (snapshot != INVALID_HANDLE_VALUE)
			{
				THREADENTRY32 module = {sizeof(THREADENTRY32)};

				if (Thread32First(snapshot, &module))
				{
					// Don't stop enumeration on first thread, populate gStartedThreads
					do
					{
						if (module.th32OwnerProcessID == dwPID)
						{
							DWORD nTID = module.th32ThreadID;

							if (!gnHookMainThreadId)
								gnHookMainThreadId = nTID;

							if (!gStartedThreads.Get(nTID, NULL))
								gStartedThreads.Set(nTID, FALSE);
						}

					} while (Thread32Next(snapshot, &module));
				}

				CloseHandle(snapshot);
			}

			#ifdef FORCE_GETMAINTHREAD_PRINTF
			WriteProcessed2(szTail, wcslen(szTail), NULL, wps_Error);
			#endif
		}
	}

	#ifdef _DEBUG
	char szInfo[100];
	msprintf(szInfo, countof(szInfo), "GetMainThreadId()=%u, TID=%u\n", gnHookMainThreadId, GetCurrentThreadId());
	//OutputDebugStringA(szInfo);
	#endif

	_ASSERTE(gnHookMainThreadId!=0);
	return gnHookMainThreadId;
}
开发者ID:davgit,项目名称:ConEmu,代码行数:74,代码来源:MainThread.cpp

示例7: FixSshThreads

/// Workaround for cygwin's ssh crash when third-party hooking application exists
void FixSshThreads(int iStep)
{
	DLOG0("FixSshThreads",iStep);

	#ifdef _DEBUG
	char szInfo[120]; DWORD nErr;
	msprintf(szInfo, countof(szInfo), "FixSshThreads(%u) started\n", iStep);
	if (!(gnDllState & ds_DllProcessDetach)) OutputDebugStringA(szInfo);
	#endif

	switch (iStep)
	{
		// Resume suspended threads
		case 1:
		{
			// Was initialized?
			if (!pThInfo)
				break;
			// May occurs in several threads simultaneously
			long n = InterlockedIncrement(&gnFixSshThreadsResumeOk);
			if (n > 1)
				break;
			// Resume all suspended...
			for (INT_PTR i = 0; i < pThInfo->size(); i++)
				ResumeThread((*pThInfo)[i].hThread);
			break;
		}

		// Suspend all third-party threads
		case 0:
		{
			_ASSERTEX(gnHookMainThreadId!=0);
			pThInfo = new MArray<ThInfoStr>;
			HANDLE hThread = NULL, hSnap = NULL;
			DWORD nTID = 0, dwPID = GetCurrentProcessId();
			HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, dwPID);
			if (snapshot == INVALID_HANDLE_VALUE)
			{
				#ifdef _DEBUG
				nErr = GetLastError();
				msprintf(szInfo, countof(szInfo), "CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD) failed in FixSshThreads, code=%u\n", nErr);
				if (!(gnDllState & ds_DllProcessDetach)) OutputDebugStringA(szInfo);
				#endif
			}
			else
			{
				THREADENTRY32 module = {sizeof(THREADENTRY32)};
				if (!Thread32First(snapshot, &module))
				{
					#ifdef _DEBUG
					nErr = GetLastError();
					msprintf(szInfo, countof(szInfo), "Thread32First failed in FixSshThreads, code=%u\n", nErr);
					if (!(gnDllState & ds_DllProcessDetach)) OutputDebugStringA(szInfo);
					#endif
				}
				else do
				{
					if ((module.th32OwnerProcessID == dwPID) && (gnHookMainThreadId != module.th32ThreadID))
					{
						// JIC, add thread ID to our list.
						// In theory, all thread must be already initialized
						// either from DLL_THREAD_ATTACH, or from GetMainThreadId.
						if (!gStartedThreads.Get(module.th32ThreadID, NULL))
							gStartedThreads.Set(module.th32ThreadID, FALSE);

						// Don't freeze our own threads
						if (gpHookServer && gpHookServer->IsPipeThread(module.th32ThreadID))
							continue;

						hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, module.th32ThreadID);
						if (!hThread)
						{
							#ifdef _DEBUG
							nErr = GetLastError();
							msprintf(szInfo, countof(szInfo), "OpenThread(%u) failed in FixSshThreads, code=%u\n", module.th32ThreadID, nErr);
							if (!(gnDllState & ds_DllProcessDetach)) OutputDebugStringA(szInfo);
							#endif
						}
						else
						{
							DWORD nSC = SuspendThread(hThread);
							if (nSC == (DWORD)-1)
							{
								// Error!
								#ifdef _DEBUG
								nErr = GetLastError();
								msprintf(szInfo, countof(szInfo), "SuspendThread(%u) failed in FixSshThreads, code=%u\n", module.th32ThreadID, nErr);
								if (!(gnDllState & ds_DllProcessDetach)) OutputDebugStringA(szInfo);
								#endif
							}
							else
							{
								ThInfoStr th = {module.th32ThreadID, hThread};
								pThInfo->push_back(th);
								#ifdef _DEBUG
								msprintf(szInfo, countof(szInfo), "Thread %u was suspended\n", module.th32ThreadID);
								if (!(gnDllState & ds_DllProcessDetach)) OutputDebugStringA(szInfo);
								#endif
							}
//.........这里部分代码省略.........
开发者ID:davgit,项目名称:ConEmu,代码行数:101,代码来源:MainThread.cpp


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