Is there some way to remove all locks from a system
Do to a printing error, locks have not been removed via the unlock function is there some way to remove all locks other than to manually go into the registry and delete them.
Lock / unLock
Lock Issue
Perhaps I did not properly explain my issue
I am using the lock function
ie. int Lock( HANDLE hPrinter, LPCSTR szLockName );
Due to an un expected crash in my system the file did not print so the lock did not get removed.
because the lock did not get removed any subsequent tries to print this document fail.
the locks do not appear to be reset by rebooting.
I realize that I can go into the registry and manually remove these locks,
but what I am looking for is a way to remove all locks programatically.
I am using the lock function
ie. int Lock( HANDLE hPrinter, LPCSTR szLockName );
Due to an un expected crash in my system the file did not print so the lock did not get removed.
because the lock did not get removed any subsequent tries to print this document fail.
the locks do not appear to be reset by rebooting.
I realize that I can go into the registry and manually remove these locks,
but what I am looking for is a way to remove all locks programatically.
Hello,
To programmatically remove the locks, you need to call Unlock(). You may try to call the Unlock() function in a part of your code that will execute even if printing failed.
Does this help?
To programmatically remove the locks, you need to call Unlock(). You may try to call the Unlock() function in a part of your code that will execute even if printing failed.
Does this help?
Last edited by Joan on Wed Jun 15 2005, edited 1 time in total.
The unlock function requires the printer handle, after the program has crashed I no longer have a printer handle. I have fixed the issue with my program crashing and have ensured that if the printing fails the unlock function is now called. but I have some users who still have locks left over from previously.
I guess what I was hoping for was some way to clear all locks when I reboot the machine or something like that. I am a little worried that a system hang or something like that might cause locks to remain on the system and the end users will then no longer be able to print that report.
Thanks for your help.
I guess what I was hoping for was some way to clear all locks when I reboot the machine or something like that. I am a little worried that a system hang or something like that might cause locks to remain on the system and the end users will then no longer be able to print that report.
Thanks for your help.