bool CreateFrameRateWnd(FrameRateWnd *w) { // WS_POPUP removes all decorations DWORD dwStyle = WS_POPUP | WS_VISIBLE | WS_DISABLED; RECT r = GetClientRect(w->hwndAssociatedWith); // since this is WS_POPUP window, providing w->hwndAssocatedWith doesn't establish // parent-child relationship but ownership relationship (as long as hwndAssociatedWith // is WS_OVERLAPEPED or WS_POPUP). Owned window always shows up on top of owner in z-order // http://msdn.microsoft.com/en-us/library/ms632599%28v=VS.85%29.aspx#owned_windows HWND hwnd = CreateWindowEx(WS_EX_LAYERED, FRAME_RATE_CLASS_NAME, NULL, dwStyle, 0, 0, 0, 0, w->hwndAssociatedWith, NULL, GetModuleHandle(NULL), w); CrashIf(hwnd != w->hwnd); if (!hwnd) { return false; } w->font = GetDefaultGuiFont(); SetWindowSubclass(w->hwndAssociatedWith, WndProcFrameRateAssociated, 0, (DWORD_PTR) w); SetLayeredWindowAttributes(hwnd, 0, 0x7f, LWA_ALPHA); ShowFrameRate(w, 0); return true; }
void ShowFrameRateDur(FrameRateWnd *w, double durMs) { ShowFrameRate(w, FrameRateFromDuration(durMs)); }
void CCapVideoDlg::OnTimer(UINT nIDEvent){ if(nIDEvent==1){ ShowFrameRate(); } }