::CreateDC() returns NULL with errorcode ERROR_INVALID_PRINTER_NAME(1801)
-
You could try to use the DC returned by
PrintDlgEx(..)
... :)virtual void BeHappy() = 0;
Thanks for your reply :) But I think you misunderstood it. It has nothing to do with "Print" or "Printer". It's about "video display driver" :-D
-
Thanks for your reply :) But I think you misunderstood it. It has nothing to do with "Print" or "Printer". It's about "video display driver" :-D
Yes, I have probably misunderstood it... :) ...does your call look like
::CreateDC("DISPLAY", NULL, ...);
under W2K ? :)virtual void BeHappy() = 0;
-
Yes, I have probably misunderstood it... :) ...does your call look like
::CreateDC("DISPLAY", NULL, ...);
under W2K ? :)virtual void BeHappy() = 0;
;) The follow is my code fragment: HDC CreateDCFromDriver() { HDC hDC; char lpszDriver[0x20]; if ( FALSE == GetDriverDeviceName(lpszDriver) ) return NULL; hDC = ::CreateDCA(lpszDriver, 0, 0, 0); if ( hDC == NULL ) { MM_TRACE(_T("CreateDCFromDriver: ErrorCode - %08X"), GetLastError()); } return hDC; } I think my code is just OK, cause everything works fine in "xp, vista, win7" OS. It only occur in "win2k", when in "win2k" OS the code will go into "MM_TRACE(_T("CreateDCFromDriver: ErrorCode - %08X"), GetLastError()); ". Meanwhile in other OS, it go into "return hDC;" correctly.
-
;) The follow is my code fragment: HDC CreateDCFromDriver() { HDC hDC; char lpszDriver[0x20]; if ( FALSE == GetDriverDeviceName(lpszDriver) ) return NULL; hDC = ::CreateDCA(lpszDriver, 0, 0, 0); if ( hDC == NULL ) { MM_TRACE(_T("CreateDCFromDriver: ErrorCode - %08X"), GetLastError()); } return hDC; } I think my code is just OK, cause everything works fine in "xp, vista, win7" OS. It only occur in "win2k", when in "win2k" OS the code will go into "MM_TRACE(_T("CreateDCFromDriver: ErrorCode - %08X"), GetLastError()); ". Meanwhile in other OS, it go into "return hDC;" correctly.
You could try to trace the
lpszDriver
too... :)virtual void BeHappy() = 0;
-
You could try to trace the
lpszDriver
too... :)virtual void BeHappy() = 0;
:) Yes, I've tried that, and it's like "\\.\DISPLAY3" which is OK. I still believe that this problem is caused by the implementation of function "CreateDC" under "win2k" OS. ;P I just want to know if there's a workaround out there about this issue. :((
-
:) Yes, I've tried that, and it's like "\\.\DISPLAY3" which is OK. I still believe that this problem is caused by the implementation of function "CreateDC" under "win2k" OS. ;P I just want to know if there's a workaround out there about this issue. :((
Would it be enough under win2k ? :) :
MSDN:
If there are multiple monitors on the system, calling CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) will create a DC covering all the monitors.
virtual void BeHappy() = 0;
-
Would it be enough under win2k ? :) :
MSDN:
If there are multiple monitors on the system, calling CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) will create a DC covering all the monitors.
virtual void BeHappy() = 0;
I do believe that it's relevant to multiple monitors, but I just can't ask our users to set up another monitor or another video card, or something like that. I can only make some improvement in our program which I still don't know how to do it. ;P
-
Would it be enough under win2k ? :) :
MSDN:
If there are multiple monitors on the system, calling CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) will create a DC covering all the monitors.
virtual void BeHappy() = 0;
Anyway, I really appreciate your help. ;P
-
I do believe that it's relevant to multiple monitors, but I just can't ask our users to set up another monitor or another video card, or something like that. I can only make some improvement in our program which I still don't know how to do it. ;P
Probably the function can not understand the driver name under Win2k and try to find a printer with the name pointer NULL... :)
virtual void BeHappy() = 0;
modified on Tuesday, March 30, 2010 4:58 AM
-
Probably the function can not understand the driver name under Win2k and try to find a printer with the name pointer NULL... :)
virtual void BeHappy() = 0;
modified on Tuesday, March 30, 2010 4:58 AM
Yes, I agree with your point. I found something on the internet which says it may be: * concerning issues about "video card", like "dualhead cards that use a single chipset" * or some "security risk" after win2k OS But for me, neither seems to be correct :(