コード例 #1
0
/** A CTS helyzetét frissíti az aktuális mouse coordinátákhoz  **/
void	CircularTextureSelect::UpdatePosition(const int x,const int y) {
	

	_Circle.SetCenter(x,y);										// CTS közepe
	if(_CircleNumbers == 1) {
		_texturePerCurrentCircle = _textureNumbers;
	} else {
		_texturePerCurrentCircle = _textureNumbers - MAX_TEXTURE_PER_CIRCLE * _CurrentCircle;
		if(_texturePerCurrentCircle >= MAX_TEXTURE_PER_CIRCLE) _texturePerCurrentCircle = 6;
	}

	
	float delta_angle = 360 / _texturePerCurrentCircle;				// CTS -en választható textúrák száma
//	float delta_angle = 60;											// probálgatásból marad bent
	for(int i = 0;
		    i < _texturePerCurrentCircle;
			i++) 
	{
				
				_RectSelects[i] = RectFromIndex(i,delta_angle);
		
	}
	UpdateTexturePositions();

}
コード例 #2
0
ファイル: GdiTableVis.cpp プロジェクト: StGlolry/GDIObjDump
LRESULT CALLBACK GdiTableVis::WinProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	HDC         hDC;
    PAINTSTRUCT Ps;
	HBRUSH      tmpBrush;
	RECT rect = { 0 };

	switch(Msg)
	{
	case WM_CREATE:
		break;

	case WM_ERASEBKGND:
		{
			GetClientRect(hWnd, &rect);
			hDC = (HDC)wParam;
			tmpBrush = CreateSolidBrush(COLORREF(RGB(0,0,0)));
			FillRect(hDC, &rect, tmpBrush);
			DeleteObject(tmpBrush);
		}
		break;

	case WM_PAINT:
		{
			GetClientRect(hWnd, &rect);

			hDC = BeginPaint(hWnd, &Ps);
			if(gdiObjectsX64.size() > 0) 
			{
				for (std::vector<GDICELL_64>::iterator iter = gdiObjectsX64.begin(); iter != gdiObjectsX64.end(); ++iter)
				{
						DWORD index = (DWORD)(iter - gdiObjectsX64.begin());
						tmpBrush = CreateSolidBrush(GetCellColor(LOBYTE(iter->wType)));
						// get a RECT from table index
						RectFromIndex(hWnd, index, (DWORD)gdiObjectsX64.size(), &rect, 1);		
						FillRect(hDC, &rect, tmpBrush);
						DeleteObject(tmpBrush);
				}
			}
			EndPaint(hWnd, &Ps);
		}
		break;

	case WM_DESTROY:
		PostQuitMessage(int(lParam));
		break;

	case WM_MOUSEHOVER:
		break;

	case WM_MOUSELEAVE: // The mouse pointer has left our window. Deactivate the tooltip.
		SendMessage(hWndToolTip, TTM_TRACKACTIVATE, (WPARAM)FALSE, (LPARAM)&_toolInfo);
		bTrackingMouse = FALSE;
		ShowWindow(hWndToolTip, SW_HIDE);
		break;

	case WM_MOUSEMOVE:
		{
			static int oldX, oldY;
			int newX, newY;

			if (!bTrackingMouse)   {
				TrackMouse();
				// Activate the tooltip.
				SendMessage(hWndToolTip, TTM_TRACKACTIVATE, (WPARAM)TRUE, (LPARAM)&_toolInfo);
			}
    
			newX = GET_X_LPARAM(lParam);
			newY = GET_Y_LPARAM(lParam);

			// greedy update for tooltip
			if ((newX != oldX) || (newY != oldY))
			{
				DWORD index = CoordToIndex(hWnd, newX, newY, (DWORD)gdiObjectsX64.size());

				if((index > gdiObjectsX64.size()-1) || (gdiObjectsX64.size() == 0)) {
					ShowWindow(hWndToolTip, SW_HIDE);
					break;
				} else {
					ShowWindow(hWndToolTip, SW_SHOW);

					oldX = newX;
					oldY = newY;
            
					WCHAR coords[0x100];
					swprintf_s(coords, ARRAYSIZE(coords), L"%016I64X", gdiObjectsX64.at(index).pKernelAddress);

					_toolInfo.lpszText = coords;
					RECT _rect;
					GetGridRect(hWnd, (DWORD)gdiObjectsX64.size(), &_rect);
					_toolInfo.rect = _rect;
					SendMessage(hWndToolTip, TTM_SETTOOLINFO, 0, (LPARAM)&_toolInfo);

					POINT pt = { newX, newY }; 
					ClientToScreen(hWnd, &pt);
					SendMessage(hWndToolTip, TTM_TRACKPOSITION, 0, (LPARAM)MAKELONG(pt.x + 10, pt.y - 20));
				}
			}
		}
		break;

	case WM_LBUTTONDOWN:
		{
			POINT point;
			GetCursorPos(&point);
			ScreenToClient(hWnd, &point);
			DWORD index = 0;
			if(gdiObjectsX64.size() > 0) {
				index = CoordToIndex(hWnd, point.x, point.y, (DWORD)gdiObjectsX64.size());

				if(index > (DWORD)gdiObjectsX64.size()-1) 
					break;

				DumpBase(index);
			}

		}
		break;

	default:
		return DefWindowProc(hWnd, Msg, wParam, lParam);
	}
	return 0;
}