예제 #1
0
void CHookedWindow::_KillWindow()
{
	if (!_stOldWindowProc && !_stOldRootWindowProc)
		return;

	LogWrite(InstIdx(), "**Exiting main loop**", LT_INFO, __FILE__, __LINE__);

	Console()->UnRegCom("quit");

	_pDelMessageProc->Invoke(TWindowMessage(WMT_CLOSE));
	_pDelMessageProc->Invoke(TWindowMessage(WMT_DESTROY));

	if (!_bNoMloopHook && !ReleaseTimer(_uiUpdateTimer))
		LOG("Can't kill update timer.", LT_ERROR);

	if(
		SetWindowLongPtr(_hWnd, GWLP_WNDPROC, (LONG_PTR)_stOldWindowProc)!=NULL &&
		(_stOldRootWindowProc == NULL || SetWindowLongPtr(_hRootHWnd, GWLP_WNDPROC, (LONG_PTR)_stOldRootWindowProc) != NULL)
		)
		LOG("Window controls message hooks unset successfully.", LT_INFO);
	else 
		LOG("Can't unset window control message hooks.", LT_ERROR);

	_stOldWindowProc = NULL;
	_stOldRootWindowProc = NULL;

	_pDelMessageProc->Invoke(TWindowMessage(WMT_RELEASED));
}
예제 #2
0
DGLE_RESULT CDummyWindow::KillWindow()
{
    _pDelMessageProc->Invoke(TWindowMessage(WMT_DESTROY));
    _pDelMessageProc->Invoke(TWindowMessage(WMT_RELEASED));

    return S_OK;
}
예제 #3
0
DGLE_RESULT CHookedWindow::BeginMainLoop()
{
	if (!_hWnd)
		return E_FAIL;

	if (!_stOldWindowProc && !_stOldRootWindowProc)
		return E_FAIL;

	if (!_bNoMloopHook && (_uiUpdateTimer = CreateTimer(USER_TIMER_MINIMUM, _pDelMainLoop), _uiUpdateTimer == -1))
	{
		LOG("Can't set update timer.", LT_FATAL);
		return E_ABORT;
	}

	RECT rect;
	
	if (GetClientRect(_hWnd, &rect) == FALSE)
		LOG("Can't get window client rectangle.", LT_FATAL);
	
	_pDelMessageProc->Invoke(TWindowMessage(WMT_SIZE, rect.right, rect.bottom));

	LOG("**Entering main loop**",LT_INFO);

	return S_OK;
}