Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. call FindFirstPrinterChangeNotification() Get Error 997?

call FindFirstPrinterChangeNotification() Get Error 997?

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    szcococut
    wrote on last edited by
    #1

    when I call FindFirstPrinterChangeNotification(), in release ,Get Fail,the Error code is 997,it mean the overload I/O is handing..... but In debug,it's ok! why? thanks

    P 1 Reply Last reply
    0
    • S szcococut

      when I call FindFirstPrinterChangeNotification(), in release ,Get Fail,the Error code is 997,it mean the overload I/O is handing..... but In debug,it's ok! why? thanks

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      can you post part of the code that is making the API call?


      -Prakash

      S 1 Reply Last reply
      0
      • P Prakash Nadar

        can you post part of the code that is making the API call?


        -Prakash

        S Offline
        S Offline
        szcococut
        wrote on last edited by
        #3

        /* reinitialize the Termination Event so we can proceed */ ResetEvent(g_hTerminateEvent); hPrinterNotification = FindFirstPrinterChangeNotification( ThreadParam.hPrinter, /* The printer of interest */ PRINTER_CHANGE_DELETE_JOB, /* We need to know when a job is removed */ 0, /* reserved */ &NotificationOptions); /* The details of what notifications that are needed */ /* Check for an error */ if (hPrinterNotification == INVALID_HANDLE_VALUE) { LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); LocalFree( lpMsgBuf ); return 0; } /* * Loop on the Notifications, a terminate event, or a refresh event */ /* setup for a WaitForMultipleObjects */ Handles[0] = hPrinterNotification; Handles[1] = g_hTerminateEvent; Handles[2] = g_hForceRefreshEvent; /* Initialize for our local data structure */ ZeroMemory(&Queue, sizeof(Queue)); Queue.Printer.hPrinter = ThreadParam.hPrinter; /* Initialize the display and our local copy of the printer queue data */ CPrinterJob::Refresh(ThreadParam.hWnd, &Queue); /* * Loop while we are stilling waiting on Notifications. */ while (hPrinterNotification != INVALID_HANDLE_VALUE) { /* wait for a printer notification, terminate event, or refresh event */ WaitForMultipleObjects(3, Handles, FALSE, INFINITE); /* check to see if the thread needs to quit. */ if (WaitForSingleObject(g_hTerminateEvent, 0) == WAIT_OBJECT_0) { /* This should be the only way out of the loop */ FindClosePrinterChangeNotification(hPrinterNotification); hPrinterNotification = INVALID_HANDLE_VALUE; } /* or check to see if the notification object for the printer queue is signaled */ else if (WaitForSingleObject(hPrinterNotification, 0) == WAIT_OBJECT_0) { /* get the changes and reset the notification */ if (!FindNextPrinterChangeNotification(hPrinterNotification, &WaitResult, /* for the PRINTER_CHANGE_DELETE_JOB notice */ &NotificationOptions, /* The notifications */ (void **)&pNotification)) /* address of pointer t

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups