Question

I am working on a sample in this I am creating a EMF file with some text in it. To add a text I am using the API ExtTextOutW() with ETO_IGNORELANGUAGE option.

Return value of this API is TRUE. But when I open the EMF file the text is not present. Then I saw the records. There is no entey for the ExtTextOutW.

Bellw is the code.

HDC hDC = GetDC(hWnd);

RECT Rect = {0, 0, 21590, 27940};

//Create the EMF file DC
HDC hEMFDC  = ::CreateEnhMetaFile(hDC, L"c:\\del\\1.emf", &Rect, L"Test");
if (NULL != hEMFDC)
{
    RECT Rect = {0, 0, 300, 155};
    HBRUSH hb = CreateSolidBrush(0X00FFFF00);

    FillRect(hEMFDC, &Rect, hb);
    DeleteObject(hb);

    int dx[12] = {25,25,25,25,25,25, 25,25,25,25,25,25};                    
    WCHAR wcsBuffer[] = L"Text Message";

    ExtTextOutW(hEMFDC, 10, 10, ETO_IGNORELANGUAGE, NULL, wcsBuffer, wcslen(wcsBuffer), dx);

    HENHMETAFILE hmf = CloseEnhMetaFile(hEMFDC); 
    DeleteEnhMetaFile(hmf);
    hEMFDC = NULL;
}

ReleaseDC(hWnd, hDC);

Please let me know any thing I am doing wrong in the above code.

Was it helpful?

Solution

Did you read the documentation for ExtTextOut[W] (MSDN), especially the part for the flags like ETO_IGNORELANGUAGE:

Reserved for system use. If an application sets this flag, it loses international scripting support and in some cases it may display no text at all.

Just try it without this flag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top