portalocker in Win98
Steve Holden
sholden at holdenweb.com
Wed Jan 15 08:38:04 EST 2003
"Cliff Wells" <LogiplexSoftware at earthlink.net> wrote in message
news:mailman.1042578749.1393.python-list at python.org...
> On Tue, 2003-01-14 at 12:48, Richard Jones wrote:
>
> > If anyone knows how to lock a file on win98, I'd really appreciate a
hint.
>
> Win98 only supports locking entire computers, not files <wink>
>
> Assuming 98 doesn't support locking files (which I believe to be true,
> but am willing to be corrected on), what I would probably do in this
> case is create a "lock server" using a network socket and have
> applications acquire a lock from it. I expect you could even make the
> API mirror the portalock API (which I've never used and so can't comment
> on) and use it as a drop-in replacement.
>
> Even if 98 supported file locking, I expect this approach would be
> superior.
>
Clearly something quite advanced is required here. I spoke to the Microsoft
help desk.
After a three-hour session in which I educated them about the benefits of
Python and the features and facilities offered by the language, they came up
with the following suggestion: "Make use of the Microsoft Office locking
algorithm by creating a COM object encapsulation an instance of Word and
have it open a document. If the document is already open then Word wil
report an error that your program can use to determine the lock is currently
set."
Brilliant: shows that all that money I spend on Microsoft support isn't
wasted. I tried it, but unfortunately the COM implementation in Word doesn't
report the error correctly. Microsoft have recorded this as a bug, and will
get back to me if ever anybody fixes it.
tongue-in-cheek-ly y'rs - steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
Bring your musical instrument to PyCon! http://www.python.org/pycon/
More information about the Python-list
mailing list