Пример #1
0
CPerfMeter::CPerfMeter(HWND hDlg, HWND hCtrl)
{
	m_hParentDlg = hDlg;
	m_hControlID = hCtrl;
	m_nPercentage = 0;

	// Mimick Task Manager default colors
	SetActiveColor( RGB(0, 255, 0) );
	SetInactiveColor( RGB(0, 128, 64) );
	SetBars( 2 );
}
Пример #2
0
void CSShadow::Create(HWND hWnd)
{
	DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
	m_bSizable = dwStyle & WS_SIZEBOX;
	m_bMinable = dwStyle & WS_MINIMIZEBOX;
	m_bMaxable = dwStyle & WS_MAXIMIZEBOX;
	
	WNDCLASSEX wcex;
	wcex.cbSize			= sizeof(WNDCLASSEX); 
	wcex.style			= CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc	= (WNDPROC)WndProc;
	wcex.cbClsExtra		= 0;
	wcex.cbWndExtra		= 0;
	wcex.hInstance		= 0;
	wcex.hIcon			= NULL;
	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
	wcex.lpszMenuName	= NULL;
	wcex.lpszClassName	= _T("CSThemeShadowWindow");
	wcex.hIconSm		= NULL;
	RegisterClassEx(&wcex);

	m_hWnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_TOOLWINDOW, _T("CSThemeShadowWindow"), _T(""),
		WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SIZEBOX | WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_BORDER, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, 0, NULL);

	SetProp(m_hWnd, _T("CSThemeShadowWindow"), (HANDLE)this);

	m_hWnd_parent = hWnd;
	ShowWindow(m_hWnd, SW_SHOW);

	// Configure GDI+
	GdiplusStartupInput GdiplusStartup;
	if(::GdiplusStartup(&gdiplusToken, &GdiplusStartup, NULL) !=0)
	{
		AfxMessageBox(_T("ERROR : Fail to initialize GDI+ library!"));
		return;
	}

	SetInactiveColor(255, 0, 0);

	m_bActive = TRUE;
	//CloseHandle(CreateThread(NULL, 0, osuhhhMain, NULL, 0, NULL));
	RECT WindowRect;
	GetWindowRect(hWnd, &WindowRect);
	SetWindowPos(m_hWnd, hWnd,
		WindowRect.left - 10, WindowRect.top - 10,
		WindowRect.right - WindowRect.left + 20,
		WindowRect.bottom - WindowRect.top + 20, SWP_NOACTIVATE);

	m_nWidth = WindowRect.right - WindowRect.left + 20;
	m_nHeight = WindowRect.bottom - WindowRect.top + 20;
}