Board index » delphi » Opening Notepad from app

Opening Notepad from app

How would I open the Notepad application with a particular text file from
inside a delphi application. I was looking at OLE but I'm not sure if thats
the way to go, it seems to me that OLE is more for microsoft based products
like Word.

Any help would be great!!

Thanks

Brian

 

Re:Opening Notepad from app


Quote
Brian wrote:
> How would I open the Notepad application with a particular text file
from
> inside a delphi application. I was looking at OLE but I'm not sure
if thats
> the way to go, it seems to me that OLE is more for microsoft based
products
> like Word.

Hi Brian,

You could use ShellExecute from ShellAPI to launch notepad.
If you're thinking about embedding, then use a TMemo or a TRichEdit
instead.

ShellExecute(HInstance, NIL, PCHAR('c:\windows\notepad.exe'),
PCHAR('yourtextfile.txt'), NIL, 1);
or if notepad is the default app for .txt files:
ShellExecute(HInstance, NIL, PCHAR('yourtextfile.txt'), NIL, NIL, 1);

HTH
Regards
-ThomasN

Other Threads