|
-
May 27th, 2000, 07:18 AM
#1
Thread Starter
Addicted Member
I have a 'Readme' text document that accompanies my app.
I want to open 'Readme' from Form Activate so that the text file opens in Notepad and is the first thing the user sees before using the app.
Assuming the file is Readme.txt and it is on app.path, how can I do this.
(I don't want to create a form with the info on it)
The code would be much appreciated
GRAHAM 
-
May 27th, 2000, 07:30 AM
#2
One method is to use the Shell Command and then use the SendKeys to open the file. Make a Form with a CommandButton on it and put the following code into the Commandbutton. Make sure that you have a file in your C:\ directory. Call it Readme.txt, and make sure to put some text in it!!
Code:
Private Sub Command1_Click()
' Open Notepad
RetVal = Shell("C:\windows\Notepad.exe", vbNormalFocus)
SendKeys "%" ' Send the ALT button
SendKeys "{DOWN}" ' Send the down key
SendKeys "{DOWN}" ' Send another down key
SendKeys "{ENTER}" ' Send the enter key
SendKeys "C:\Readme.txt" ' The file you want to open
SendKeys "{ENTER}" ' Send enter to select it.
End Sub
Then the text in your file should appear.
-
May 27th, 2000, 08:01 AM
#3
Thread Starter
Addicted Member
Thanks for responding Megatron, but that's not what I'm looking for. In this particular instance the app. will be
running from A:\, and when FrmMain activates I want Notepad to open on top of it with the .txt file opened, if you follow my drift.
Thanks again
GRAHAM
-
May 27th, 2000, 08:13 AM
#4
Code:
'this code can either be for txt files or any file including exes
ffile = "C:\Windows\Win.ini"
Shell "Notepad.exe " & ffile & "", vbNormalFocus
Is that what you were looking for?
-
May 27th, 2000, 08:37 AM
#5
Thread Starter
Addicted Member
Thanks for responding Matthew, I think I,ve got the general idea now, so I,ll experiment and see what happens. I thought there was an API that handled this, still never mind, I should be able to work something out.
Thanks again
GRAHAM
-
May 27th, 2000, 04:53 PM
#6
You may want to use the ShellExecute API instead so it starts the text file in whatever the user has as the .txt Open with. What if they don't have Notepad.
-
May 28th, 2000, 12:20 AM
#7
Thread Starter
Addicted Member
Yes Ed, you're right.
That's why I was hoping for a bit of demo' code that gave the API and how it would be called relevant to my case.
Perhaps I should have been a bit more specific in my post.
Can anyone help me out on this one.
Cheers
GRAHAM 
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
|