You are here: PSPad forum > English discussion forum > open locked file as read-only

open locked file as read-only

Goto Page: Previous1 2 3 Next

#11 Re: open locked file as read-only

Posted by: Tsjoecha | Date: 2015-09-08 08:30 | IP: IP Logged

My logfile is written from withing openedge, through a stream. So, you have to to be able to write a stream (probably exclusive), and then try to open that file in PSpad. (as I understand, through a stream as well)

Options: Reply | Quote | Up ^


#12 Re: open locked file as read-only

Posted by: pspad | Date: 2015-09-08 08:45 | IP: IP Logged

If application writes to stream with exclusive access, no other application has access to it. As example you can take operating system swapfile.

There is several option - you can open stream with exclusive write - it means other application can read but can't write. I don't know how OpenEdge creates it's log.

As easier imagination see this topic:
msdn.microsoft.com

Edited 2 time(s). Last edit at 2015-09-08 08:48 by pspad.

Options: Reply | Quote | Up ^


#13 Re: open locked file as read-only

Posted by: Tsjoecha | Date: 2015-09-10 08:43 | IP: IP Logged

I don't know neither...

A standard stream is explained here:
documentation.progress.com

There is also a similar log-file system :
documentation.progress.com

As notepad and others can read it, I think it is something like exclusive write, but open for reading for everyone (except pspad tongue sticking out smiley )

Options: Reply | Quote | Up ^


#14 Re: open locked file as read-only

Posted by: pspad | Date: 2015-09-11 10:46 | IP: IP Logged

I am using FileStreams with OpenRead + ShareDenyNone mode
Each File stream in Windows uses WinApi CreateFile

OpenRead requests read only access and ShareDenyNone means PSPad doesn't request any lock (reading, writing).

I will try to change it a little, we will see. I tested it with locked files and I was able open any file what Notepad is able to open too.

There must be some other access, cause e.g. Lister in Total Commander is able to open file even others are not.

Options: Reply | Quote | Up ^


#15 Re: open locked file as read-only

Posted by: Tsjoecha | Date: 2015-09-17 08:29 | IP: IP Logged

Is this allready foreseen in version 4.6.0 (2671)? Anyhow, there, it doesn't work sad smiley

Options: Reply | Quote | Up ^


#16 Re: open locked file as read-only

Posted by: pspad | Date: 2015-09-17 09:04 | IP: IP Logged

Sorry, but I am using standard file stream access without requesting any lock.
Without test and play with your special locked file I am not able to do anything.

I was able to open any file as other editors. If you tell me any Windows system file what PSPad isn't able to open and other editors can, I can do more.

Options: Reply | Quote | Up ^


#17 Re: open locked file as read-only

Posted by: Tsjoecha | Date: 2015-09-17 13:36 | IP: IP Logged

I found a very simple test case.

You create a plain text file, let's say c:\test\file.txt
You open this file with LibreOffice Writer (www.libreoffice.org) or Ms Word (I tested with 2007)
You try to open the file simultanously with PsPad:
---------------------------
Error
---------------------------
Cannot open C:\test\file.txt
Cannot open file "C:\test\file.txt". The process cannot access the file because it is being used by another process
---------------------------
OK
---------------------------

Notepad works just fine...

I hope you can simulate this case.

Options: Reply | Quote | Up ^


#18 Re: open locked file as read-only

Posted by: pspad | Date: 2015-09-17 17:06 | IP: IP Logged

I did this test. File was open with Word.
Notepad open this file.
PSPad open this file too. I tested open file with explorer context menu / Open in PSPad (integrated with DLL library), tested with running PSPad and it's Open file dialog, tested with running PSPad and Drag/Drop file to PSPad.
In all cases was file open in PSPad without any problem.

How do you open your file?

Options: Reply | Quote | Up ^


#19 Re: open locked file as read-only

Posted by: Tsjoecha | Date: 2015-09-18 06:45 | IP: IP Logged

Tried all 3 methods... 3 time "file is locked" message.
I use win 7 64 bit English, all windows updates are installed.
Pspad had the Dutch user interface.

Options: Reply | Quote | Up ^


#20 Re: open locked file as read-only

Posted by: Tsjoecha | Date: 2015-09-18 06:53 | IP: IP Logged

Ok, I found a setting where the context menu is through dll of via registry. Mine was as registry. I changed it, and now the word locked file opens just fine.

Unfortenately, my logfiles created through openedge are still locked sad smiley

update : when I open the text file with Libreoffice writer, the lock persists.

Edited 1 time(s). Last edit at 2015-09-18 06:55 by Tsjoecha.

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3 Next





Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR