468,242 Members | 1,828 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

Problem with printing Barcode on cognitive HCLabel printer from Windows server 2008

I am trying to print a barcode form HClabel printer through my application running on Windows server 2008. The printer is a ntwork printer connected to a Windows 7 Machine.

The code to access the printer and proceed with printing is in VC++. The code has been working fine since years and it still works when I try to print from Windows XP machine(Connect and print on the same printer connected to WIndows 7 machine mentioned above).

The error code I receive when tried to print from windows server 2008 is 2 which says File not found. But when i access the machine from windows server 2008, it is accessible.

Below is the code I use:

Expand|Select|Wrap|Line Numbers
  1. if( m_hPrinter != NULL )
  2.         EndWriter();
  3.  
  4.     m_hPrinter = ::CreateFile(lpPrinterName,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
  5.  
  6.     if( m_hPrinter == INVALID_HANDLE_VALUE )   
  7.     {
  8.         CString strErrMsg = "";
  9.         strErrMsg.Format("Could not open file %s(error %d) - CreateFile returned invalid handle",lpPrinterName, GetLastError());
  10.         MessageBox(NULL,strErrMsg,"Error Info",1);
  11.         printf("Could not open file %s(error %d)\n - CreateFile returned invalid handle", lpPrinterName, GetLastError());
  12.     }
  13.  
Please suggest what might be causing this to failonly on the new operating system I use(Windows server 2008)
Oct 10 '12 #1
4 2324
johny10151981
1,059 1GB
I have faced the same problem(probably same) with NEC MultiImpact 700JC.

You must have to have Driver supported for your operating system.
Oct 10 '12 #2
Thank you for the reply johny10151981.

The printer prints fine when I print it from Xp machine.
The situation is this : The printer is connected to Windows 7 machine. My application runs on Windows server 2008 and accesses this printer through network and that is when it fails.
When i access the printer through my application from Xp machine, it prints fine.
If it was the driver that is causing the problem it should not have worked when accessed from Xp machine as well right?
Oct 10 '12 #3
johny10151981
1,059 1GB
Driver conflict or problem is with windows 8. Windows 8 need the driver
Oct 10 '12 #4
Did you mean the problem is with Windows 7?
Can you please explain how is the printer working when accessed from Xp machine though driver is causing the issue?

i am wondering of how is the same driver working fine when given a print from XP machine. Is driver dependent on the machine from where the print command is coming in??!!
Oct 10 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by =?Utf-8?B?T2xpdmllciBNQVRST1Q=?= | last post: by
2 posts views Thread by Odd B Andersen | last post: by
1 post views Thread by =?Utf-8?B?bWFzYWtpeQ==?= | last post: by
1 post views Thread by =?Utf-8?B?QW50amU=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.