This test works on my Windows 10 22H2 OS, by drawing your .emf in the client area of the main window (also works on the screen DC with nWidth, nHeight, but larger than screen) :
HENHMETAFILE hEmf = GetEnhMetaFile(TEXT("test_libuemf_ref.emf"));
if (hEmf)
{
ENHMETAHEADER pEmfHeader;
if (GetEnhMetaFileHeader(hEmf, sizeof(pEmfHeader), &pEmfHeader) != 0)
{
HDC hDC = GetDC(hWnd);
// For test
RECT rcBounds;
rcBounds.left = MulDiv(pEmfHeader.rclFrame.left, pEmfHeader.szlDevice.cx, pEmfHeader.szlMillimeters.cx * 100);
rcBounds.top = MulDiv(pEmfHeader.rclFrame.top, pEmfHeader.szlDevice.cy, pEmfHeader.szlMillimeters.cy * 100);
rcBounds.right = MulDiv(pEmfHeader.rclFrame.right, pEmfHeader.szlDevice.cx, pEmfHeader.szlMillimeters.cx * 100);
rcBounds.bottom = MulDiv(pEmfHeader.rclFrame.bottom, pEmfHeader.szlDevice.cy, pEmfHeader.szlMillimeters.cy * 100);
int nWidth = rcBounds.right - rcBounds.left;
int nHeight = rcBounds.bottom - rcBounds.top;
BITMAPINFO BitmapInfo;
ZeroMemory(&BitmapInfo, sizeof(BITMAPINFO));
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biWidth = nWidth;
BitmapInfo.bmiHeader.biHeight = nHeight;
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = 32;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
HBITMAP hBitmap = CreateDIBSection(hDC, &BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
if (hBitmap != NULL)
{
HBITMAP hBitmapOld = (HBITMAP)SelectObject(hDC, hBitmap);
/*RECT rect = { 0, 0, nWidth, nHeight };*/
RECT rect;
GetClientRect(hWnd, &rect);
BOOL bRet = PlayEnhMetaFile(hDC, hEmf, &rect);
SelectObject(hDC, hBitmapOld);
DeleteObject(hBitmap);
}
ReleaseDC(hWnd, hDC);
}
DeleteEnhMetaFile(hEmf);
}