Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I manage a Notepad session ?
Message
 
À
11/10/2001 21:25:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00567365
Message ID:
00567403
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform