Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open your self made extensions

Status
Not open for further replies.

LordGarfield

IS-IT--Management
Jul 31, 2003
112
BE
If I save a file wich is pure text but with my own extension. So let say .rimp. What should I do to manage that a user clicks on a .rimp file that on this moment my own program rimporter starts and starts reading the file like it normaly would do when I use the menu option open en select the file?

it would be handy.
 
It might be simpler to call the AssocQueryString API function, passing in "txt" extension to return the full path/name of the default text editor. Then launch it with Shell (VB function) or ShellExecute (API function) with the name of your file as a command line parameter.

Paul Bent
Northwind IT Systems
 
LordGarfield,

I see you have a number of ways to regester the extension to open your program when clicked. So I will not address this.

You did ask for the Program to be able to start reading the file. For this you need to use a command line argument of the file name, such as the following.

Code:
Private Sub ApplyCommandLine()
    Dim cmd$: cmd$ = Command
    
    If InStr(UCase(cmd$), ".rimp") Then
        Dim i As Integer
        i = InStr(1, cmd$, " ") + 1
        g_sInitFileOpen = cmd$ 'Mid(cmd$, i)
    Else
        g_sInitFileOpen = ""
    End If
    
End Sub

I personaly call the above function form sub Main. g_sInitFileOpen is declared as a global string.

After all apropriate values are initilized if g_sInitFileOpen <> &quot;&quot; load g_sInitFileOpen.

-Sean

 
>It might be simpler to call the AssocQueryString

Erm...only if your program is in control...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top