mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[Thumbnail providers] Cover errors and edge cases (#23947)
* [Thumbnail providers] Cover errors and edge cases * Add TODO comment * Fix tests
This commit is contained in:
@@ -159,11 +159,19 @@ IFACEMETHODIMP GcodeThumbnailProvider::GetThumbnail(UINT cx, HBITMAP* phbmp, WTS
|
||||
WaitForSingleObject(m_process, INFINITE);
|
||||
std::filesystem::remove(fileName);
|
||||
|
||||
|
||||
std::wstring fileNameBmp = filePath + guid + L".bmp";
|
||||
*phbmp = (HBITMAP)LoadImage(NULL, fileNameBmp.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||
*pdwAlpha = WTS_ALPHATYPE::WTSAT_ARGB;
|
||||
|
||||
std::filesystem::remove(fileNameBmp);
|
||||
if (std::filesystem::exists(fileNameBmp))
|
||||
{
|
||||
*phbmp = (HBITMAP)LoadImage(NULL, fileNameBmp.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
||||
*pdwAlpha = WTS_ALPHATYPE::WTSAT_ARGB;
|
||||
std::filesystem::remove(fileNameBmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::info(L"Bmp file not generated.");
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user