Board index » cppbuilder » Sarting Notepad/Wordpad in read-only mode

Sarting Notepad/Wordpad in read-only mode

I want to call Notepad from within my program to view some of my text files, but the
user is not allowed to change anything in the files.

Is there a way to start Notepad/Wordpad up in read-only mode using a program
argument.

Thanks,

Kim Hellan

 

Re:Sarting Notepad/Wordpad in read-only mode


Quote
Kim Hellan wrote:
> I want to call Notepad from within my program to view some of my text files, but the
> user is not allowed to change anything in the files.

> Is there a way to start Notepad/Wordpad up in read-only mode using a program
> argument.

Just an idea, but open the text file with fopen (or you favorite sys call for opening a
file) before launching Notepad/Wordpad.  This will make the file read only for any other
attempts to access the file.

Now with that in mind, can you please tell me how you are launching another app from a
BCB program?

Jacob Christ
PONTECH

Re:Sarting Notepad/Wordpad in read-only mode


Jacob,

Try this snippet!

  HWND hwnd;
  LPCTSTR lpOperation, lpFile, lpParameters, lpDirectory;

  hwnd = Handle;
  lpOperation = "open";
  lpFile = "Netscape.Exe";
  lpParameters = "-news";
  lpDirectory = "J:\\Program Files\\Communicator\\Program";

        ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, SW_RESTORE);
--------------------------------------

Larry
-----------------------------

Quote
Jacob Christ wrote:

> Kim Hellan wrote:

> > I want to call Notepad from within my program to view some of my text files, but the
> > user is not allowed to change anything in the files.

> > Is there a way to start Notepad/Wordpad up in read-only mode using a program
> > argument.

> Just an idea, but open the text file with fopen (or you favorite sys call for opening a
> file) before launching Notepad/Wordpad.  This will make the file read only for any other
> attempts to access the file.

> Now with that in mind, can you please tell me how you are launching another app from a
> BCB program?

> Jacob Christ
> PONTECH

Other Threads