PDA

View Full Version : opening a file in notepad - newbie question



new user
15-04-2005, 03:07 AM
how do i make it so when i click a button, a file like 'c:\file.txt' is opened in notepad.
thaks! :)

JSoftware
15-04-2005, 08:30 AM
add shellapi to your usses clause

then in the buttonclick event add this line:
ShellExecute(0, 'open', 'notepad.exe', 'c:\file.txt','', SW_SHOWNORMAL);

that should be it!

Sly
15-04-2005, 09:39 AM
A better option is to just execute the text file. This will use the registered text editing application to open the file. Much nicer to the end user like me who uses UltraEdit for all text editing purposes.

ShellExecute(0, 'open', 'c:\file.txt', nil, nil, SW_SHOWNORMAL);