LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CreateProcess by LabVIEW

Hi Terrill,

you should wire the constructor up to the property/method node.

Could you show some code?

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 11 of 14
(1,334 Views)
I would love to show code but it consits of a constructor node, a property node and a invoke node. If I drop a constructor node on a block diagram I need to  "select .net constructor".  I need to find the constructor that will let me get to the System.Diagnostics.Process class.
0 Kudos
Message 12 of 14
(1,330 Views)
I'm guessing you are using LV 7.1. That is a problem that has been seen from time to time on that version.

However, you are in luck, because you don't need the constructor. Process has 3 Start methods which are static. Thus all you need to do is drop a .NET Invoke node, right click on the input terminal and say "Select Class". Browse to the Process class and then you can drop the method list down to pick one of the start methods.

If you are going to use .NET a lot in your application, I do strongly recommend LV 8.x and the new LV projects. It makes the work much easier.
0 Kudos
Message 13 of 14
(1,317 Views)

Lycangeek wrote:
1. Strange! I have no response to that one...

To the question why GetLastError() does not seem to work:

 

I do! Windows maintains a last error code on a per thread base. Since LabVIEW is highly multithreading the only case where you can reasonably assume that between a CLN calling some API influencing the last error and the call to GetLastError() will actually return the right thing, is only when both CLN are configured to be executed in the UI thread.

 

Even then there is no guarantee, since LabVIEW will do a lot of other things in the UI thread too, such as updating its UI and also doing synchronisation of asynchronous events. Many of these operations will at some point call Windows API functions that can change the last error code too.

 

So the use of GetLastError() through a CLN in a LabVIEW diagram is basically useless. To make this work you have to write an external C code function that executes the actual API and retrieves the error with GetLastError() and call that new function through the CLN.

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 14 of 14
(1,027 Views)