LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign file extension and custom icon to executable?

Well, over here at LAVA you already got a lively conversation started. And a ton of links, although as you found out some of the attachment links got lost during a recent crash of the LAVA servers. The stuff is supposedly still all there but when they setup the new server they had to import everything from an old backup and that broke many links.

 

If you ask nicely the admins of that board can locate the contents and fix the links manually, so they work again.

 

Rolf Kalbermatter 

Message Edited by rolfk on 08-19-2009 09:18 AM
Rolf Kalbermatter
My Blog
0 Kudos
Message 11 of 39
(1,710 Views)

Yeah it's some exciting stuff I found over there.  I just need some examples.  I'm not sure what the final solution consists of.

 

Thanks Rolf.

0 Kudos
Message 12 of 39
(1,705 Views)

Anyone who is interested refer to this helpful thread:

 

http://lavag.org/topic/4851-associating-my-exe-with-a-specific-file-extension-type/ 

 

It would be good to get a solution sorted over here.

 

Thanks,

 

Battler. 

 

0 Kudos
Message 13 of 39
(1,621 Views)

Judging by what's been stated over there at LAVA.

 

The only way to open a custom file with your application (whether it's already open or not) is by direct use of the OS Open Document event which is enabled by installing VI scripting.  It is not recommended to use VI Scripting as it's deemed unreliable.  Have I got it right?

 

The question is it possible by another method?  Is it by using:

 

A small separate application registered to the custom file which is opened by the OS upon double-click and both a) if the main app is originally closed then it opens it (how would it do this?) and b) passes the file path (how?  TCP/IP?).  The main app would need to respond (using a case in the event structure) to the event.  How to check for and register such an event?

 

Any input is greatly appreciated.

 

Battler.

0 Kudos
Message 14 of 39
(1,616 Views)

Is ActiveX still a possibility?  Register your app as an ActiveX server...

 

I'm well confused now..

0 Kudos
Message 15 of 39
(1,614 Views)

battler. wrote:

Judging by what's been stated over there at LAVA.

 

The only way to open a custom file with your application (whether it's already open or not) is by direct use of the OS Open Document event which is enabled by installing VI scripting.  It is not recommended to use VI Scripting as it's deemed unreliable.  Have I got it right?

 

The question is it possible by another method?  Is it by using:

 

A small separate application registered to the custom file which is opened by the OS upon double-click and both a) if the main app is originally closed then it opens it (how would it do this?) and b) passes the file path (how?  TCP/IP?).  The main app would need to respond (using a case in the event structure) to the event.  How to check for and register such an event?

 

Any input is greatly appreciated.

 

Battler.


That event is not a scripting event but a private one. It means it is only meant for NI. The reason in this particular case why it is private is because it has only worked in 8.2 briefly and since has gone into a state of limbo and apparently there is no-one who has the time and interest to get that fixed AND made non private.

 

Scripting, lets call it LabVIEW API from now on, is not necesssarily unstable. It is however a highly complex matter not suited for the faint at heart. The things that work do work, those that don't do not and will fail, produce errors or sometimes simply crash. The LabVIEW API is not something to integrate into an end user application as it is for 99% unavailable in an executable build. It is there to build tools that can be run in the development system to automate things such as creating VIs from some other form of description or automate frequently occuring user actions when editing in LabVIEW.

 

About your small ShellLauncher too. What it will do in a nutshell, is attempting to contact the main app by whatever means you have selected to communicate between the two, if that fails launch the main app using System Exec (really this is trivial isn't it, and it seems to me you are getting so deep into this that you are not seeing the tree because of all the forrest anymore), and then keeps trying to contact the main app until it either succeeds or a timeout has occurred. How you pass the file path is really up to you. You have several possibilities:

 

1) Implement your own TCP/IP solution, a little server in the main app and a client in the launcher app

2) use DDE, not recommended since it is legacy technology and not plattform independant, even if you do not currently care about plattform independance in your application.

3) using VI server, you enable the VI server in your main app, and simply open a VI server connection to it, and open the VI in your main app that will open your document and execute it through VI server.

4) pipes, involves call to the system API

5 shared memory, involves calls to the system API.

 

I would personally go for 1) or 3)

 

Hmm. Actually I might also opt for 6) create my own DDE DLL that allows receiving DDE Execute commands and integrate that into my main app directly. But that is again Windows only and the helper app solution is a much more platform independant solution.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
Message 16 of 39
(1,596 Views)

Rolf,

 

Thanks for your response.

 

Q1.  How to open my main app using System Exec?  What command?  How do I point to my main app when it could be installed anywhere?  Remember this will all be part of an installer package.

 

Q2.  What is the best way to trigger an event in my main app once the ShellLauncher makes contact?

 

Battler.

0 Kudos
Message 17 of 39
(1,585 Views)

Chiming in:

Here is a feature request, please vote

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 18 of 39
(1,581 Views)
Great.  Can you help me with my questions Ton?
0 Kudos
Message 19 of 39
(1,578 Views)

battler. wrote:

Rolf,

 

Thanks for your response.

 

Q1.  How to open my main app using System Exec?  What command?  How do I point to my main app when it could be installed anywhere?  Remember this will all be part of an installer package.

 

Q2.  What is the best way to trigger an event in my main app once the ShellLauncher makes contact?

 

Battler.


1) Well you will want to add some way of locating your main app. You could for instance add that location somewhere in the user hive of the registry during installation of your application and then read that key out and use it to construct the path to your main app to pass to system exec.

 

2) There is no way to directly trigger an event. You will have to have some server component like a TCP/IP server, or in case you choose to use VI server directly, a subVI to call by reference remotely that receives the request and either takes the appropriate action itself or passes that event along to the correct place in your application using things like a message queue (if you use the producer/consumer architecture) or into a user event (if you want to use directly an event structure to handle your events without a producer/consumer architecture).

 

But my advice stands! Start coding and show us where you have trouble by uploading some code you made. We are not going to program this for you.

 

Rolf Kalbermatter

Message Edited by rolfk on 08-20-2009 12:29 PM
Rolf Kalbermatter
My Blog
Message 20 of 39
(1,575 Views)