CreateDC() silently returns NULL (code used to work)

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
MaxMotovilov
Posts: 8
Joined: Thu Sep 09 2004

CreateDC() silently returns NULL (code used to work)

Post by MaxMotovilov »

I have recently encountered a problem with the code that used to work properly before; my guess is that it worked last time with 2.10.x and now I am using 2.5.0. The code I have prints to PDF Converter via the CreateDC() mechanism. The following is an outline (I am not posting the original to reduce confusion, since it is in C++ and uses internal libraries):

pdf_converter.PDFDriverInit( "pdfConverter" );
pdf_converter.EnablePrinter( licensee, key );
pdf_converter.PaperSize = page_size_code;
pdf_converter.HorizontalMargin = 0;
pdf_converter.VerticalMargin = 0;
pdf_converter.Orientation = DMORIENT_PORTRAIT;

HDC dc = HDC( pdf_converter.CreateDC() );

// at this point I now get back a NULL handle

if( !dc ) {
AfxMessageBox( "Amyuni PDF Converter: " +
CString( pdf_converter.GetLastErrorMsg() ), MB_ICONSTOP | MB_OK );
return;
}

The message I see displayed is "Amyuni PDF Converter: The operation completed successfully". So, as I take it, CreateDC() does not set the error message string in the case of this particular failure.

Just to reiterate: I am experimenting with the code that DEFINITELY used to work, and I've tried it on multiple systems then and now, so I must be doing something that was valid before 2.50 but no longer. I have checked and re-checked the key/licensee pair and they are indeed valid, besides, we have the same code for PDF Creator and it works just fine.

Thanks in advance for any suggestions on resolving this issue.
...Max...
MaxMotovilov
Posts: 8
Joined: Thu Sep 09 2004

Post by MaxMotovilov »

Update: I have upgraded to 2.50g and the problem persists.
Post Reply