LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing Windows API Shell Execute call

I am trying to implement the Windows API call in LabVIEW named ShellExecute.  I have created the attached VI and I do not understand why it will not run correctly.  I am hoping that a user on the forum will see the problem and be able to suggest what is wrong.  Thank you for any help!
0 Kudos
Message 1 of 7
(5,413 Views)
Runs on my winXP system that was upgraded from win98. Outputs a value of 2 into the case structure. I haven't messed with this type of stuff, so I'm not sure what you expect as a result.
0 Kudos
Message 2 of 7
(5,403 Views)

It should execute and open a file you specify with the following information:

hWnd: 0
lpOperation: open
lpFile: "C:\temp\hello.doc"
lpParameters: 0
lpDirectory: 0
nShowCmd: SW_SHOWNORMAL

Of course you would specify your own file to open in this case.  When I run it on my system it doesn't open and run the file.  It should act like the Windows Run command in your start bar.

I hope this makes sense.

0 Kudos
Message 3 of 7
(5,399 Views)
It should output a value greater than 32 if it runs successfully.  Anything lower than that value is an error.
0 Kudos
Message 4 of 7
(5,399 Views)

Remove the quotation marks from the list of strings for your commands and it will work.

You also don't need them for the path, but there they don't seem to make a difference.

Also, instead of using a multi-line string, you can use a property node to get the string values of the ring and index array to pick the right string.


___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(5,395 Views)

Thanks so much!!!  I knew it should be simple.  I don't understand why all the examples I see are showing quotes around the commands and they work and why you don't need them for this case though.

Thanks again!

0 Kudos
Message 6 of 7
(5,388 Views)

Made slight changes:

  - Format into string converts an enum value to its associated string (cosmetic)

  - "0" is not the same as 0.  Use empty string to set a string param to Null under labview

  - Changed lpFile and lpDirectory to path controls and converting to string (more practical)

  - Added "def" lpOperation whitch must be passed as NULL (empty string) Of course I have set

    "def" as Default value.

 

From what I have seen, using "open" lpOperation is not always the default "def" for some file

associations but using "def" (NULL/empty string) will behave as double clicking the file in 

explorer.

0 Kudos
Message 7 of 7
(3,630 Views)