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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DivyaNagarajan
    New Member
    • Oct 2012
    • 7

    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:

    Code:
    if( m_hPrinter != NULL )
    		EndWriter();
    	
    	m_hPrinter = ::CreateFile(lpPrinterName,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
    
    	if( m_hPrinter == INVALID_HANDLE_VALUE )   
    	{
    		CString strErrMsg = "";
    		strErrMsg.Format("Could not open file %s(error %d) - CreateFile returned invalid handle",lpPrinterName, GetLastError());
    		MessageBox(NULL,strErrMsg,"Error Info",1);
    		printf("Could not open file %s(error %d)\n - CreateFile returned invalid handle", lpPrinterName, GetLastError());
    	}
    Please suggest what might be causing this to failonly on the new operating system I use(Windows server 2008)
    Last edited by Meetee; Oct 10 '12, 08:03 AM. Reason: please use code tags <CODE>...</CODE> around your code
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    I have faced the same problem(probabl y same) with NEC MultiImpact 700JC.

    You must have to have Driver supported for your operating system.

    Comment

    • DivyaNagarajan
      New Member
      • Oct 2012
      • 7

      #3
      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?

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

        #4
        Driver conflict or problem is with windows 8. Windows 8 need the driver

        Comment

        • DivyaNagarajan
          New Member
          • Oct 2012
          • 7

          #5
          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??!!

          Comment

          Working...