|
-
Oct 27th, 2000, 09:54 PM
#1
Thread Starter
PowerPoster
The program that i am working on, is a rather simple text editor, i am basically trying to make a simple notepad upgrade. So to the point, i want to be able to use this program as the default program for viewing text files, so i right clicked on a text file in windows, and told it to open with my text program. When i do this though, it opens my program, but the text file does not open. I have tried fixing this but have no idea how. Could anyone offer a solution or some advice?
-
Oct 27th, 2000, 10:20 PM
#2
Member
use command$
listen..
i had this exace same problem a week ago...
and someone in this forum helped me..just as i'm helping you now...though he explained sucks and i had to figure it out mostly by myself.
anyway...
vb has a function called "command$"...this function dont receive any paramrters...
i think that if you will try puting this line in your form_load event you will understand it immediately..
private sub form_load()
msgbox command$ ' string result
end sub
you see...if you open an exe by double clicking on it..
the result of command$ will be ""
but : if you will open it through the right-click method the command$ function will return...
lets say you opened your application with right-click on a file that exsist in c:\Dealman\note.txt
then...
command$="c:\Dealman\note.txt"
one more thing...
you cant say....
open command$ for.....yada yada...
because command$ has something like ""c:\Dealman\note.txt""
so you open the file like that...
open mid$(command$,2,len(command$)-2) for input as #1...
yada yada...
close #1
i hope you understand what i wrote...
if not E-Mail Me and i'll send you a little example..
[email protected]
-
Oct 27th, 2000, 10:43 PM
#3
Take a look at this thread.
-
Oct 27th, 2000, 10:49 PM
#4
Thread Starter
PowerPoster
Thanks for the help with the open with problems. The command$ function is starting to sahed some light on it, and i got the path to display. You mentioned and example, if it is not too much trouble, would you be able to send me one? I am still new to VB.
-
Oct 29th, 2000, 05:59 AM
#5
Member
no need in example
if you already got the path of the file you opened your exe with , then all you need to know now is how to open a file
i believe you know that , right ?
anyway ...the only problem i think you could have possibely encounted with is that you opened in wrong path
lets say you have a string called s , which contains "DealMan"
s="DealMan"
the command$ function is not quite the same...
you see..
if you say ...text1.text=s then the text will actualy show :
Dealman...and not "DealMan"
well...
the command$ function is not the same...
like the text1.text=s example ...
the text1.text=command$ wont show :
c:\text.txt
but "
"c:\text.txt"
you can simply solve this problem by removing the first and the last char by the following code :
FileRealPath = mid$(command$,2,len(command$)-2)
if you still have problems..then i will send you a little example....
BTW i figured it out mostly by my self....
maybe if you will play with it..you'll figure it out .
[Edited by dealman on 10-29-2000 at 06:01 AM]
-
Oct 29th, 2000, 03:18 PM
#6
Thread Starter
PowerPoster
Ok, thanks for all the help. I did get it working fine. I was having some trouble opening large files, but i eventually figured out what i was doing wrong, which was a really stupid mistake. But thank you a lot for all the help. I never would have figured that one out on my own.
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
|