I want to get the write the data of another app's window to an EMF file (bit-blitting wont work, I need all the data, not just the viewable data). The code below seems close. It creates the EMF and writes "Draft". The message gets posted to the separate app. The separate app receives it and processes the WM_PRINT message, but nothing get's written to the DC.
What do I need to do?
HDC hdcRef, hdcMeta;
hdcRef = GetDC(hWnd);
//Retrieve the coordinates of the
//client rectangle in pixels.
//Create the metafile DC
hdcMeta = CreateEnhMetaFile(hdcRef,
(LPSTR)"My Company Name\0MyApp\0\0");
//Verify hdcMeta is good
TextOut(hdcMeta, 0, 0, "Draft", 5);
//Fake out the app to draw to our DC
//Since hWnd is in another thread, we
//need to use PostMessage
//Since we use PostMessage, we need to
//be sure that hWnd has time
//to process and print to m_hdcMeta
PostMessage(hWnd, WM_PRINT, (WPARAM)hdcMeta, PRF_OWNED);
henMF = CloseEnhMetaFile(m_hdcMeta);
// Release the reference DC.