本文整理汇总了C++中MMap::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ MMap::Set方法的具体用法?C++ MMap::Set怎么用?C++ MMap::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MMap
的用法示例。
在下文中一共展示了MMap::Set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCreateFinished
bool CFindPanel::OnCreateFinished()
{
RECT rcClient = {};
OnSize(&rcClient);
if (!mh_Edit)
{
mh_Edit = CreateWindowEx(WS_EX_CLIENTEDGE,
L"EDIT", L"",
WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_WANTRETURN,
rcClient.left, rcClient.top, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top,
mh_Pane, (HMENU)SearchCtrlId, NULL, NULL);
if (!mh_Edit)
{
return false;
}
g_FindMap.Set(mh_Edit, this);
OnCreateFont();
mfn_EditProc = (WNDPROC)SetWindowLongPtr(mh_Edit, GWLP_WNDPROC, (LONG_PTR)EditCtrlProc);
EditIconHint_Set(mh_Pane, mh_Edit, true, SearchHint, false, UM_SEARCH, 0);
}
return true;
}
示例2: OnCreateThread
// ssh (msysgit) crash issue. Need to know if thread was started by application but not remotely.
HANDLE WINAPI OnCreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
{
//typedef HANDLE(WINAPI* OnCreateThread_t)(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
ORIGINAL_KRNL(CreateThread);
DWORD nTemp = 0;
LPDWORD pThreadID = lpThreadId ? lpThreadId : &nTemp;
HANDLE hThread = F(CreateThread)(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, pThreadID);
if (hThread)
gStartedThreads.Set(*pThreadID,true);
return hThread;
}
示例3: sizeof
/* Uniqualizer for Each tab */
CTabID::CTabID(CVirtualConsole* apVCon, LPCWSTR asName, CEFarWindowType anType, int anPID, int anFarWindowID, int anViewEditID)
{
memset(&Info, 0, sizeof(Info));
memset(&DrawInfo, 0, sizeof(DrawInfo));
Info.pVCon = apVCon;
Set(asName, anType, anPID, anFarWindowID, anViewEditID);
#ifdef DEBUG_TAB_LIST
if (!bTabIdListInit)
{
gTabIdList.Init(256,true);
bTabIdListInit = true;
}
gTabIdList.Set(this, true);
#endif
}
示例4: Update
void CTabBarClass::Update(BOOL abPosted/*=FALSE*/)
{
#ifdef _DEBUG
if (this != gpConEmu->mp_TabBar)
{
_ASSERTE(this == gpConEmu->mp_TabBar);
}
#endif
MCHKHEAP
/*if (!_active)
{
return;
}*/ // Теперь - ВСЕГДА! т.к. сами управляем мультиконсолью
if (mb_DisableRedraw)
{
_ASSERTE(FALSE && "mb_DisableRedraw?"); // Надо?
return;
}
if (!isMainThread())
{
RequestPostUpdate();
return;
}
gpConEmu->mp_Status->UpdateStatusBar();
mb_PostUpdateCalled = FALSE;
#ifdef _DEBUG
_ASSERTE(mn_InUpdate >= 0);
if (mn_InUpdate > 0)
{
_ASSERTE(mn_InUpdate == 0);
}
#endif
mn_InUpdate ++;
MCHKHEAP
int V, I, tabIdx = 0, nCurTab = -1;
BOOL bShowFarWindows = gpSet->bShowFarWindows;
// Выполняться должно только в основной нити, так что CriticalSection не нужна
#ifdef _DEBUG
if (this != gpConEmu->mp_TabBar)
{
_ASSERTE(this == gpConEmu->mp_TabBar);
}
#endif
TODO("Обработка gpSet->bHideInactiveConsoleTabs для новых табов");
MCHKHEAP
// Check if we need to AutoSHOW or AutoHIDE tab bar
if (!IsTabsActive() && gpSet->isTabs)
{
int nTabs = CountActiveTabs(2);
if (nTabs > 1)
{
Activate();
}
}
else if (IsTabsActive() && gpSet->isTabs==2)
{
int nTabs = CountActiveTabs(2);
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++)
//.........这里部分代码省略.........
示例5: 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:
//.........这里部分代码省略.........
示例6: 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);
//.........这里部分代码省略.........
示例7: OnCreate
bool CFindPanel::OnCreate(CREATESTRUCT* ps)
{
g_FindMap.Set(mh_Pane, this);
return true;
}
示例8: 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;
}
示例9: 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
}
//.........这里部分代码省略.........