|
-
Sep 16th, 2000, 02:50 PM
#1
Thread Starter
Hyperactive Member
Say you create your own notepad. Then you go and assocaite .txt files with your program so now when you open a txt file it runs your program. How do you get your program to open that file and put it in the richtextbox? Thanks!!
-
Sep 16th, 2000, 02:58 PM
#2
Monday Morning Lunatic
Code:
RichTextBox1.LoadFile "myfile.txt", rtfText
Use rtfRTF to load a Rich Text File.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 16th, 2000, 03:04 PM
#3
Thread Starter
Hyperactive Member
Yes, I know how to open a file like that. But if someone double clicks on a txt file and your program starts up you don't know the name of that file. So you can't load it that way. Any other suggestions? Thanks!!
-
Sep 16th, 2000, 03:12 PM
#4
Monday Morning Lunatic
The filename will be supplied to your program as part of the Command item:
Code:
RichTextBox1.LoadFile Command, rtfText
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 16th, 2000, 03:20 PM
#5
Thread Starter
Hyperactive Member
*SMILES*
Thanks it worked great. Now that I know it can be done its time to make my own personal notepad the way I like it. Thanks man!!
-
Sep 16th, 2000, 03:27 PM
#6
Monday Morning Lunatic
One thing to keep in mind, if someone calls your program like:
Code:
myprog.exe afile.txt
then it will work fine. Unfortunately, if they add any other options, it won't:
Code:
myprog.exe afile.txt /opt:5
Your program will then try and load the file: "afile.txt /opt:5", and will die. You'd need to find some way of splitting the string up.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 16th, 2000, 03:32 PM
#7
Thread Starter
Hyperactive Member
What are those option things? I have never seen them before and have no idea what they do?
-
Sep 16th, 2000, 03:35 PM
#8
Monday Morning Lunatic
They can do anything you want your program to do. For example, if you wanted it to print the file, without showing it, you could have a /p option.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 16th, 2000, 03:47 PM
#9
Thread Starter
Hyperactive Member
Well I have no idea how to use them so my prog won't be able to do that for a while atleast. Thanks anyway!!
-
Sep 16th, 2000, 06:58 PM
#10
This will disregard anything after the filename.
Code:
RichTextBox1.LoadFile Left(Command$, InStr(1, Command$, ".") + 3), rtfText
-
Sep 17th, 2000, 04:33 AM
#11
Monday Morning Lunatic
Megatron - that's fine until they use long filenames - the filename will be enclosed in quotes (it should anyway). I'll have a go at sorting something else out.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|