Results 1 to 6 of 6

Thread: Open With... Problems

  1. #1

    Thread Starter
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340

    Exclamation

    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?

  2. #2
    Member
    Join Date
    Oct 2000
    Posts
    47

    Red face 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..
    dealman@hotmail.co.il

    DealMan

  3. #3
    Guest
    Take a look at this thread.

  4. #4

    Thread Starter
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340

    Talking

    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.

  5. #5
    Member
    Join Date
    Oct 2000
    Posts
    47

    Arrow 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]
    DealMan

  6. #6

    Thread Starter
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    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
  •  



Click Here to Expand Forum to Full Width