|
-
Nov 18th, 2000, 04:13 PM
#1
Thread Starter
Lively Member
If I wanted to open up a text file with notepad - is there a way to do that in one step with out sending keys to notepad to open the file...
Something like: Shell "notepad.exe +myfile.txt".
Thanks.... I can't find any info on this in my books.
-
Nov 18th, 2000, 04:49 PM
#2
Junior Member
Code:
Shell "Notepad.exe FileName", vbNormalFocus
-
Nov 18th, 2000, 05:09 PM
#3
Thread Starter
Lively Member
that was simple..... 
thanks
-
Nov 18th, 2000, 11:34 PM
#4
PowerPoster
ShellExecute API
This will better, let the OS use the default textfile browser, instead you specified in the Shell function.
Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, vbNullString, "C:\myfilen.txt", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
-
Nov 18th, 2000, 11:53 PM
#5
Re: ShellExecute API
Chris, actually, the ShellExecute api function will load the text file with the default application it is set to use.
So say the user has something else loading a text file, ShellExecute will load that program instead of notepad.
Therefore, in this case, if he wants to have the text file loaded in Notepad, the Shell function should be used .
-
Nov 18th, 2000, 11:58 PM
#6
PowerPoster
yap, Matthew you're right, the SelfExecute will base on what the user have set in the registry for a particular file type. But will the API provided a better performance?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|