void CVideoWnd::OnUpdateSize() { if (!m_iStatus) { CSize sz(180,160); ImagePos(sz); SetupRegion(); Invalidate(); } else if (m_FrameGrabber.GetSafeHwnd()) { CSize sz = m_FrameGrabber.GetImageSize(); ImagePos(sz); //CRect rcc; //CRect rcw; //GetClientRect(&rcc); //GetWindowRect(&rcw); //int dx = rcw.Width()-rcc.Width(); //int dy = rcw.Height()-rcc.Height(); //if (sz.cx && (rcc.Width()!=sz.cx || rcc.Height()!=sz.cy)) //{ // SetWindowPos(NULL,0,0, // sz.cx+dx, sz.cy+dy, SWP_NOMOVE|SWP_NOZORDER); // GetParentFrame()->GetClientRect(&rcc); // GetParentFrame()->GetWindowRect(&rcw); // dx+= rcw.Width()-rcc.Width(); // dy+= rcw.Height()-rcc.Height(); // GetParentFrame()->SetWindowPos(NULL,0,0, // sz.cx+dx, sz.cy+dy, SWP_NOMOVE|SWP_NOZORDER); //} SetupRegion(); Invalidate(); } }
void ConsolePanel::Init(HINSTANCE hInstance) { if (bInited)return; bInited = true; WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = ConsolePanel::WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DESKTOPWAR)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.lpszMenuName = L""; wcex.lpszClassName = L"Console"; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); RegisterClassEx(&wcex); int screenWidth = GetSystemMetrics(SM_CXSCREEN); int screenHeight = GetSystemMetrics(SM_CYSCREEN); hWnd = CreateWindowEx(0, L"Console", L"ConsolePanel", WS_OVERLAPPEDWINDOW, screenWidth - ConsoleWidth - 100, screenHeight - ConsoleHeight - 100, ConsoleWidth, ConsoleHeight, NULL, NULL, hInstance, NULL); HDC hdc = GetDC(hWnd); memDC = CreateCompatibleDC(hdc); hBigBee = (HBITMAP)LoadImage( NULL, L"1.bmp", IMAGE_BITMAP, ConsoleWidth, ConsoleHeight, LR_LOADFROMFILE); SetupRegion(RGB(0, 0, 0)); //HRGN hRgn = BitmapToRegion(hBigBee, RGB(245, 245, 245), RGB(10, 10, 10)); //SetWindowRgn(hWnd, hRgn, FALSE); ShowWindow(hWnd, SW_HIDE); }
BOOL CTransDlg::OnInitDialog() { CDialog::OnInitDialog(); InitSize(); // Size the Dialog and move it to the center of its parent MoveWindow(0, 0, m_width, m_height, FALSE); SetupRegion(); CenterWindow (GetParent()); m_popup.LoadMenu (IDR_FLOATER_POPUP); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }