void ProgressThread() { HWND hWnd; BOOL bPortraitMode; HBITMAP hNewImage; HDC hDC, hMemDC; int width, height; BOOL bOverrideSuspend; UINT32 bytesReturned; DWORD imgX, imgY; DWORD updateStatus; RETAILMSG(1, (TEXT("Progress Thread starting\r\n"))); width = GetSystemMetrics(SM_CXSCREEN); height = GetSystemMetrics(SM_CYSCREEN); if(width < height) bPortraitMode = TRUE; else bPortraitMode = FALSE; // Create a STATIC window hWnd = CreateWindow(TEXT("STATIC"),TEXT(""), WS_VISIBLE, 0, 0, width, height, NULL, NULL, g_hInstance, NULL); if(NULL == hWnd) { RETAILMSG(1, (TEXT("ERROR hWnd is NULL\r\n"))); gThreadDone = TRUE; return; } // Make the window full screen if(!SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON)) { RETAILMSG(1, (TEXT("Could not go full screen\r\n"))); gThreadDone = TRUE; return; } // Get the device context hDC = GetDC(hWnd); if(NULL == hDC) { RETAILMSG(1, (TEXT("ERROR hDC is NULL\r\n"))); gThreadDone = TRUE; return; } // Create a compatible DC hMemDC = CreateCompatibleDC(hDC); if(NULL == hMemDC) { RETAILMSG(1, (TEXT("ERROR hMemDC is NULL\r\n"))); gThreadDone = TRUE; return; } hNewImage = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_SPLASH)); if(NULL == hNewImage) { RETAILMSG(1, (TEXT("ERROR hNewImage is NULL\r\n"))); gThreadDone = TRUE; return; } // Paint the splash screen SelectObject(hMemDC, hNewImage); if (bPortraitMode) { imgX = 80; imgY = 0; } else { imgX = 0; imgY = 80; } BitBlt(hDC, 0, 0, width, height, hMemDC, imgX, imgY, SRCCOPY); SIZE size; // Paint the OS Install title & update images hNewImage = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_OS)); SelectObject(hMemDC, hNewImage); GetViewportExtEx(hMemDC, &size); BitBlt(hDC, si->OsUpdateBmpPoint.x - imgX, si->OsUpdateBmpPoint.y - imgY, size.cx, size.cy, hMemDC, 0, 0, SRCCOPY); hNewImage = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_UPDATE)); SelectObject(hMemDC, hNewImage); GetViewportExtEx(hMemDC, &size); BitBlt(hDC, si->updateBackgroundBmpPoint.x - imgX, si->updateBackgroundBmpPoint.y - imgY, size.cx, size.cy, hMemDC, 0, 0, SRCCOPY); while(!gStopThread) { // CODE HERE TO PAINT PROGRESS BMPs with // SelectObject(hMemDC, hNewImage); // GetViewPortExtEx(hMemDC, &size); // BitBlt(hDC, x, y, size.cx, size.cy, hMemDC, 0, 0, SRCCOPY); // At some point: { // Either error case or complete case. gStopThread = TRUE; break; } // Make sure the backlight stays on SystemIdleTimerReset(); Sleep(POLL_TIME_SECONDS * 1000); // Sleep until time to check again (in seconds) } DeleteDC(hMemDC); ReleaseDC(hWnd, hDC); // Did the update exit with a "Reboot" status? if (UPDATE_STATUS_COMPLETE == updateStatus) { // Yes. Reset! JSSetPower(PWR_RESET); } RETAILMSG(1, (TEXT("Progress Thread exiting\r\n"))); gThreadDone = TRUE; }