Jump to content

Associating my EXE with a specific file extension type


Recommended Posts

I was just trying to make my own version of the example work and after struggling for a couple of hours, I found the part I was missing. See my note about the code below.

REGEDIT      HKEY_CLASSES_ROOT\.TON = tonfile      HKEY_CLASSES_ROOT\tonfile = My Ton Files      HKEY_CLASSES_ROOT\tonfile\shell\open\command = "d:\tonfile\application.exe" -- "%1"      HKEY_CLASSES_ROOT\tonfile\shell\open\ddeexec = open(%1)      HKEY_CLASSES_ROOT\tonfile\shell\open\ddeexec\Application = application      HKEY_CLASSES_ROOT\tonfile\shell\open\ddeexec\Topic = System

Specifically the following line.

   HKEY_CLASSES_ROOT\tonfile\shell\open\ddeexec\Application = application

In this line, the "application" at the end of the line is referring to the executable's name without the .exe on the end. Since this article is linked in the wiki, I wanted to make that clarification evident for everyone.

Link to comment
  • 1 month later...

For some reason that does not work for me. I do have the registry keys set in the same way as in the code in the previous post, and I am using the fileLoader_JK01 for testing. Starting the application by double clicking a TON file does work, but if I try to open another TON file the application just gets into focus but nothing happens.

I am using LabView 8.51, scripting enabled.

Thanks for any help!

Link to comment
  • 5 months later...
  • 7 months later...

Ton, are you able to provide this code?

Evening all,

I can't find any record of the "Application.OS Open Document" event.

Any ideas on where to find it?

Battler.

Link to comment

Sorry,

I can't locate the code anymore, but here is a VI in 8.6 with two OS.OpenDocument Events (filter and normal).

I did not get this to work with anything other than 8.2

Ton

Thanks Ton.

From what I've read about VI Scripting I don't think using this OS.OpenDocument Event is a good idea (or even possible).

What is the best method for associating a custom file type with an application and being able to open the file when the app is both running and closed?

Link to comment

Thanks Ton.

From what I've read about VI Scripting I don't think using this OS.OpenDocument Event is a good idea (or even possible).

What is the best method for associating a custom file type with an application and being able to open the file when the app is both running and closed?

There are many ways and what is the best will depend on you. But the only one that does not involve tackling not properly working private LabVIEW methods, properties and events, or writing some bunch of C code to do the "right" © thing in a DLL and integrate that into your app, is to go about it like it is explained in the wiki. The advantage of this is also that it will basically work in all versions and platforms of LabVIEW that support the pass command line parameters feature. This is every desktop LabVIEW version since at least LabVIEW 7.0.

And I think you have all the information necessary to come up with a working solution in a day or so. So get started and show us the code, when you do not get any further.

Rolf Kalbermatter

Link to comment
  • 5 months later...
  • 2 years later...

Did you select 50-60 associated files and try to open them all at once? On a related note, I know that Win7 won't let you "multi-open" over a certain limit (which is pretty annoying sometimes).

Sorry about the lack of clarity in the earlier post. I tried to open only 1 file. If I had selected 50-60 files, tried to open them and the OS opened them, that would be the intended behavior that one wouldn't complain about.

Link to comment

Hmm. Sounds like a LabVIEW bug, rather than an implementation bug. :( Any chance you can repro it?

I'm not sure I would undersign this as a LabVIEW bug. LabVIEW doesn't instantiate new executables but the Windows shell does. For some reasons the shell thinks that the launching of the command has failed and seems to retry it in an endless loop. This looks more like a flaw in the handling of launching an executable than in LabVIEW itself, especially since the spawning of new processes seems to happen so quickly that LabVIEW hasn't even gotten a chance to already be loaded into memory and start doing anything at all, that could influence the Windows shell in such a way.

Link to comment

That could be true - I was looking at it from the perspective that LabVIEW wasn't properly acknowledging the launch and Windows was launching it again. Thinking back, though, I've never actually seen Windows retry a command like this, especially many times. On the contrary, I have seen it display a dialog stating that the command failed with particularly slow-launching on multiple occasions. Not I'm not sure where the blame may lie. Without a repro, it's very tough to guess.

Link to comment

Hmm. Sounds like a LabVIEW bug, rather than an implementation bug. :( Any chance you can repro it?

Like most other such weird issues, the application worked fine for a few days after I first built it, but (I don't know what happened and..) now it consistently displays this behavior. I'll try it out on other computers and share the experience.

Link to comment

It happens only when I enable multiple instances of my exe using the "allowmultipleinstances=true" attribute in the INI file.

If I allow only a single instance, all file open messages from the OS show up in the instance of the application that I have open. So now I have an event structure with the "OS Open Document" and a "Timeout" in my main event structure's Timeout case. For what it is worth, it is working fine.

Link to comment

It happens only when I enable multiple instances of my exe using the "allowmultipleinstances=true" attribute in the INI file.

If I allow only a single instance, all file open messages from the OS show up in the instance of the application that I have open. So now I have an event structure with the "OS Open Document" and a "Timeout" in my main event structure's Timeout case. For what it is worth, it is working fine.

Without that ini token the executable may still get started by the Windows shell, but one of the first things LabVIEW does on starting up is to try to connect a different (same version) LabVIEW instance (through DDE communication) and if it finds it it will simply pass any command line commands to that instance instead and quit gracefully.

Link to comment
  • 2 months later...

I'm experiencing the same "infinite instances" problem that Ravi observed. Does anyone know if there's a way to get both features (allowMultipleInstances and OS Open Document) to work together nicely?

My application has had OS Open Document for several months. The addition of multipleInstances is a late request by the enduser... it would require serious re-architecting to get the desired behavior with a single instance.

Thanks.

Link to comment
  • 2 years later...

Hello,

I know this an old discussion, but I'm trying to open associated files with my standalone application.

 

I used the OS Open Document condition to get the file content and it works very well on my development PC (where is installed LabVIEW). But that doesn't work on another PC where I proceeded to the installation of my standalone application.

 

I generated the application with LabVIEW 2011 and I tried to add SuperSecretPrivateSpecialStuff=True in my application INI file without any change. The application is opened and focused at each double clic on an associated file.

 

Do you have any idea to solve my problem? Is there any "instruction line" to add to my INI file?

 

Thanks in advance and best regards,
Gerald

Link to comment

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...

Important Information

By using this site, you agree to our Terms of Use.