Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Setting File Open Attributes...

I've just made a nice little code-snippet storage program, basically Notepad with fewer features and a *.code extension...got everythign set up and running smoothly...but the file-type association "open" action refuses to load the text. If I use the "Open..." dialog in my program, it runs fine. But, if I just double click on a .code file, all it does is loads the Code Program, without the code itself. Again, the file is not corrupted. I have a file association, added through View>>Folder Options>>File Types...with one command, "open", pointed at the program's directory. Do I need to add a subroutine to my program's code? Or am I missing something with the file type declarations?
1 Solution
Make sure the open action has a %1 after it to represent the file.

"C:\SomeDir\MyApp.exe" "%1"

Then I think you will need to tell your app to open the file that is represented by %1.You could use Command$ for this:

Private Sub Form_Activate()
If Command$ <> "" Then
    ' command$ will represent the filename
    ' load file here
    MsgBox Command$
End If
End Sub

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now