Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I manage a Notepad session ?
Message
 
 
To
11/10/2001 21:25:03
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00567365
Message ID:
00567403
Views:
17
>Is there a way to create a Notepad object ? I would like to open Notepad and show text. The next call to Notepad should use the same instance and just replace the text. I know you can make an object that references Word.Application. Can the same be done with Notepad ? If so, where can I get a list of the available commands/methods in Notepad ?
>
>If not Notepad, how about WordPad ? For my use, Word would be to much.

Notepad isn't a automation server. Some ideas

1) Copy the text file to and from an editbox on a form
Get the file:
THISFORM.edtJoe.VALUE = FILETOSTR("c:\evan.txt")
Save the file:
STRTOFILE(THISFORM.edtJoe.VALUE,"c:\evan.txt")

2) Use the Windows API to open a text file, thus opening notepad. The downside is you can't close notepad and the user would have to do it.
DECLARE INTEGER ShellExecute IN "Shell32.dll" ;
    INTEGER hwnd, ;
    STRING lpVerb, ;
    STRING lpFile, ;
    STRING lpParameters, ;
    STRING lpDirectory, ;
    LONG nShowCmd
    
shellexecute(0,"OPEN","c:\evan.txt","","",1)
3) Use word then you have a big, but full featured text editor that you can control. A simple example.
* open word with a text file
oWord = CREATEOBJECT("word.application")
oWord.visible = .T.
oDoc = oWord.Documents.Open("c:\evan.txt")
* save text file and close word
oDoc.Save()
oWord.Quit()
RELEASE oDoc
RELEASE oWord
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform