Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have made an editor that should read text files.

 

When I am in the editor and press the open file, It opens text file without problem.

 

when I double click on txt file I would expect that this editors open the file, but instead it opens the editor, but it never show the cotents of the file.

 

It is like the openfile function never get called. Somebody experience the same ?

 

What function does it jumps to, when I double click on a txt file ?

Posted

If I recall correctly, when you open a file in this fashion, the filename is a parameter.

 

I remember doing something like this with context menus. I had it where I would get a different menu depending on which file type I clicked on and what was highlighted.

 

Edit:

 

http://www.xtremedotnettalk.com/showthread.php?t=87467&highlight=context

 

This is the thread I have on it. I'm a bit fuzzy on the specific details as this was a long time ago, but I hope this helps

  • *Experts*
Posted
I could be wrong, but I think Jedhi is refering to double clicking a saved file's icon. If so then you'll need to register your application and icon association through VS's MSI deployment package or a third party's setup and installation program.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

Yes, Jedhi says that the saved file opens the appropriate application, but doesn't load the file that was chosen.

 

There might be a 3rd party way to do it, but the only way I figured out how to do it would be to check the parameters for the filename and load the file.

  • *Experts*
Posted

Hi Denaes,

 

That's exactly what I refered to. This is accomplished through the VS MSI Deployment package or a third party's setup and installation program (like InstallShield or QSetup) by registering the application and icon in Windows.

 

btw. I absolutely love your avatar!

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

Hi Folks,

 

Command line parameters are passed in to the Main function as an array. So you could add somthing like this:

 

Public Sub Main(ByVal strAgs() As String)

 

Dim intCounter As Integer

Dim strArgument As String

 

For intCounter = 0 To strAgs.GetUpperBound(0)

strArgument = strAgs(intCounter)

 

If File.Exists(strArgument) Then

'Open file and launch main program screen here

End If

Next

 

End Sub

 

You will obviously have to set up your start up object to Sub Main. You can also set up a command line parameter in the projects 'Configuration properties' then 'debugging'. This will allow you to test the sub main procedure.

 

To set up a file association in Windows for your application, you have to set up a few registry keys. Some installation authoring programs such as Installshield etc do this for you. I have the code to create these keys etc if anybody wants these post back, I'll then post them here for you.

 

Cheers

 

CM :rolleyes:

Posted
Hi Denaes,

 

That's exactly what I refered to. This is accomplished through the VS MSI Deployment package or a third party's setup and installation program (like InstallShield or QSetup) by registering the application and icon in Windows.

 

::shrugs:: different ways of approaching the same problem. My knee jerk response to a programming problem is to normally figure something out programatically.

 

Your way is most definately easier and faster though. As the post above shows, doing it programatically might take some redesigning and effort to impliment - but might be a requirement if a program will handle different filetypes differently.

 

btw. I absolutely love your avatar!

 

Thank you. I wish I'd done it myself.

 

EFileTahi-A does his own Avatars in a similar vein and has some that I'm very jealous of.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...