<?xml version="1.0"?>
<rss version="2.0"><channel><title>Calling External Code Latest Topics</title><link>https://lavag.org/forum/25-calling-external-code/</link><description>Calling External Code Latest Topics</description><language>en</language><item><title>Help me parse this overcomplicated dll (pcProxAPI)</title><link>https://lavag.org/topic/59167-help-me-parse-this-overcomplicated-dll-pcproxapi/</link><description><![CDATA[<p>
	I don't think I can attach the .dll itself since it isn't my code, but I think I can reasonably share the relevant snippets.
</p>

<p>
	First, I'd like to clarify that the manufacturer provided example code in Python, which works fine. 
</p>

<p>
	I've tried this both using the wizard, and Call Library Function Nodes. I must say, I don't really understand the wizard at all, as it seems to make no attempt to actually parse the provided .h file (it complains about missing preprocessor definitions, which as far as I can tell are already in the .h file, and it complains about e.g. windows.h not being found, even when I explicitly add its complete path to the "Include Paths" section).
</p>

<p>
	Tbh I'm not remotely sure what, if anything, I need to add to includes and preprocessor definitions. 
</p>

<p>
	Using the Function Node, LabVIEW immediately crashes, despite my attempt to follow the examples (see my .vi).
</p>

<p>
	Here's the key call which works in Python:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">pcproxlib.usbConnect.restype = ctypes.c_short
rc = pcproxlib.usbConnect()
if rc == 1:
	rawData = ""
    buffer_size = ctypes.c_short(32)
    pcproxlib.GetActiveID32.restype = ctypes.c_short
    # create a buffer of given size to pass it
    # to get the raw data.
    raw_data_tmp = (ctypes.c_ubyte * buffer_size.value)()
    #as per documentation 250 millisecond sleep is required
    # to get the raw data.
    time.sleep(250/1000.0)
    nbBits = pcproxlib.GetActiveID32(raw_data_tmp , buffer_size)
pcproxlib.USBDisconnect.restype = ctypes.c_short
pcproxlib.USBDisconnect()</span></pre>

<p>
	I've attached the .h file, and the .vi file of my failed attempt at using the Function Node. 
</p>

<p>
	How on earth is one supposed to figure all this out <em>de novo?</em>
</p>

<p>
	<a class="ipsAttachLink" data-fileext="h" data-fileid="22638" href="https://lavag.org/applications/core/interface/file/attachment.php?id=22638&amp;key=4b4941124728d92477d468c238c7cd5c" rel="">pcProxAPI.h</a> <a class="ipsAttachLink" data-fileext="vi" data-fileid="22639" href="https://lavag.org/applications/core/interface/file/attachment.php?id=22639&amp;key=bbb53aef0c6e5511f09b9bd5c668c299" rel="">pcProxAPI test.vi</a>
</p>
]]></description><guid isPermaLink="false">59167</guid><pubDate>Tue, 25 Nov 2025 22:23:11 +0000</pubDate></item><item><title>Controlling PTZ functionality of an ONIF camera from LABVIEW</title><link>https://lavag.org/topic/53613-controlling-ptz-functionality-of-an-onif-camera-from-labview/</link><description><![CDATA[<p>
	I can get the RTSP stream (Audio+Video) from this camera into LabVIEW with no issues. I need to control the PTZ functionality. 
</p>

<p>
	I used Wireshark to capture the coms between the PC and the camera unit while sending the Pan  Tilt and Zoom calls from a customer provided software. I also have SDK file from camera folks.
</p>

<p>
	I have limited experience in creating CIN nodes from DLL. I was hoping that instead of creating CIN nodes to control PTZ functions, i can do the same over TCP/UDP interface. I was also wondering if *.pcapng captured using Wireshark has that information.
</p>

<p>
	Can some one review the info and let me know if it's possible? I can provide SDK if some interested.
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2025_02/JennovONIFCamera.png.a34ed2d3f695ae9699d8eda7439f7737.png" data-fileid="22340" data-fileext="png" rel=""><img alt="Jennov ONIF Camera.png" class="ipsImage ipsImage_thumbnailed" data-fileid="22340" data-ratio="33.49" style="height:auto;" width="1090" data-src="https://lavag.org/uploads/monthly_2025_02/JennovONIFCamera.png.a34ed2d3f695ae9699d8eda7439f7737.png" src="https://lavag.org/applications/core/interface/js/spacer.png" /></a>
</p>

<p>
	<a class="ipsAttachLink" data-fileext="pdf" data-fileid="22341" href="https://lavag.org/applications/core/interface/file/attachment.php?id=22341&amp;key=b85f7c1864433686d03a68cfdc85ebfd" rel="">Description of DLL AJNetSDK.pdf</a> <a class="ipsAttachLink" data-fileext="pcapng" data-fileid="22342" href="https://lavag.org/applications/core/interface/file/attachment.php?id=22342&amp;key=45f7ae30b10bc86d4fcee66f347b68d0" rel="">PTZ Cam data.pcapng</a>
</p>

<p><a href="https://lavag.org/uploads/monthly_2025_02/LVVLCscreenshot.png.8879766773ec3dd858a33891a9613a6b.png" class="ipsAttachLink ipsAttachLink_image" ><img data-fileid="22343" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2025_02/LVVLCscreenshot.png.8879766773ec3dd858a33891a9613a6b.png" data-ratio="59.7" width="1134" class="ipsImage ipsImage_thumbnailed" alt="LV VLC screen shot.png"></a></p>]]></description><guid isPermaLink="false">53613</guid><pubDate>Sun, 16 Feb 2025 01:38:19 +0000</pubDate></item><item><title>passing arrays in C dll to labview</title><link>https://lavag.org/topic/43704-passing-arrays-in-c-dll-to-labview/</link><description><![CDATA[<p>
	I am trying to pass a 2d array initialized with large data in my c dll to labview, but no matter what I only get a pointer to the array at best shot. I want to get the array as return type from the function I get  when I use labview shared library wizard.<br />
	 
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="com">#include</span><span class="str">&lt;stdlib.h&gt;</span><span class="pln">
</span><span class="com">#include</span><span class="str">&lt;stdio.h&gt;</span><span class="pln">
</span><span class="com">#include</span><span class="str">&lt;stdint.h&gt;</span><span class="pln">
__declspec</span><span class="pun">(</span><span class="pln">dllexport</span><span class="pun">)</span><span class="pln"> </span><span class="typ">int</span><span class="pun">*</span><span class="pln"> get_results</span><span class="pun">(){</span><span class="pln">

</span><span class="typ">int</span><span class="pln"> </span><span class="pun">*</span><span class="typ">array</span><span class="pun">;</span><span class="pln">
</span><span class="typ">array</span><span class="pun">=</span><span class="pln">malloc</span><span class="pun">(</span><span class="lit">3</span><span class="pun">*</span><span class="lit">3</span><span class="pun">*</span><span class="kwd">sizeof</span><span class="pun">(</span><span class="typ">int8_t</span><span class="pun">));</span><span class="pln">
</span><span class="typ">int</span><span class="pln"> a</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="typ">int</span><span class="pln"> y</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln">y</span><span class="pun">&lt;</span><span class="lit">3</span><span class="pun">;</span><span class="pln">y</span><span class="pun">++){</span><span class="pln">
    </span><span class="kwd">for</span><span class="pun">(</span><span class="typ">int</span><span class="pln"> x</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln">x</span><span class="pun">&lt;</span><span class="lit">3</span><span class="pun">;</span><span class="pln">x</span><span class="pun">++){</span><span class="pln">
        </span><span class="typ">int</span><span class="pln"> index</span><span class="pun">=</span><span class="pln">y</span><span class="pun">*</span><span class="lit">3</span><span class="pun">+</span><span class="pln">x</span><span class="pun">;</span><span class="pln">
        </span><span class="typ">array</span><span class="pun">[</span><span class="pln">index</span><span class="pun">]=</span><span class="pln">a</span><span class="pun">;</span><span class="pln">
        a</span><span class="pun">++;</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">return</span><span class="pln"> </span><span class="typ">array</span><span class="pun">;</span><span class="pln">

</span><span class="pun">}</span></pre>

<p>
	for this I get "get results.vi" which after running it I only get a negative number.<br />
	and for this one <span>:</span>
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="pln">__declspec</span><span class="pun">(</span><span class="pln">dllexport</span><span class="pun">)</span><span class="pln"> </span><span class="typ">int</span><span class="pln"> get_results</span><span class="pun">(){</span><span class="pln">

</span><span class="typ">int</span><span class="pln"> </span><span class="pun">*</span><span class="typ">array</span><span class="pun">;</span><span class="pln">
</span><span class="typ">array</span><span class="pun">=</span><span class="pln">malloc</span><span class="pun">(</span><span class="lit">3</span><span class="pun">*</span><span class="lit">3</span><span class="pun">*</span><span class="kwd">sizeof</span><span class="pun">(</span><span class="typ">int8_t</span><span class="pun">));</span><span class="pln">
</span><span class="typ">int</span><span class="pln"> a</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="typ">int</span><span class="pln"> y</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln">y</span><span class="pun">&lt;</span><span class="lit">3</span><span class="pun">;</span><span class="pln">y</span><span class="pun">++){</span><span class="pln">
    </span><span class="kwd">for</span><span class="pun">(</span><span class="typ">int</span><span class="pln"> x</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln">x</span><span class="pun">&lt;</span><span class="lit">3</span><span class="pun">;</span><span class="pln">x</span><span class="pun">++){</span><span class="pln">
        </span><span class="typ">int</span><span class="pln"> index</span><span class="pun">=</span><span class="pln">y</span><span class="pun">*</span><span class="lit">3</span><span class="pun">+</span><span class="pln">x</span><span class="pun">;</span><span class="pln">
        </span><span class="typ">array</span><span class="pun">[</span><span class="pln">index</span><span class="pun">]=</span><span class="pln">a</span><span class="pun">;</span><span class="pln">
        a</span><span class="pun">++;</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">return</span><span class="pln"> </span><span class="pun">*</span><span class="typ">array</span><span class="pun">;</span><span class="pln">

</span><span class="pun">}</span></pre>

<p>
	I got get results1.vi which I get nothing after running the vi.<br />
	I don't know how should I make the function or dll that I get the array from the vi that shared library wizard gives me<br />
	please help me
</p>
<p>
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=20989&amp;key=cf0354ad6ad2ae7ca1ac899cd9509758" data-fileExt='vi' data-fileid='20989' data-filekey='cf0354ad6ad2ae7ca1ac899cd9509758'>get results1.vi</a> 
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=20988&amp;key=3677740627673ba9c45a626ad8bb6663" data-fileExt='vi' data-fileid='20988' data-filekey='3677740627673ba9c45a626ad8bb6663'>get results.vi</a></p>]]></description><guid isPermaLink="false">43704</guid><pubDate>Thu, 05 Sep 2024 14:44:50 +0000</pubDate></item><item><title>What is the best way to handle errors for external DLL/C code,</title><link>https://lavag.org/topic/23847-what-is-the-best-way-to-handle-errors-for-external-dllc-code/</link><description><![CDATA[<p>
	Hello all,
</p>

<p>
	<strong>background</strong>
</p>

<p>
	A while ago I wrote <span>a dll wrapper to get data from </span>dedicated test-hardware. For this hardware there is a dll available.  To use this dll you need to use an callback function. If you need to use a dll in Labview which needs a callback you need to write the callback in C code and use a Labview C lib to get the data into Labview, basically my dll takes care of this problem .
</p>

<p>
	<strong>Enhance the code and way of working more efficient</strong>
</p>

<p>
	The code I wrote code works fine. However I did not use / test it for hours on a row. And sometimes If I make a mistake when changing the code I run into problems. I was able to fix all the errors and problems however it was not the most efficient way of working. For instance If there  is a serious error in the code the dll I need for the hardware can crash, it can make my wrapper crash, which will in return make Labview crash. This makes the way of coding inefficiënt and it will not enable me to read my C++ book etc etc.
</p>

<p>
	<strong>Example pseudo code</strong>
</p>

<p>
	I did try to extract some main points of intrest from the code, I did add some comment in the code. I hope someone can give me some general guideline or advice what to read.
</p>

<p>
	At this time I am reading:
</p>

<p>
	<a href="https://learn.microsoft.com/en-us/cpp/cpp/unhandled-cpp-exceptions?view=msvc-170" rel="external nofollow">Unhandled C++ exceptions</a>
</p>

<p>
	I think I might be able to use it, I did not use this before so advice would be welcome.
</p>

<p>
	 
</p>

<p>
	Thank you all for the help !
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="com">// ..</span><span class="pln">
</span><span class="com">// This is a part of the code only intended to have a talk about how to catch errors </span><span class="pln">
</span><span class="com">// It is not complete and intended as Pseudo code</span><span class="pln">
</span><span class="com">// ..</span><span class="pln">


</span><span class="typ">int</span><span class="pln"> __stdcall </span><span class="typ">MyDriverLoads</span><span class="pun">(</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">int</span><span class="pln"> </span><span class="typ">NumberToInitialise</span><span class="pun">,</span><span class="kwd">const</span><span class="pln"> </span><span class="kwd">bool</span><span class="pln"> enableAnotherOption </span><span class="pun">,</span><span class="pln"> </span><span class="kwd">const</span><span class="pln"> </span><span class="kwd">char</span><span class="pln"> </span><span class="pun">*</span><span class="kwd">const</span><span class="pln"> path </span><span class="pun">,</span><span class="pln"> </span><span class="typ">LVUserEventRef</span><span class="pln"> </span><span class="pun">*</span><span class="pln">rwer</span><span class="pun">)</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
		
	</span><span class="com">// loads the dll </span><span class="pln">
	</span><span class="com">// Q -- I can check if (F_functionname !=0), if it is not 0 then I can proceed if the function returns 0 I can return an error to Labview</span><span class="pln">
	</span><span class="typ">Extern_dll</span><span class="pln"> </span><span class="pun">=</span><span class="pln">	</span><span class="typ">Load_Extern_dll</span><span class="pun">();</span><span class="pln">
		
	</span><span class="com">// Get the functions I need from the dll</span><span class="pln">
	p2_ExternDriver F_ExternDriver </span><span class="pun">=</span><span class="pln"> 	</span><span class="pun">(</span><span class="pln">p2_ExternDriver</span><span class="pun">)</span><span class="typ">GetProcAddress</span><span class="pun">(</span><span class="typ">Extern_dll</span><span class="pun">,</span><span class="pln"> </span><span class="str">"_ExternDriver"</span><span class="pun">);</span><span class="pln">
	
	p2_Initialise F_Initialise </span><span class="pun">=</span><span class="pln"> 		</span><span class="pun">(</span><span class="pln">p2_Initialise</span><span class="pun">)</span><span class="typ">GetProcAddress</span><span class="pun">(</span><span class="typ">Extern_dll</span><span class="pun">,</span><span class="pln"> </span><span class="str">"_Initialise"</span><span class="pun">);</span><span class="pln">	
	p2_AdapterCount F_AdapterCount </span><span class="pun">=</span><span class="pln"> 	</span><span class="pun">(</span><span class="pln">p2_AdapterCount</span><span class="pun">)</span><span class="typ">GetProcAddress</span><span class="pun">(</span><span class="typ">Extern_dll</span><span class="pun">,</span><span class="pln"> </span><span class="str">"_AdapterCount"</span><span class="pun">);</span><span class="pln">	
	p2_StartLogging F_StartLogging </span><span class="pun">=</span><span class="pln"> 	</span><span class="pun">(</span><span class="pln">p2_StartLogging</span><span class="pun">)</span><span class="typ">GetProcAddress</span><span class="pun">(</span><span class="typ">Extern_dll</span><span class="pun">,</span><span class="pln"> </span><span class="str">"_StartLogging"</span><span class="pun">);</span><span class="pln">	

	p2_StopLogging F_StopLogging </span><span class="pun">=</span><span class="pln"> 		</span><span class="pun">(</span><span class="pln">p2_StopLogging</span><span class="pun">)</span><span class="typ">GetProcAddress</span><span class="pun">(</span><span class="typ">Extern_dll</span><span class="pun">,</span><span class="pln"> </span><span class="str">"_StopLogging"</span><span class="pun">);</span><span class="pln">	
	
	
	</span><span class="com">// When there are adapters found I tell it in Labview</span><span class="pln">
	adapterCount </span><span class="pun">=</span><span class="pln"> F_AdapterCount</span><span class="pun">();</span><span class="pln">
	
	
	</span><span class="com">// Get the callback function adress, if adress == 0 I can see something is wrong</span><span class="pln">
	</span><span class="kwd">void</span><span class="pun">(</span><span class="pln">__stdcall </span><span class="pun">*</span><span class="typ">p2_CallbackFunction_t</span><span class="pun">)</span><span class="pln"> </span><span class="pun">(</span><span class="pln">pt2Obj </span><span class="pun">,</span><span class="pln"> </span><span class="kwd">const</span><span class="pln"> </span><span class="typ">LogData</span><span class="pln"> </span><span class="pun">&amp;</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">&amp;</span><span class="typ">CallbackFunction</span><span class="pun">;</span><span class="pln">
	
	
	</span><span class="com">// Q -- I could use try {} and catch {} however I do not have acces to the source code of the dll so,</span><span class="pln">
	</span><span class="com">//		I do not know if they used </span><span class="pln">
	</span><span class="com">//			trow "The Blue error" , or</span><span class="pln">
	</span><span class="com">//			trow "The Red error"</span><span class="pln">
	
	ret </span><span class="pun">=</span><span class="pln"> F_ExternDriver</span><span class="pun">(</span><span class="pln">adapterCount</span><span class="pun">,</span><span class="pln"> enableLogFile</span><span class="pun">,</span><span class="pln"> path</span><span class="pun">,</span><span class="pln"> </span><span class="pun">*</span><span class="typ">p2_CallbackFunction_t</span><span class="pun">,</span><span class="pln"> pt2Obj</span><span class="pun">);</span><span class="pln">
	
	</span><span class="com">// This tels the dll to start logging before this command you will not receive data in Labview</span><span class="pln">
	ret F_StartLogging</span><span class="pun">(</span><span class="lit">1</span><span class="pun">,</span><span class="lit">2</span><span class="pun">,</span><span class="lit">3</span><span class="pun">);</span><span class="pln">
	
	</span><span class="com">// Labview is receiving data thats great !!!</span><span class="pln">
	
	</span><span class="kwd">return</span><span class="pln"> ret</span><span class="pun">;</span><span class="pln">
	</span><span class="com">// Q -- Labview has been receiving data for a hour what happens if the used extern dll crashes ??</span><span class="pln">
	</span><span class="com">//		If the dll crashes when return is passed I can not use try() and catch anymore.</span><span class="pln">
	</span><span class="com">// </span><span class="pln">
		
	</span><span class="pun">}</span><span class="pln">
	
	


	</span><span class="kwd">extern</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> __stdcall </span><span class="typ">CallbackFunction</span><span class="pun">(</span><span class="pln">pt2Obj </span><span class="pun">,</span><span class="pln"> </span><span class="kwd">const</span><span class="pln"> </span><span class="typ">LogData</span><span class="pln"> </span><span class="pun">&amp;</span><span class="pln"> </span><span class="pun">)</span><span class="pln">
		</span><span class="pun">{</span><span class="pln">
		</span><span class="com">// There is a lot to do here </span><span class="pln">
		</span><span class="com">// do stuff!!</span><span class="pln">
		</span><span class="com">// I did not write everything here</span><span class="pln">
		
		err </span><span class="pun">=</span><span class="pln"> </span><span class="typ">PostLVUserEvent</span><span class="pun">(*</span><span class="pln">event_ref</span><span class="pun">,</span><span class="pln"> </span><span class="pun">&amp;</span><span class="pln">tmpEvent</span><span class="pun">);</span><span class="pln">
	
		</span><span class="pun">}</span></pre>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">23847</guid><pubDate>Thu, 28 Mar 2024 14:25:58 +0000</pubDate></item><item><title>Can someone help me with an example for an existing wrapper DLL which uses function pointer with callback function</title><link>https://lavag.org/topic/22877-can-someone-help-me-with-an-example-for-an-existing-wrapper-dll-which-uses-function-pointer-with-callback-function/</link><description><![CDATA[<p>
	Hello I hope someone can help me, I have been trying to get this to work for days but no success yet.
</p>

<p>
	 
</p>

<p>
	<strong>What I want to do</strong>
</p>

<p>
	I got a dll with a wrapper, this dll and wrapper can be used for a special datalogger. The wrapper contains multiple functions, I have got some of them working using a CLFN, for instance I can read a jumper setting from the datalogger in LabView. So far everything is fine.
</p>

<p>
	Of course I am not that interested in the jumper setting, I would rather use the datalogger to log data.
</p>

<p>
	I need to run one function to start logging. When there is enough data in the databuffer of the driver dll it will call a callback function I need to write in Labview, here is the function which starts the logging as described in the header file:
</p>

<p>
	<span> </span>
</p>

<p>
	Int LOGEXPORT __sdcall LOG_StartLogging{const char ** logFilename, ptLogCallbackfunction ptFunction, ptObject ptObject}
</p>

<p>
	<b>logFilename</b> needs to be a NULL pointer, from my understanding I do not need to do anything with it. Only provide it. If I do not do anything with it some data is saved at a default location.
</p>

<p>
	<b>ptLogCallbackfunction, </b>as far as I know I need to provide a pointer to the callback function
</p>

<p>
	<b>ptObject ptObject, </b>this must be a void pointer
</p>

<p>
	<b><span> </span></b>
</p>

<p>
	The header also provided how the callback function could look like in <span class="ipsEmoji">😄</span>
</p>

<p>
	 
</p>

<p>
	Void __stdcall callbackLog(ptObject object, const int ArraySize, const StructLogdata *const logDataArray)
</p>

<p>
	{
</p>

<p>
	// copy data from logDataArray for use in my code
</p>

<p>
	}
</p>

<p>
	 
</p>

<p>
	StructLogdata is a struct with different datatypes.
</p>

<p>
	 
</p>

<p>
	<b>What I did try </b>
</p>

<p>
	I did a search on internet there are some examples about callback functions, most of them point to NET and active X. They use a reg Event Callback. I did read the helpfile at the end of the helpfile there is the text:
</p>

<p>
	“Use the Event structure or the Register For Events function to register and handle non-.NET or non-ActiveX events dynamically” I am having a hard time to find a proper example. I did find this site with some information:
</p>

<p>
	<a href="https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8XJSA0&amp;l=nl-NL" rel="external nofollow">https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8XJSA0&amp;l=nl-NL</a>
</p>

<p>
	and this one about the refnum:
</p>

<p>
	<span style="color:#000000;"><a href="https://forums.ni.com/t5/LabVIEW/Passing-Event-Refnum-to-Call-Library-Function/td-p/4107748" rel="external nofollow">https://forums.ni.com/t5/LabVIEW/Passing-Event-Refnum-to-Call-Library-Function/td-p/4107748</a> </span>
</p>

<p>
	So I did make a user event, I wired a static Vi ref containing a callback vi to the input of this user event. I did wire the user event to a Reg event and wired the event registration refnum to the start logging dll call library function node function pointer input and also to an event structure. I did place a counter in the event structure. But nothing happens besides for an exception which makes Labview crash.
</p>

<p>
	The parameters I did use in the call library function are:
</p>

<p>
	logFilename: type numeric, datatype: Signed Pointer-sized int Pass: pointer to value
</p>

<p>
	ptLogCallbackfunction: type: adapt to type, Data format handles by value (tried all options)
</p>

<p>
	ptObject: same as logFilename
</p>

<p>
	 
</p>

<p>
	I did try a lot of different things. Writing them in this post will result in chaos and I don’t want that. I hope someone can help me with a simple example how to make this work, or point me into the correct direction.
</p>

<p>
	Thank you all for the help!
</p>
]]></description><guid isPermaLink="false">22877</guid><pubDate>Sun, 15 Jan 2023 14:06:41 +0000</pubDate></item><item><title>Send cluster / struct from dll with a couple of int's AND a string of text to Labview</title><link>https://lavag.org/topic/23177-send-cluster-struct-from-dll-with-a-couple-of-ints-and-a-string-of-text-to-labview/</link><description><![CDATA[<p>
	Hello to you all,
</p>

<p>
	<strong>Sending a cluster with int's</strong>
</p>

<p>
	I did manage to send an array with clusters from a dll to Labview. Thank you all for the help. You can find the link here:
</p>

<p>
	<a href="https://lavag.org/topic/22877-can-someone-help-me-with-an-example-for-an-existing-wrapper-dll-which-uses-function-pointer-with-callback-function/#comment-147496" rel="">https://lavag.org/topic/22877-can-someone-help-me-with-an-example-for-an-existing-wrapper-dll-which-uses-function-pointer-with-callback-function/#comment-147496</a>
</p>

<p>
	It works fine I am very pleased with it. <span class="ipsEmoji">😃</span>
</p>

<p>
	<strong>Sending a text string </strong>
</p>

<p>
	I did got a example here: 
</p>

<p>
	<a href="https://forums.ni.com/t5/Example-Code/Posting-Events-to-a-LabVIEW-Event-Structure-From-a-Dll/ta-p/3996283" rel="external nofollow">https://forums.ni.com/t5/Example-Code/Posting-Events-to-a-LabVIEW-Event-Structure-From-a-Dll/ta-p/3996283</a>
</p>

<p>
	Tested it and it works fine. Again I am happy <span class="ipsEmoji">😃</span>
</p>

<p>
	<strong>Sending a cluster with int's AND a string</strong>
</p>

<p>
	Now I want to send a cluster / struct with a couple of int's <strong>AND</strong> a string of text. I Got a example of how to send text from a C / C++ wrapper to Labview, can someone please help me out? The thing I do not get is, how to combine the both examples. Is "sizeof(structSample)" valid with a LStrHandle in it? How do I copy the data from the string to the struct, etc. Can someone change the code example or help me with the example so it works? I did add some text to the example code to make it more clear I added +++ signs in my comment in the code.
</p>

<p>
	 
</p>

<p>
	Hope someone can help me. Thanx !
</p>

<p>
	 
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="com">// LVUserEvent.cpp : Defines the entry point for the DLL application.</span><span class="pln">
</span><span class="com">//</span><span class="pln">

</span><span class="com">#include</span><span class="pln"> </span><span class="str">"stdafx.h"</span><span class="pln">
</span><span class="com">#include</span><span class="pln"> </span><span class="str">&lt;stdio.h&gt;</span><span class="pln">
</span><span class="com">#include</span><span class="pln"> </span><span class="str">"LVUserEvent.h"</span><span class="pln">

</span><span class="com">#define</span><span class="pln"> STRING_LENGHT </span><span class="lit">256</span><span class="pln">				</span><span class="com">//Can be any size</span><span class="pln">

</span><span class="com">// ++++ I want to send this Cluster/Struct to Labview</span><span class="pln">
</span><span class="kwd">typedef</span><span class="pln"> </span><span class="kwd">struct</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
		</span><span class="typ">int</span><span class="pln"> firstInt</span><span class="pun">;</span><span class="pln">
		</span><span class="typ">int</span><span class="pln"> secondInt</span><span class="pun">;</span><span class="pln">
		</span><span class="typ">int</span><span class="pln"> thirdInt
</span><span class="com">// +++++ I try to add this, Gues this will not work .. see extcode.h 		</span><span class="pln">
        </span><span class="typ">LStrHandle</span><span class="pln"> textString</span><span class="pun">[</span><span class="pln">TEXT_STRING_SIZE</span><span class="pun">];</span><span class="pln">        
		</span><span class="pun">}</span><span class="pln">structSample</span><span class="pun">;</span><span class="pln">										

</span><span class="kwd">typedef</span><span class="pln"> </span><span class="kwd">struct</span><span class="pun">{</span><span class="pln">
        </span><span class="typ">int32_t</span><span class="pln"> size</span><span class="pun">;</span><span class="pln">
        structSample elm</span><span class="pun">[</span><span class="lit">1</span><span class="pun">];</span><span class="pln">
   </span><span class="pun">}</span><span class="pln">totalstructSample</span><span class="pun">,</span><span class="pln"> </span><span class="pun">**</span><span class="pln">structHdl




LVUSEREVENT_API </span><span class="kwd">void</span><span class="pln"> </span><span class="typ">SendEvent</span><span class="pun">(</span><span class="typ">LVUserEventRef</span><span class="pln"> </span><span class="pun">*</span><span class="pln">rwer</span><span class="pun">)</span><span class="pln">
</span><span class="pun">{</span><span class="pln">
	</span><span class="typ">LStrHandle</span><span class="pln"> newStringHandle</span><span class="pun">;</span><span class="pln">

	</span><span class="com">//Allocate memory for a LabVIEW string handle using LabVIEW's</span><span class="pln">
	</span><span class="com">//memory manager functions.</span><span class="pln">
	newStringHandle</span><span class="pun">=(</span><span class="typ">LStrHandle</span><span class="pun">)</span><span class="typ">DSNewHandle</span><span class="pun">(</span><span class="kwd">sizeof</span><span class="pun">(</span><span class="typ">int32</span><span class="pun">)+</span><span class="pln">STRING_LENGHT</span><span class="pun">*</span><span class="kwd">sizeof</span><span class="pun">(</span><span class="pln">uChar</span><span class="pun">));</span><span class="pln">
	
	</span><span class="com">// +++++ OW no another one ... </span><span class="pln">
	structHdl </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">eventHdl</span><span class="pun">)</span><span class="typ">DSNewHandle</span><span class="pun">(</span><span class="kwd">sizeof</span><span class="pun">(</span><span class="pln">totalstructSample</span><span class="pun">));</span><span class="pln">
	
	
	
	</span><span class="typ">Sleep</span><span class="pun">(</span><span class="lit">2000</span><span class="pun">);</span><span class="pln">
	</span><span class="typ">PopulateStringHandle</span><span class="pun">(</span><span class="pln">newStringHandle</span><span class="pun">,</span><span class="str">"+++ Dear int I don't want you in my PostLVUserEvent"</span><span class="pun">);</span><span class="pln">
	
	</span><span class="com">//Post event to Event structure. Refer to "Using External Code</span><span class="pln">
	</span><span class="com">//with LabVIEW manual for information about this function.</span><span class="pln">
	</span><span class="typ">PostLVUserEvent</span><span class="pun">(*</span><span class="pln">rwer</span><span class="pun">,(</span><span class="kwd">void</span><span class="pln"> </span><span class="pun">*)&amp;</span><span class="pln">newStringHandle</span><span class="pun">);</span><span class="pln">



	</span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">void</span><span class="pln"> </span><span class="typ">PopulateStringHandle</span><span class="pun">(</span><span class="typ">LStrHandle</span><span class="pln"> lvStringHandle</span><span class="pun">,</span><span class="kwd">char</span><span class="pun">*</span><span class="pln"> stringData</span><span class="pun">)</span><span class="pln">
</span><span class="pun">{</span><span class="pln">
	</span><span class="com">//Empties the buffer</span><span class="pln">
	memset</span><span class="pun">(</span><span class="typ">LStrBuf</span><span class="pun">(*</span><span class="pln">lvStringHandle</span><span class="pun">),</span><span class="str">'\0'</span><span class="pun">,</span><span class="pln">STRING_LENGHT</span><span class="pun">);</span><span class="pln">
	
	</span><span class="com">//Fills the string buffer with stringData</span><span class="pln">
	sprintf</span><span class="pun">((</span><span class="kwd">char</span><span class="pun">*)</span><span class="typ">LStrBuf</span><span class="pun">(*</span><span class="pln">lvStringHandle</span><span class="pun">),</span><span class="str">"%s"</span><span class="pun">,</span><span class="pln">stringData</span><span class="pun">);</span><span class="pln">
	
	</span><span class="com">//Informs the LabVIEW string handle about the size of the size</span><span class="pln">
	</span><span class="typ">LStrLen</span><span class="pun">(*</span><span class="pln">lvStringHandle</span><span class="pun">)=</span><span class="pln">strlen</span><span class="pun">(</span><span class="pln">stringData</span><span class="pun">);</span><span class="pln">
	
	</span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">23177</guid><pubDate>Fri, 12 May 2023 21:02:03 +0000</pubDate></item><item><title>Office 365/Excel and ActiveX</title><link>https://lavag.org/topic/22952-office-365excel-and-activex/</link><description><![CDATA[<p>
	Has anyone ported any code using ActiveX from Excel 2016 to 365 , is it seamless ? somehow i figure it isnt... to be honest I know nothign about 365.
</p>

<p>
	I have several apps that rely heavily on Excel 2016 , I cant use the report generation stuff since some of the machines do not have LabVIEW (2019) Pro only base or full.
</p>

<p>
	unfortunatly I cant rely on IT to warn me when they are going to switch ... 
</p>

<p>
	TIA
</p>

<p>
	Dan
</p>
]]></description><guid isPermaLink="false">22952</guid><pubDate>Thu, 16 Feb 2023 23:54:44 +0000</pubDate></item><item><title>[Help needed] Calling python script for Astronomy application</title><link>https://lavag.org/topic/22954-help-needed-calling-python-script-for-astronomy-application/</link><description><![CDATA[<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	Hi All,
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	I am trying to implement a Python script in LabVIEW to convert FITS file into visible image (JPG,PNG).
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	My progress so far:
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	1. I am able to call a simple Python script and it runs perfectly (AddTwoDoubles).
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	2. I am able to download and display an image on Jupyter (see screenshot <em>Result on Jupyter.png</em>)
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	3. I downloaded Jupyter notebook file as Python file (<em>FITS to JPG converter.py</em>), trying to call it in LabVIEW (see snippet <em>Call_python_script.png</em>).
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	My issues:
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	1. When I call the Python script without indicating a<span> </span><em>Function,</em><span> </span>LabVIEW gave me an error (<em>error out.png</em>) saying Function could not be found in the module. I wonder if I can just call the script without calling any function and the script can be executed thoroughly?
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	2. In case the script can be executed, how do I display plotted image in LabVIEW?
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	Does anybody have experience or idea on this issue?
</p>

<p style="background-color:#ffffff;color:#333333;font-size:16px;padding:0px;text-align:left;">
	Thank you for your time checking my post!
</p>

<p><a href="https://lavag.org/uploads/monthly_2023_02/Call_python_script.png.7294aedb93fec0400bf15d56643713ed.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="17509" src="https://lavag.org/applications/core/interface/js/spacer.png" data-ratio="52.03" width="419" class="ipsImage ipsImage_thumbnailed" alt="Call_python_script.png" data-src="https://lavag.org/uploads/monthly_2023_02/Call_python_script.png.7294aedb93fec0400bf15d56643713ed.png"></a></p>
<p><a href="https://lavag.org/uploads/monthly_2023_02/1222793448_errorout.png.bc63e2b259fd64f6f35be7c06071a466.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="17510" src="https://lavag.org/applications/core/interface/js/spacer.png" data-ratio="92.59" width="486" class="ipsImage ipsImage_thumbnailed" alt="error out.png" data-src="https://lavag.org/uploads/monthly_2023_02/1222793448_errorout.png.bc63e2b259fd64f6f35be7c06071a466.png"></a></p>
<p><a href="https://lavag.org/uploads/monthly_2023_02/169702651_ResultonJupyter.png.0bb87d121666b13227180ba69e2462bc.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="17512" src="https://lavag.org/applications/core/interface/js/spacer.png" data-ratio="56.25" width="1920" class="ipsImage ipsImage_thumbnailed" alt="Result on Jupyter.png" data-src="https://lavag.org/uploads/monthly_2023_02/169702651_ResultonJupyter.png.0bb87d121666b13227180ba69e2462bc.png"></a></p><p>
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=17511&amp;key=7cb335acb4472096ace83303b55abe06" data-fileext="zip" data-fileid="17511" data-filekey="7cb335acb4472096ace83303b55abe06">FITS to JPG converter.zip</a></p>]]></description><guid isPermaLink="false">22954</guid><pubDate>Sun, 19 Feb 2023 11:12:18 +0000</pubDate></item><item><title>LabVIEW HDF5 DLL read *char to string</title><link>https://lavag.org/topic/22891-labview-hdf5-dll-read-char-to-string/</link><description><![CDATA[<p>
	Hello,<br>
	<br>
	I am trying to interface the HDF5 DLL to read the contents of a file in the same format.<br>
	My problem appears when I try to read an attribute composed of a "char*".<br>
	When I try to read it through the "Call Library Function Node" LabVIEW refuses to read the string.<br>
	I tried several settings of the call dll, trying to read a string by testing the 4 proposed formats but also by reading an array of U8 that I transform into string thereafter.<br>
	For some settings LabVIEW crashes, for others it returns an incomplete and incorrect string.
</p>

<p>
	Look at the code <span>:</span><img alt="vi_snippet.png.26d4bc37adf8937e08f06a56dc250b83.png" class="ipsImage ipsImage_thumbnailed" data-fileid="17452" data-ratio="22.45" width="1200" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2023_01/vi_snippet.png.26d4bc37adf8937e08f06a56dc250b83.png">
</p>

<p>
	Not being able to read directly with LabVIEW I tried in C to read this same file by using the same functions, I obtain well the expected string.
</p>

<p>
	<img alt="402085398_HDF5inC.png.fbb5ba535976c01debbfdd0c56d48c1b.png" class="ipsImage ipsImage_thumbnailed" data-fileid="17453" data-ratio="53.14" width="1200" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2023_01/402085398_HDF5inC.png.fbb5ba535976c01debbfdd0c56d48c1b.png">
</p>

<p>
	What confirms me in my idea that the problem comes from LabVIEW or my parameterization of the call of the DLL.
</p>

<p>
	Can you help to understand my problem ?<br>
	<br>
	I put you in attachment a file composed of the VI on which you have the code trying to read the DLL, the dll hdf5 and a capture of the code in C.<br>
	<br>
	NB :<br>
	I use LabVIEW 2020 64 bits.
</p>

<p>
	<a class="ipsAttachLink" data-fileext="zip" data-fileid="17454" href="https://lavag.org/applications/core/interface/file/attachment.php?id=17454&amp;key=21b02bdffc8f6a24b2c77e35500dec75" rel="">DLL_HDF5.zip</a>
</p>
]]></description><guid isPermaLink="false">22891</guid><pubDate>Wed, 25 Jan 2023 10:02:51 +0000</pubDate></item><item><title>DLL with nested pointer of double array</title><link>https://lavag.org/topic/22759-dll-with-nested-pointer-of-double-array/</link><description><![CDATA[<p>
	Hi there,<br>
	<br>
	I've issues by reading a pointer in a pointer in Labview DLL. I tried several suggestions found in other topics on this forum, but didn't succeed, so here we go.
</p>

<p>
	<strong># Problem</strong><br>
	The DLL FTMProLib has a function called <em>GetSpectrumData</em>. This function requires an <em>int </em>of <em>spectrumtype </em>and a pointer to <em>pSpectrum</em>). (see attachment Page_FTMProLib_GetSpectrumData.jpg)<br>
	This pSpectrum<em> </em>is of the type <em>Spectrum, </em>which is a <em>struct</em>. (see attachment Page_FTMProLib_Spectrum.jpg)
</p>

<p>
	In the Spectrum struct there is a double called pdSpectrum which contains my spectrum data. However, different from the other elements, this is a pointer.
</p>

<p>
	I know how to call a pointer to an double array through the DLL in LabVIEW. However, this pointer is nested inside the pointer to the Spectrum struct.
</p>

<p>
	 
</p>

<p>
	When generating the DLL, LabVIEW created the control shown as <em>"pSpectrum oud" </em> in 2022-10-05_Labview_library_control.png.<br>
	As one can see, the pdSpectrum is not an array, but a single number field.<br>
	I tried to change this to an array, as shown in "sRawData". However, when I use this new control format, LabVIEW crashes (see 2022-10-05_Labview_library_error.png).<br>
	<br>
	The Labview program is working when using the pSpectrum oud control, which to me suggests that I need to add a pointer to the double array in this single number field.<br>
	But I've no idea how to do this, since labview is not working with pointers.<br>
	<br>
	<br>
	So far I've no luck into getting this working and I'm out of ideas how to approach / fix it.
</p>

<p>
	 
</p>

<p>
	Any help appreciated.
</p>

<p>
	<br>
	<br>
	 
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2022_10/Page_FTMProLib_GetSpectrumData.jpeg.91425b18466856c4ac04d954160f33a6.jpeg" data-fileid="17145" data-fileext="jpeg" rel=""><img alt="Page_FTMProLib_GetSpectrumData.jpeg" class="ipsImage ipsImage_thumbnailed" data-fileid="17145" data-ratio="144.63" width="885" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2022_10/Page_FTMProLib_GetSpectrumData.jpeg.91425b18466856c4ac04d954160f33a6.jpeg"></a>
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2022_10/Page_FTMProLib_Spectrum.jpeg.059e8400d2b2dc4d301c3f63007c05b5.jpeg" data-fileid="17146" data-fileext="jpeg" rel=""><img alt="Page_FTMProLib_Spectrum.jpeg" class="ipsImage ipsImage_thumbnailed" data-fileid="17146" data-ratio="146.29" width="875" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2022_10/Page_FTMProLib_Spectrum.jpeg.059e8400d2b2dc4d301c3f63007c05b5.jpeg"></a>
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2022_10/2022-10-05_Labview_library.PNG.04103be292315ae8c99d4cf96deb45a3.PNG" data-fileid="17147" data-fileext="PNG" rel=""><img alt="2022-10-05_Labview_library.PNG" class="ipsImage ipsImage_thumbnailed" data-fileid="17147" data-ratio="53.16" width="980" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2022_10/2022-10-05_Labview_library.PNG.04103be292315ae8c99d4cf96deb45a3.PNG"></a>
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2022_10/2022-10-05_Labview_library_control.PNG.9ac0041585ee754e14d1305cdd3fa279.PNG" data-fileid="17148" data-fileext="PNG" rel=""><img alt="2022-10-05_Labview_library_control.PNG" class="ipsImage ipsImage_thumbnailed" data-fileid="17148" data-ratio="256.67" width="270" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2022_10/2022-10-05_Labview_library_control.PNG.9ac0041585ee754e14d1305cdd3fa279.PNG"></a>
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2022_10/2022-10-05_Labview_library_error.PNG.68eb97915a37d62b0e54a67049057fca.PNG" data-fileid="17149" data-fileext="PNG" rel=""><img alt="2022-10-05_Labview_library_error.PNG" class="ipsImage ipsImage_thumbnailed" data-fileid="17149" data-ratio="116.60" width="530" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2022_10/2022-10-05_Labview_library_error.PNG.68eb97915a37d62b0e54a67049057fca.PNG"></a>
</p>
]]></description><guid isPermaLink="false">22759</guid><pubDate>Wed, 05 Oct 2022 15:00:44 +0000</pubDate></item><item><title><![CDATA[Matlab Script Node doesn&#39;t update when .m file edited externally]]></title><link>https://lavag.org/topic/11054-matlab-script-node-doesnt-update-when-m-file-edited-externally/</link><description><![CDATA[<p>I've been using the Matlab script node and always noticed something funny about how it handles scripts (.m files) that I had saved.  I finally figured out yesterday what it was.  If you edit the script in matlab and save it, LabVIEW won't see the changes.  For example:</p>
<p>Create a file called test.m which just has:</p>
<p>a=a+1;</p>
<p>Next create a vi that has a Matlab Script Node with inputs and and outputs of "a" attached to a control and indicator respectively which only contains a script node with the code:</p>
<p>cd &lt;whatever directory test.m was saved to&gt;;</p>
<p>test</p>
<p>If you run this code with the control set to 0, the indicator will read 1 as expected.</p>
<p>Now, if you go edit the file test.m to a=a+2; (without closing your vi) and then rerun the vi, it will still give you 1, not 2.  If you close the vi, then reopen it, it will give you 2 as expected.</p>
<p>Is there a way to generate new execution code for LabVIEW without closing the vi and reopening it.</p>
]]></description><guid isPermaLink="false">11054</guid><pubDate>Tue, 22 Sep 2009 13:37:05 +0000</pubDate></item><item><title>Fermeture R&#xE9;f&#xE9;rences</title><link>https://lavag.org/topic/22684-fermeture-r%C3%A9f%C3%A9rences/</link><description><![CDATA[<div style="background-color:#ffffff;color:#222222;font-size:small;">
	Bonjour je suis nouveau sur ce site,
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	 
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	Je reprenais le code d'un collègue qui me met le doute sur les fermetures de références. C'était déjà pas toujours très clair pour moi mais la c'est la grosse interrogation. 
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	 
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	Sur l'image jointe :
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	- Sur la partie supérieure les références des clusters, et des clusters formaté en slide (strict), sont fermés a la fin du Vi. Cela sert a quelque chose cela? Pour moi c'est inutile.
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	- Sur la partie inférieure, c'est un appel ActiveX de Solidworks. La j'ai un doute, avant j'aurais fait comme cela, mais maintenant je me demande si c'est vraiment utile de fermer toutes les références qui découlent de la référence ouverte au démarrage (ISldWorks). Juste la fermeture de la référence ouverte au démarrage suffit, non? Cela sert a quelque chose de fermer les références intermédiaires?
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	 
</div>

<div style="background-color:#ffffff;color:#222222;font-size:small;">
	Merci
</div>

<p><a href="https://lavag.org/uploads/monthly_2022_08/797149336_QuestionActivX.png.98dbd36c732ca06dcee6b2383303e39b.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="17102" src="https://lavag.org/applications/core/interface/js/spacer.png" data-ratio="23.58" width="2668" class="ipsImage ipsImage_thumbnailed" alt="Question ActivX.png" data-src="https://lavag.org/uploads/monthly_2022_08/797149336_QuestionActivX.png.98dbd36c732ca06dcee6b2383303e39b.png"></a></p>]]></description><guid isPermaLink="false">22684</guid><pubDate>Fri, 26 Aug 2022 08:23:58 +0000</pubDate></item><item><title>How to read this structure with union from my Call Library Function Node?</title><link>https://lavag.org/topic/21075-how-to-read-this-structure-with-union-from-my-call-library-function-node/</link><description><![CDATA[<p>
	<span lang="en-us" style="color:#272a34;font-size:10.5pt;" xml:lang="en-us">Trying to call the function below. I would like to read </span><span lang="en-us" xml:lang="en-us">CL_MEASDATA information. Actually just need Evxy.</span>
</p>

<p>
	 
</p>

<p>
	<span lang="en-us" xml:lang="en-us">ER_CODE KMAPI CLGetMeasData(DEVICE_HANDLE hDevice, CL_COLORSPACE Type, CL_MEASDATA* pColor); </span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us">typedef union tCL_MEASDATA</span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us">{</span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_EvxyDATA<span>           </span>Evxy;<span>                                        </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_EvuvDATA<span>          </span>Evuv;<span>                                        </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_EvTduvDATA<span>       </span>EvTduv;<span>                                    </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_EvDWPeDATA<span>    </span>EvDWPe;<span>                                  </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_XYZDATA<span>            </span>XYZ;<span>                                 </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_RenderingDATA<span> </span>Rendering;<span>                       </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_PWDATA<span>            </span>Pw;<span>                                          </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"><span>        </span>CL_SPCDATA<span>            </span>Spc;<span>                                  </span></span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us">}</span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us">CL_MEASDATA;</span>
</p>

<p>
	<span lang="en-us" xml:lang="en-us"> </span>
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_EvxyDATA<br>
					{<br>
					float Ev;<br>
					float x;<br>
					float y;<br>
					}<br>
					CL_EvxyDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_EvuvDATA<br>
					{<br>
					float Ev;<br>
					float u;<br>
					float v;<br>
					}<br>
					CL_EvuvDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_EvTduvDATA<br>
					{<br>
					float Ev;<br>
					float T;<br>
					float duv;<br>
					}<br>
					CL_EvTduvDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_EvDWPeDATA<br>
					{<br>
					float Ev;<br>
					float DW;<br>
					float Pe;<br>
					}<br>
					CL_EvDWPeDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_XYZDATA<br>
					{<br>
					float X;<br>
					float Y;<br>
					float Z;<br>
					}<br>
					CL_XYZDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_RenderingDATA<br>
					{<br>
					float Data[CL_RENDERING_LEN];<br>
					}<br>
					CL_RenderingDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<table>
	<tbody>
		<tr>
			<td width="200">
				 
				<table>
					<tbody>
						<tr>
							<td>
								<span>The </span><span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">RenderingDATA</span><span>is stored in the array in below order</span>

								<table>
									<tbody>
										<tr>
											<td>
												<span>0</span>
											</td>
											<td>
												<span>1 </span>
											</td>
											<td>
												<span>2 </span>
											</td>
											<td>
												<span>・・・ </span>
											</td>
											<td>
												<span>14 </span>
											</td>
											<td>
												<span>15</span>
											</td>
										</tr>
										<tr>
											<td>
												<span>Ra </span>
											</td>
											<td>
												<span>R1 </span>
											</td>
											<td>
												<span>R2 </span>
											</td>
											<td>
												<span>・・・ </span>
											</td>
											<td>
												<span>R14 </span>
											</td>
											<td>
												<span>R15</span>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_PWDATA<br>
					{<br>
					float PeakWave;<br>
					}<br>
					CL_PWDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border:none;">
	<tbody>
		<tr>
			<td style="border:solid 1pt;padding:0cm 5.4pt 0cm 5.4pt;" width="200">
				<p>
					<span lang="en-us" style="color:#000000;font-size:9pt;" xml:lang="en-us">typedef struct tCL_ScotopicDATA<br>
					{<br>
					float Ev;<br>
					float Es;<br>
					float SP;<br>
					}<br>
					CL_ScotopicDATA;</span>
				</p>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<br>
	 
</p>
]]></description><guid isPermaLink="false">21075</guid><pubDate>Thu, 18 Jul 2019 01:33:47 +0000</pubDate></item><item><title>Lost .Net Path when create exe</title><link>https://lavag.org/topic/22587-lost-net-path-when-create-exe/</link><description><![CDATA[<p>
	Hi
</p>

<p>
	I have created one program who call a DotNet assembly component (.NET4   system.dll) and all ok in my LV2011 development ide.
</p>

<p>
	But when I create EXE with it, each time I run the program it calls me .Net ddl path. I do that on the same PC.
</p>

<p>
	If I indicate the path, the program loads it and runs correctly. It's a bit painful and not very professional to do that each time.
</p>

<p>
	To solve this, I have tried lots of work around but without success.
</p>

<p>
	1) Add Dll caller Vi directly in project folder . (intialy in my user folder)
</p>

<p>
	2) Add a specific .ini file where I have added a key for the search path (viSearchPath= "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089") to Help <abbr title="LabVIEW">LV</abbr> to found assembly.
</p>

<p>
	3) Add DLL in my exe construction in data folder
</p>

<p>
	4) etc etc...
</p>

<p>
	I have read and test lots of things on NI website but it's not always clear for me.
</p>

<p>
	If someone can give me a good procedure it will  be christmas  for me.
</p>

<p>
	Eric
</p>
]]></description><guid isPermaLink="false">22587</guid><pubDate>Fri, 17 Jun 2022 09:04:54 +0000</pubDate></item><item><title>Pointers to Variants</title><link>https://lavag.org/topic/16946-pointers-to-variants/</link><description><![CDATA[<p>I'm probably missing something fundamental about how variants are stored in memory <img src="https://lavag.org/uploads/emoticons/default_angry.png" alt=":angry:"> .</p>
<p> </p>
<p>I want to create an array of pointers to variants. I seem to be able to write quite happily, but when read; it causes a problem.</p>
<p>The following VI demonstrates what I am trying to do. It runs through once quite happily, but on the second execution it fails on the DSDisposePointer (even though the variant has been written and read correctly). If you disable the read, then it doesn't crash so it must be something to do with the way I'm retrieving the data.</p>
<p> </p>
<p>Any help appreciated.</p>
<p> </p>
<p><a href="http://www.labview-tools.com/download_file/112/309/" rel="external nofollow">varpointers.vi</a></p>
<p> </p>
<p> </p>
]]></description><guid isPermaLink="false">16946</guid><pubDate>Fri, 05 Jul 2013 04:48:50 +0000</pubDate></item><item><title>Returning Python exceptions to LabVIEW</title><link>https://lavag.org/topic/22492-returning-python-exceptions-to-labview/</link><description><![CDATA[<p>
	I am writing a wrapper to a Python class.
</p>

<p>
	The class has several states and will raise an exception when a method is called that is incompatible with the current state.
</p>

<p>
	Are there any best practices for passing exceptions back to LabVIEW? I was thinking of using the LabVIEW error cluster as a return type.
</p>
]]></description><guid isPermaLink="false">22492</guid><pubDate>Tue, 05 Apr 2022 12:56:26 +0000</pubDate></item><item><title>Memory mapped files, Windows</title><link>https://lavag.org/topic/20201-memory-mapped-files-windows/</link><description><![CDATA[<p>
	Supposedly there are Labview tools available at
</p>

<p>
	<a href="http://www.lvs-tools.co.uk/software/utilities/" rel="external nofollow">http://www.lvs-tools.co.uk/software/utilities/</a>
</p>

<p>
	But whenever I try to register or login, nothing happens.  (Also, I try to think, but nothing happens.)  Are there any other Labview codes that use the Windows Memory-Mapped Files functions, or should I just reinvent this wheel?  By the way, here is a Microsoft document on the subject: <a href="https://msdn.microsoft.com/en-us/library/ms810613.aspx" rel="external nofollow">https://msdn.microsoft.com/en-us/library/ms810613.aspx</a>
</p>
]]></description><guid isPermaLink="false">20201</guid><pubDate>Tue, 11 Jul 2017 11:28:43 +0000</pubDate></item><item><title>Faster Spline interpolation - c++ dll implementation?</title><link>https://lavag.org/topic/22482-faster-spline-interpolation-c-dll-implementation/</link><description><![CDATA[<p>
	Hi,
</p>

<p>
	in my code I'm using "Spline Interpolant.vi" and "Spline Interpolation.vi" (the last one in a for loop) to interpolate an array of 11 elements and the final array has 501 elements. The time required (on my pc) is ~40 microseconds.
</p>

<p>
	I have to do the same operation thousand of times for every measure and, every time, I need to execute also "Splite Interpolant.vi" because the original array will change. I have tried others interpolation method available in LabVIEW but the time required is the ~ same or more; I don't know if there is something else I can try to do to increase the speed of the interpolation. But, at the moment, the time budget between two consecutive measure is very limited.
</p>

<p>
	I have looked at the code of the two vi's and, from my understanding, they are not calling some C/C++ primitive to calculate the 2nd derivative and interpolate; instead it looks like pure LabVIEW till the end.
</p>

<p>
	I found this C++ implementation <a href="https://kluge.in-chemnitz.de/opensource/spline/" rel="external nofollow">https://kluge.in-chemnitz.de/opensource/spline/</a> but it's a "header-only" library and I don't know how to call it from LabVIEW without dll file. Anybody here can help me? can I expect a decrease of the required time? The linked library is just an example, I'm open to any other solutions/library/dll.
</p>

<p>
	Thank you.
</p>

<p>
	Marco.
</p>

<p><a href="https://lavag.org/uploads/monthly_2022_03/splineInterpolation.png.9910354ff077b5e6aea3adc7d7268b20.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="16534" src="https://lavag.org/applications/core/interface/js/spacer.png" data-ratio="29.42" width="639" class="ipsImage ipsImage_thumbnailed" alt="splineInterpolation.png" data-src="https://lavag.org/uploads/monthly_2022_03/splineInterpolation.png.9910354ff077b5e6aea3adc7d7268b20.png"></a></p>]]></description><guid isPermaLink="false">22482</guid><pubDate>Tue, 22 Mar 2022 09:56:29 +0000</pubDate></item><item><title>error when calling python script from LV</title><link>https://lavag.org/topic/22395-error-when-calling-python-script-from-lv/</link><description><![CDATA[<p>
	I am trying to call a python script function from labview and get the following error, Module Path: C:\STOKE\code\GSW.Deployment.0.1-rc0\yardmaster\yardmaster.py
</p>

<p>
	LabVIEW: (Hex 0x683) The specified Python module could not be imported.<br>
	=========================<br>
	LabVIEW: (Hex 0x683) The specified Python module could not be imported.
</p>

<p>
	<br>
	Module Path: C:\STOKE\code\GSW.Deployment.0.1-rc0\yardmaster\yardmaster.py<br>
	Function Name: exit<br>
	Python returned the following error: &lt;class 'ImportError'&gt;<br>
	DLL load failed while importing _ssl: The specified module could not be found.<br>
	&lt;traceback object at 0x037E3FA8&gt;
</p>

<p>
	If I run the python script in a Anaconda Prompt command shell it works as expected.  I'm wondering if the Anaconda enviroment has all of the dependancies needed, but not so in the <abbr title="LabVIEW">LV</abbr> session.  
</p>

<p>
	I've tried passing the parameter "function name" as one of the commands listed below with the module parameter as "yardmaster.py" whcih returns an error in <abbr title="LabVIEW">LV</abbr> but works in the cmd  shell (as shown below).
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="16394" data-ratio="49.54" width="763" alt="image.png.07147771d67eda3d8e7040ad3b601bc3.png" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2022_01/image.png.07147771d67eda3d8e7040ad3b601bc3.png">
</p>

<p>
	Any ideas and/or help is greatly appreciated. 
</p>
<p>
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=16395&amp;key=945256045b3bec59463b89b40c939d4b" data-fileext="vi" data-fileid="16395" data-filekey="945256045b3bec59463b89b40c939d4b">SERVO Test Python Node.vi</a></p>]]></description><guid isPermaLink="false">22395</guid><pubDate>Fri, 21 Jan 2022 02:36:20 +0000</pubDate></item><item><title>CompactRIO launch an .rtexe from an .rtexe</title><link>https://lavag.org/topic/22391-compactrio-launch-an-rtexe-from-an-rtexe/</link><description><![CDATA[<p>
	Hi colleagues,
</p>

<p>
	I need some help. 
</p>

<p>
	Description: it's necessary to launch an app startup.rtexe on a CRIO 9075 (OC VxWorks) then launch a second app app.rtexe from the first one and close first app.
</p>

<p>
	Seems System Ecex.vi might be a great solution, but this function is not available in a palette for RIO which is based on VxWorks.
</p>

<p>
	Maybe anyone could help me or share links with relevant information.
</p>

<p>
	 
</p>

<p>
	Thanks, Vadim.
</p>
]]></description><guid isPermaLink="false">22391</guid><pubDate>Sun, 16 Jan 2022 17:06:17 +0000</pubDate></item><item><title>LabVIEW portable pointer sized element</title><link>https://lavag.org/topic/22381-labview-portable-pointer-sized-element/</link><description><![CDATA[<p>
	Is there a Labview Type that changes from 32 to 64 bits based on rather your running a different development environment?
</p>
]]></description><guid isPermaLink="false">22381</guid><pubDate>Tue, 04 Jan 2022 22:06:54 +0000</pubDate></item><item><title>Memcpy Equivalent?</title><link>https://lavag.org/topic/22383-memcpy-equivalent/</link><description><![CDATA[<p>
	So I'm working on windows and i need to write bytes to a pointer location. I can use windows api functions but i would guess that somewhere there is a function that does this? And perhaps is more portable? How is it done typically?
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">22383</guid><pubDate>Wed, 05 Jan 2022 17:46:34 +0000</pubDate></item><item><title>LabVIEW Call Library Function Node - Union Pointer handling</title><link>https://lavag.org/topic/22038-labview-call-library-function-node-union-pointer-handling/</link><description><![CDATA[<p>
	I have code from another developer that allows me to interface with a server to get configuration data.  I have compiled the C code into a .SO on my Linux system without error - but in writing my LabVIEW CLFN, I am unsure what to do with a Union Pointer to pass the data.
</p>

<p>
	 
</p>

<p>
	The function in the C file:
</p>

<p>
	void getValue(int so, CharacteristicHandle ch, Value *v)<br />
	{<br />
	    long longValue;<br />
	    unsigned long ulongValue;<br />
	    double doubleValue;<br />
	    char * c_ptr = 0;
</p>

<p>
	    long msgType = g_val;
</p>

<p>
	    sendLong( so, msgType );<br />
	    sendCHARhandle( so, ch );
</p>

<p>
	    readLong( so, &amp;longValue );<br />
	    v-&gt;order = longValue;
</p>

<p>
	    readLong( so, &amp;longValue );<br />
	    v-&gt;type = longValue;
</p>

<p>
	    readLong( so, &amp;longValue );<br />
	    v-&gt;label = longValue;
</p>

<p>
	    switch( v-&gt;type )<br />
	    {<br />
	    case integer:<br />
	    {<br />
	        readLong( so, &amp;longValue );<br />
	        v-&gt;v.l = longValue;
</p>

<p>
	        break;<br />
	    }<br />
	    case uLong:<br />
	    {<br />
	        readLong( so, &amp;ulongValue );<br />
	        v-&gt;v.ul = ulongValue;
</p>

<p>
	        break;<br />
	    }<br />
	    case floating:<br />
	    {<br />
	        readDouble( so, &amp;doubleValue );<br />
	        v-&gt;v.d = doubleValue;
</p>

<p>
	        break;<br />
	    }<br />
	    case charString:<br />
	    {<br />
	        readString( so, &amp;c_ptr );<br />
	        v-&gt;v.s = c_ptr;
</p>

<p>
	        break;<br />
	    }<br />
	    }<br />
	    return;<br />
	}
</p>

<p>
	 
</p>

<p>
	The definition of "Value" from another header file:
</p>

<p>
	/* Define a type to hold the value and type information for <br />
	 * a characteristic. */<br />
	typedef struct Value<br />
	{<br />
	    union        /* This holds the value. */ <br />
	    {<br />
	        long l;<br />
	        unsigned long ul;<br />
	        double d;<br />
	        char *s;      /* If a string user is responsible for <br />
	                       * allocating memory. */<br />
	    } v;
</p>

<p>
	    long order;<br />
	    valueType type;    /* Int,float, or string */<br />
	    valueLabel label;  /* Description of characteristic -- what is it? */<br />
	} Value;<br />
	 
</p>

<p>
	I'm a newb at CLFN - the primitive datatypes I've got working for my other calls - this one I am not sure how to configure with the CLFN.  Is this possible to do with the CLFN?
</p>
]]></description><guid isPermaLink="false">22038</guid><pubDate>Wed, 05 May 2021 17:32:15 +0000</pubDate></item><item><title>Pyhton or C to do For Daq and DSP?</title><link>https://lavag.org/topic/22314-pyhton-or-c-to-do-for-daq-and-dsp/</link><description><![CDATA[<p style="color:#0e101a;">
	<span style="color:#0e101a;">Hi All,</span>
</p>

<p style="color:#0e101a;">
	<span style="color:#0e101a;">I am a </span><strong style="color:#0e101a;"><span style="color:#0e101a;">Physical Chemist</span></strong><span style="color:#0e101a;"> and am just starting Labview (a long way to go, as you may suspect). I would need to do a lot of </span><strong style="color:#0e101a;"><span style="color:#0e101a;">Daq </span></strong><span style="color:#0e101a;">and </span><strong style="color:#0e101a;"><span style="color:#0e101a;">DPS </span></strong><span style="color:#0e101a;">but with a low budget (using </span><strong style="color:#0e101a;"><span style="color:#0e101a;">Arduino </span></strong><span style="color:#0e101a;">and </span><strong style="color:#0e101a;"><span style="color:#0e101a;">NI-Dev boards</span></strong><span style="color:#0e101a;"> for my projects).</span>
</p>

<p style="color:#0e101a;">
	<span style="color:#0e101a;">I would like to have the option of going </span><strong style="color:#0e101a;"><span style="color:#0e101a;">hybrid </span></strong><span style="color:#0e101a;">programming (text-G) and since I do not have much programming experience i wanted to know which one would suit my purposes better, </span><strong style="color:#0e101a;"><span style="color:#0e101a;">C/C++</span></strong><span style="color:#0e101a;"> or </span><strong style="color:#0e101a;"><span style="color:#0e101a;">python. </span></strong><span style="color:#0e101a;">I have worked with formula nodes, and it is easy for making base computations and mathemathical formula and I was sad by the fact that you either have to use <strong>C/C++</strong> syntax or Mathscript as in Math nodes; meaning <strong>MatLab </strong>inside labview codes.</span>
</p>

<p style="color:#0e101a;">
	<span style="color:#0e101a;">I am fully willing to put work in if </span><strong style="color:#0e101a;"><span style="color:#0e101a;">C/C++</span></strong><span style="color:#0e101a;"> is the answer, but I wanted to know which should I pick?</span>
</p>

<p style="color:#0e101a;">
	<span style="color:#0e101a;">I really appreciate any help you can provide.</span>
</p>

<p style="color:#0e101a;">
	<span style="color:#0e101a;">Cheers,</span>
</p>

<p style="color:#0e101a;">
	<span style="color:#0e101a;">Mahbod</span>
</p>
]]></description><guid isPermaLink="false">22314</guid><pubDate>Sun, 28 Nov 2021 02:06:04 +0000</pubDate></item><item><title>LabVIEW Python node - share non-serializable object</title><link>https://lavag.org/topic/22342-labview-python-node-share-non-serializable-object/</link><description><![CDATA[<p style="background-color:#ffffff;border:0px;color:#232629;font-size:15px;padding:0px;text-align:left;vertical-align:baseline;">
	I'm using LabVIEW python nodes to call a python script, which creates an instance of OPC Server class. 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">def initServer(url):
    server = Server()
    server.set_endpoint(url) 
    ...</span></pre>

<p style="background-color:#ffffff;border:0px;color:#232629;font-size:15px;padding:0px;text-align:left;vertical-align:baseline;">
	The<span> </span><strong style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;">Server</strong><span> </span>object cannot be serialized to JSON as well as cannot be pickled (TypeError: cannot pickle '_thread.RLock' object), so I can hardly see the way how to transfer<span> </span><strong style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;">Server</strong><span> </span>object to LabVIEW.
</p>

<p style="background-color:#ffffff;border:0px;color:#232629;font-size:15px;padding:0px;text-align:left;vertical-align:baseline;">
	In that case I managed to store<span> </span><strong style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;">Server</strong><span> </span>as a global variable in python script. This solutions works - I can call functions (ex. start/stop running) that simply use a global<span> </span><strong style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;">Server</strong><span> </span>object.
</p>

<p style="background-color:#ffffff;border:0px;color:#232629;font-size:15px;padding:0px;text-align:left;vertical-align:baseline;">
	However, this solution is not secure - because if I lost the python session (due to the LabVIEW issue), I have no access to my<span> </span><strong style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;">Server</strong>. That leads to the question:
</p>

<p style="background-color:#ffffff;border:0px;color:#232629;font-size:15px;padding:0px;text-align:left;vertical-align:baseline;">
	Is there any more secure way to handle that?
</p>
]]></description><guid isPermaLink="false">22342</guid><pubDate>Tue, 30 Nov 2021 08:37:56 +0000</pubDate></item><item><title>LabVIEW CLFN - pass bool pointer to function and change it value</title><link>https://lavag.org/topic/22258-labview-clfn-pass-bool-pointer-to-function-and-change-it-value/</link><description><![CDATA[<p>
	Hello, I'm trying to move the example of library use from C to LabVIEW. The function is C looks like that:
</p>

<div style="background-color:#1e1e1e;color:#d4d4d4;font-size:14px;">
	<div>
		<span style="color:#569cd6;">static</span><span style="color:#d4d4d4;"> </span><span style="color:#569cd6;">volatile</span><span style="color:#d4d4d4;"> </span><span style="color:#4ec9b0;">UA_Boolean</span><span style="color:#d4d4d4;"> </span><span style="color:#9cdcfe;">running</span><span style="color:#d4d4d4;"> = </span><span style="color:#569cd6;">true</span><span style="color:#d4d4d4;">;</span>
	</div>

	<div>
		<span style="color:#569cd6;">static</span><span style="color:#d4d4d4;"> </span><span style="color:#569cd6;">void</span><span style="color:#d4d4d4;"> </span><span style="color:#dcdcaa;">stopHandler</span><span style="color:#d4d4d4;">(</span><span style="color:#569cd6;">int</span><span style="color:#d4d4d4;"> </span><span style="color:#9cdcfe;">sig</span><span style="color:#d4d4d4;">) {</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">    </span><span style="color:#9cdcfe;">running</span><span style="color:#d4d4d4;"> = </span><span style="color:#569cd6;">false</span><span style="color:#d4d4d4;">;</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">}</span>
	</div>
	 

	<div>
		<span style="color:#569cd6;">int</span><span style="color:#d4d4d4;"> </span><span style="color:#dcdcaa;">main</span><span style="color:#d4d4d4;">(</span><span style="color:#569cd6;">void</span><span style="color:#d4d4d4;">) {</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">...</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">    </span><span style="color:#4ec9b0;">UA_StatusCode</span><span style="color:#d4d4d4;"> </span><span style="color:#9cdcfe;">retval</span><span style="color:#d4d4d4;"> = </span><span style="color:#dcdcaa;">UA_Server_run</span><span style="color:#d4d4d4;">(</span><span style="color:#9cdcfe;">server</span><span style="color:#d4d4d4;">, &amp;</span><span style="color:#9cdcfe;">running</span><span style="color:#d4d4d4;">);</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">...</span>
	</div>
</div>

<p>
	the code goes to the Server_run function and stops here as long as the variable running is true. In C stopHandler will change that and the program can finish.
</p>

<p>
	How we can transfer this functionality to LabVIEW? What should be connected as a second parameter to the CLF node function?
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="16276" data-ratio="86.54" width="104" alt="image.png.02dfed7e6b3d178f2821380271464c11.png" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2021_11/image.png.02dfed7e6b3d178f2821380271464c11.png">
</p>
]]></description><guid isPermaLink="false">22258</guid><pubDate>Mon, 01 Nov 2021 09:29:55 +0000</pubDate></item><item><title>How to dynamically load and unload .NET DLLs?</title><link>https://lavag.org/topic/22180-how-to-dynamically-load-and-unload-net-dlls/</link><description><![CDATA[<p>
	Hello,
</p>

<p>
	I am trying to find a way to dynamically load and possibly unload .NET DLLs in LabVIEW. This is easy to do when you can use the "Call Library Function Node" to call your DLL by specifying its path on the block diagram. However, it doesn't seem like there is an easy way to do that for .NET DLLs.
</p>

<p>
	I use the .NET constructor node to create an instance of my .NET object which is my DLL, and I use property or invoke nodes to access my DLL methods. 
</p>

<p>
	Does anyone know how this can be done? 
</p>

<p>
	Thank you for your help!
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">22180</guid><pubDate>Thu, 19 Aug 2021 16:49:52 +0000</pubDate></item><item><title>Call Library Function Node / void** and void*</title><link>https://lavag.org/topic/22173-call-library-function-node-void-and-void/</link><description><![CDATA[<p>
	<span>Hello experts,</span>
</p>

<p>
	I would like to use the two functions:
</p>

<p>
	<strong>int clSerialInit(unsigned long SerialIndex, void** SerialRefPtr);<br>
	int clSerialClose(void* SerialRef);</strong>
</p>

<p>
	Execute via a Call Library Function Node.
</p>

<p>
	I have chosen the parameterisation shown. But it does not seem to work. The function prototype does not seem to be correct either.
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="16029" data-ratio="166.27" width="255" alt="image.png.1e8c062c9b77334f609c941f47f7fa18.png" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2021_08/image.png.1e8c062c9b77334f609c941f47f7fa18.png">
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="16030" data-ratio="74.61" width="512" alt="image.png.0dddd3fcf0671553cfc85e000fdab778.png" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2021_08/image.png.0dddd3fcf0671553cfc85e000fdab778.png">
</p>

<p>
	<br>
	Can someone tell me how to parameterise the call library function Node in order to execute the two functions?
</p>

<p>
	Have a good time, Jim
</p>

<p>
	 
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">22173</guid><pubDate>Wed, 11 Aug 2021 11:18:22 +0000</pubDate></item><item><title>Can Queues be accessed through CIN?</title><link>https://lavag.org/topic/22067-can-queues-be-accessed-through-cin/</link><description><![CDATA[<p>
	I was looking through the Labview.lib (its just an archive) functions and found:<br />
	    Line 1162: ./objects/labview_lib/win32U/i386/msvc71/release/QueuePreview.i386.obj    _QueuePreview<br />
	    Line 1211: ./objects/labview_lib/win32U/i386/msvc71/release/QueueTimeoutRead.i386.obj    _QueueTimeoutRead<br />
	    Line 1231: ./objects/labview_lib/win32U/i386/msvc71/release/QueueLossyEnqueue.i386.obj    _QueueLossyEnqueue<br />
	    Line 1238: ./objects/labview_lib/win32U/i386/msvc71/release/QueueStatus.i386.obj    _QueueStatus<br />
	    Line 1286: ./objects/labview_lib/win32U/i386/msvc71/release/QueueDequeue.i386.obj    _QueueDequeue<br />
	    Line 1348: ./objects/labview_lib/win32U/i386/msvc71/release/QueueObtain.i386.obj    _QueueObtain<br />
	    Line 1691: ./objects/labview_lib/win32U/i386/msvc71/release/QueueEnqueue.i386.obj    _QueueEnqueue
</p>

<p>
	I assume that means i can interact with Labview Queues in application space, which would be a nice way to transfer information and call back. 
</p>

<p>
	But I cant find any documentation on how to use these eg. documentation or prototypes. If someone can point me in the right direction that would be great!
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">22067</guid><pubDate>Mon, 07 Jun 2021 18:32:35 +0000</pubDate></item><item><title>What is the state-of-the-art of Python-LabVIEW integration?</title><link>https://lavag.org/topic/21958-what-is-the-state-of-the-art-of-python-labview-integration/</link><description><![CDATA[<p>
	I am just starting on trying to be able to use Python code from a LabVIEW application (mostly for some image analysis stuff).  This is for a large project where some programmers are more comfortable developing in Python than LabVIEW.  I have not done any Python before, and their seem to be a bewildering array of options; many IDE's, Libraries, and Python-LabVIEW connectors.  
</p>

<p>
	So I was wondering if people who have been using Python with LabVIEW can give their experiences and describe what set of technologies they use.
</p>
]]></description><guid isPermaLink="false">21958</guid><pubDate>Fri, 05 Mar 2021 09:35:37 +0000</pubDate></item><item><title>shell32.dll call returning error when program moved to new PC</title><link>https://lavag.org/topic/21934-shell32dll-call-returning-error-when-program-moved-to-new-pc/</link><description><![CDATA[<p>
	I have a program/executable that has been used on several Windows 10 PCs over the last two  years or so.  We went to set up a new laptop (still Windows 10) and now the attached PrintPDFr1 subvi is returning an error 32.
</p>

<p>
	I am using LV2018 32bit.
</p>

<p>
	I've been in touch with NI support and so far we haven't come to a solution.
</p>

<p>
	We've tried:
</p>

<p>
	1. Adding a copy of shell32.dll to the build of the exe under always included
</p>

<p>
	2. Modifying the subvi to specify the path to shell32.dll in the CLFN
</p>

<p>
	3. Running as administrator
</p>

<p>
	4. Changing the subvi to use the .NET method found here:  <a href="https://forums.ni.com/t5/LabVIEW/Invoke-Print-File-Explorer/m-p/3611684?profile.language=en" rel="external nofollow">Solved: Invoke Print File (Explorer) - NI Community</a>
</p>

<p>
	5.  Using 'FileMan Print File.vi' in winevent.llb in the attached zip file
</p>

<p>
	They all work on my development PC and on a second laptop, but they all fail and generate an error on this new laptop.
</p>

<p>
	Has anyone seen something like this before and/or have any suggested fixes.
</p>

<p>
	Thanks in advance for any input,
</p>

<p>
	Steve
</p>
<p>
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=15643" data-fileExt='vi' data-fileid='15643'>PrintPDFr1.vi</a> 
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=15644" data-fileExt='zip' data-fileid='15644'>_labview_win_util_32.zip</a></p>]]></description><guid isPermaLink="false">21934</guid><pubDate>Wed, 17 Feb 2021 23:32:01 +0000</pubDate></item><item><title>This looks interesting</title><link>https://lavag.org/topic/21898-this-looks-interesting/</link><description><![CDATA[<p>
	Obviously I don't know what I am talking about, but could this in the future be used to simplify configuring Win32 API DLL calls in LabVIEW?
</p>

<p>
	<a href="https://blogs.windows.com/windowsdeveloper/2021/01/21/making-win32-apis-more-accessible-to-more-languages/" rel="external nofollow">https://blogs.windows.com/windowsdeveloper/2021/01/21/making-win32-apis-more-accessible-to-more-languages/</a>
</p>
]]></description><guid isPermaLink="false">21898</guid><pubDate>Fri, 22 Jan 2021 14:24:17 +0000</pubDate></item><item><title>.NET: Citizen.LayoutUtilities.Printing - Controller.Open() open fails</title><link>https://lavag.org/topic/21839-net-citizenlayoututilitiesprinting-controlleropen-open-fails/</link><description><![CDATA[<p>
	Hi guys,
</p>

<p>
	maybe you can help me there with an .NET issue.<br>
	I try to use the Controller.Open() method from the Citizen.LayoutUtilities.Printing, but it always reports -1 as an error.<br>
	There is no LabVIEW error on the constructor or invoke node and the c# example works fine.
</p>

<p>
	<img alt="2020-11-27_14-52-44_Untitled_1_Block_Diagram_.png.e6d3d0895d92ebc756e941bed37efe54.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15389" data-ratio="66.67" width="729" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-52-44_Untitled_1_Block_Diagram_.png.e6d3d0895d92ebc756e941bed37efe54.png">
</p>

<p>
	This is the Citizen SDK with the manual and examples:<br>
	<a href="https://www.citizen-systems.co.jp/en/printer/download/sdk-layout/sdk-layout-windriver_V1400E.zip" rel="external nofollow">https://www.citizen-systems.co.jp/en/printer/download/sdk-layout/sdk-layout-windriver_V1400E.zip</a>
</p>

<p>
	 
</p>

<p>
	There are also c# examples included in the SDK which work without problems with the same path/file.
</p>

<p>
	<img alt="2020-11-27_14-54-03_TestPrint_(Sample).png.e02005e0f2807fe10bad922722323c76.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15393" data-ratio="59.89" width="531" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-54-03_TestPrint_(Sample).png.e02005e0f2807fe10bad922722323c76.png">
</p>

<p>
	 
</p>

<p>
	The call as well as the sample code looks not that complicated, not sure what is causing the problem.
</p>

<p>
	<img alt="2020-11-27_14-53-28_Windows_Layout_SDK_Programming_Manual_-_Adobe_Acro.png.32b115940d10d83764cef23dbc101079.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15390" data-ratio="114.91" width="597" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-53-28_Windows_Layout_SDK_Programming_Manual_-_Adobe_Acro.png.32b115940d10d83764cef23dbc101079.png"><img alt="2020-11-27_14-53-38_Windows_Layout_SDK_Programming_Manual_-_Adobe_Acro.png.46064b525bc6be7b0eb228cc85096ea7.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15391" data-ratio="71.35" width="967" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-53-38_Windows_Layout_SDK_Programming_Manual_-_Adobe_Acro.png.46064b525bc6be7b0eb228cc85096ea7.png"><img alt="2020-11-27_14-53-56_CUsersMichael.UrayDownloadsCitizenSDKsdk-la.png.8b11b7436b49f2a9cfb56ecf8c6d9b91.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15392" data-ratio="30.48" width="899" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-53-56_CUsersMichael.UrayDownloadsCitizenSDKsdk-la.png.8b11b7436b49f2a9cfb56ecf8c6d9b91.png"><img alt="2020-11-27_14-59-58_Windows_Layout_SDK_Programming_Manual_-_Adobe_Acro.png.8de0819b19dbaf7a455b7ddc0cfc9d88.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15395" data-ratio="102.24" width="535" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-59-58_Windows_Layout_SDK_Programming_Manual_-_Adobe_Acro.png.8de0819b19dbaf7a455b7ddc0cfc9d88.png">
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	I did notice also another strange behaviour with the DLL selection of the constructor.<br>
	<br>
	Adding contructor, choosing DLL the first time:
</p>

<p>
	 
</p>

<p>
	<img alt="2020-11-27_15-14-18_Mozilla_Firefox.png.8f1bf1109fa9b9690cc27a2bcea818a5.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15396" data-ratio="52.20" width="1200" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_15-14-18_Mozilla_Firefox.png.8f1bf1109fa9b9690cc27a2bcea818a5.png">
</p>

<p>
	<img alt="2020-11-27_15-14-26_Untitled_1_Block_Diagram.png.602140c83103da2e89f39d583495db9c.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15397" data-ratio="75.64" width="665" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_15-14-26_Untitled_1_Block_Diagram.png.602140c83103da2e89f39d583495db9c.png">
</p>

<p>
	 
</p>

<p>
	If I choose the DLL the first time, then the constructor node seems not to to be refering to the DLL.<br>
	It's empty and property and invoke nodes do not show anything.
</p>

<p>
	<img alt="2020-11-27_15-14-33_Untitled_1_Block_Diagram_.png.513d96053cf37e491daafaec50321eef.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15398" data-ratio="71.93" width="171" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_15-14-33_Untitled_1_Block_Diagram_.png.513d96053cf37e491daafaec50321eef.png"><br>
	I have to chose then again "Select Constructor..." and select the according DLL again, then I can access invoke and property nodes by the constructor reference without problems.
</p>

<p>
	<img alt="2020-11-27_15-14-49_Mozilla_Firefox.png.3a0b35bf2c3e2cfee3094cbb5e065d8d.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15399" data-ratio="55.72" width="1200" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_15-14-49_Mozilla_Firefox.png.3a0b35bf2c3e2cfee3094cbb5e065d8d.png">
</p>

<p>
	<img alt="2020-11-27_15-14-54_Untitled_1_Block_Diagram_.png.7dec08c11300d5001ee83b9ef5174f2b.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15400" data-ratio="81.70" width="623" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_15-14-54_Untitled_1_Block_Diagram_.png.7dec08c11300d5001ee83b9ef5174f2b.png">
</p>

<p>
	The second time it works and the node is reffering to the DLL.
</p>

<p>
	<img alt="2020-11-27_15-15-33_Untitled_1_Block_Diagram_.png.75dee0c1d4600f29defc4db6491174e1.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15401" data-ratio="53.47" width="144" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_15-15-33_Untitled_1_Block_Diagram_.png.75dee0c1d4600f29defc4db6491174e1.png">
</p>

<p>
	I tried it with LabVIEW 2013 as well as with 2020.<br>
	Any idea what could be wrong?
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-59-33_print.png.b337d6a765a074bb2568842483582ba3.png" data-fileid="15394" data-fileext="png" rel=""><img alt="2020-11-27_14-59-33_print.png" class="ipsImage ipsImage_thumbnailed" data-fileid="15394" data-ratio="33.15" width="1200" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2020_11/2020-11-27_14-59-33_print.png.b337d6a765a074bb2568842483582ba3.png"></a>
</p>
]]></description><guid isPermaLink="false">21839</guid><pubDate>Fri, 27 Nov 2020 14:55:47 +0000</pubDate></item><item><title>Network Status via .net</title><link>https://lavag.org/topic/20461-network-status-via-net/</link><description><![CDATA[<p>
	Can anybody help me figure out how to run this .net code in LabVIEW
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted">
<span class="kwd">bool</span><span class="pln"> networkUp </span><span class="pun">=</span><span class="pln"> </span><span>System</span><span class="pun">.</span><span>Net</span><span class="pun">.</span><span>NetworkInformation</span><span class="pun">.</span><span>NetworkInterface</span><span class="pun">.</span><span>GetIsNetworkAvailable</span><span class="pun">();</span></pre>

<p>
	I always seem to fall at the first hurdle with .net, I usually cannot figure out what constructor to use (if any) or in this case even find the method in the GAC or by browsing. As as I understand this method is "global" and does not need any kind of constructor?
</p>

<p>
	Any ideas?
</p>

<p><a href="https://lavag.org/uploads/monthly_2018_03/Capture.PNG.b5e65d7a960d2dde86448f099de3df34.PNG" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="13019" src="https://lavag.org/uploads/monthly_2018_03/Capture.PNG.b5e65d7a960d2dde86448f099de3df34.PNG" class="ipsImage ipsImage_thumbnailed" alt="Capture.PNG"></a></p>]]></description><guid isPermaLink="false">20461</guid><pubDate>Tue, 13 Mar 2018 09:13:50 +0000</pubDate></item><item><title><![CDATA[replicate cURL --form file=@<filepath> <URL> behavor]]></title><link>https://lavag.org/topic/21784-replicate-curl-form-file-behavor/</link><description><![CDATA[<p>
	I think I have nailed converting every other curl command to <abbr title="LabVIEW">LV</abbr> native.  This one has me stumped and it should be real easy. 
</p>

<p>
	<code>cul --location -H </code><code>"x-file-format: &lt;FILE&gt;"</code> <code>-H </code><code>"x-campaign-name: TEST_CAMPAIGN"</code> <code>-H </code><code>"x-session-name: TEST_SESSION"</code> <code>-H </code><code>"x-description: DESCRIPTION"</code> <code>-H </code><code>"x-tags: cc13,test"</code> <code>-H </code><code>"x-notify-email: user@company.com"</code><code> --form </code><code>file</code><code>=@</code><code>/data/file.file</code><code> http://URL</code>
</p>

<p>
	Also this would help on a little script that I am hoping to release at some point. Given the number of curl examples on the internet made a parser that will generate a vi from a curl example. 
</p>

<div title="Hint: double-click to select code">
	<div>
		 
	</div>
</div>
]]></description><guid isPermaLink="false">21784</guid><pubDate>Fri, 02 Oct 2020 18:28:15 +0000</pubDate></item><item><title>LabVIEW client for Jupyter Kernels</title><link>https://lavag.org/topic/20798-labview-client-for-jupyter-kernels/</link><description><![CDATA[<p>
	For a while I've been tinkering with the idea of building a LabVIEW client that could to talk to Jupyter kernels for interfacing with Python having been previously a user of RolfK's OpenG LabPython package. Although this, and now the native LabVIEW 2018 Python support have many uses (and indeed I use them in my 'production' code), there were a few things that a Jupyter kernel client can do:
</p>

<ul>
	<li>
		Not be tied to particular versions of Python - LabPython got stuck for me around 2.7.10 and I think was fussy about which compiler have been used. The 2018 native support is restricted to 2.7 or 3.6 I believe (3.7 defintiely doesn't work)
	</li>
	<li>
		Not being tied to the same 32/64 bits of LabVIEW
	</li>
	<li>
		Being able to offload the Python to a remote server, or go cross platform
	</li>
</ul>

<p>
	I haven't investigated the Enthought package (too much hassle to get a new vendor set up on my University's purchasing system and not really able to justify spending tax payer's money on playing!) which I suspect might be doing something similar.
</p>

<p>
	Anyway, the attached zip file is a proof of concept - it includes a test vi that will try to find an ipython executable and fire it up and you can then interact with it. There's lots of things not properly tested and probably a slew of bugs as well. To run it you need several dependencies:
</p>

<ol>
	<li>
		<s>OpenG Toolkit libraries, particularly the LabVIEW Data, string, error and array libraries</s>
	</li>
	<li>
		<s>The JKI JSON library - I had to pick a JSON serialiser and the JKI one seemed as good as any and better than some...</s>
	</li>
	<li>
		The JSONText JSON serialiser library available via VIPM
	</li>
	<li>
		The Zero-MQ Labview bindings - libzmq is the underlying network transport used in Jupyter and there is an excellent LabVIEW bindings library for it.
	</li>
	<li>
		The attached SHA256 implementation so that the communications messages are properly HMAC signed.
	</li>
	<li>
		LabVIEW 2018 - sorry I'm only writing in 2018 now and this code uses malleable vi's with type specialization and asserts in use - so it may not be easy to backport
	</li>
</ol>

<p>
	There's a few things that I'd still like to figure out - primarily the client protocol is very much focussed (reasonably enough) around the idea that the client is sending strings and is interested in string representations of data.I'd like to figure out an efficient way to transfer largish LabVIEW data structures backwards and forwards. I think this probably means developing a custom message handler and registering it with the kernel when the code starts and writing some Python 'flatten to string' and 'unflatten from string' code - but that's only this week's concept....
</p>

<p>
	If you use it, please note that this probably only alpha quality at best -  it may or may not work for you, it may not be safe to use, If it causes any loss or damage or eats your cat then it's not my fault....
</p>

<p>
	<strong>Edit 6th March 2019:</strong> I've switched the JSON parser to JSONText, found and fixed a few bugs, managed to build a VI package for it that should have the correct dependencies and installs the example client in the LabVIEW example finder.
</p>

<p>
	<strong>Edit 19th April 2019</strong>: Added more options to connect the example client to remote and already running kernels (and not to shut them down on exit!). Some other fixes as well.
</p>

<p>
	<strong>Edit 11th Arpil 2020: </strong>Updated the SHA256  version to one that can correctly hash files without reading the whole thing into memory.
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	<a class="ipsAttachLink" data-fileext="vip" data-fileid="14032" href="https://lavag.org/applications/core/interface/file/attachment.php?id=14032" rel="">university_of_leeds_lib_jupyter_client-1.1.0.6.vip</a>
</p>
<p>
<a class="ipsAttachLink" href="https://lavag.org/applications/core/interface/file/attachment.php?id=14711" data-fileext="vip" data-fileid="14711">university_of_leeds_lib_sha256-1.1.2.7.vip</a></p>]]></description><guid isPermaLink="false">20798</guid><pubDate>Sun, 24 Feb 2019 23:46:22 +0000</pubDate></item><item><title>PostgreSQL dll issue</title><link>https://lavag.org/topic/21046-postgresql-dll-issue/</link><description><![CDATA[<p>
	Thanks to the nice work of drjdpowell I was able to easily connect &amp; work with PostgreSQL. Did have to use the 32bit included dll's though.
</p>

<p>
	Now when I try to install &amp; run it on a Win10 IoT machine the dll's are not found and throwing errors. Sorry no screenshot at the moment.
</p>

<p>
	The 64bit of PostgreSQL is installed on both machines &amp; works.
</p>

<p>
	The exe of course works just fine on the dev machine.
</p>

<p>
	Does anyone have any ideas? I'm at a loss at the moment &amp; need to get this running.
</p>

<p>
	Thanks.
</p>
]]></description><guid isPermaLink="false">21046</guid><pubDate>Wed, 03 Jul 2019 02:15:53 +0000</pubDate></item><item><title>How To Use UTF Characters in a batch file</title><link>https://lavag.org/topic/21733-how-to-use-utf-characters-in-a-batch-file/</link><description><![CDATA[<p>
	Learned something today. I had an error with some software that relies on a command being called through a batch file. My code that has worked for years was all of a sudden failing. After a bit of digging I noticed my user has some French characters in their surname, so the path to the temporary files I was generating had these non-ASCII characters in it!
</p>

<p>
	If I ran my batch file from CMD.exe Windows was replacing the French character with multiple ASCII characters which is obviously not going to work.
</p>

<p>
	The simple solution is to change the active code page to 65001 which is UTF-8. (See: <a href="https://stackoverflow.com/questions/11962172/echo-utf-8-characters-in-windows-batch" rel="external nofollow">https://stackoverflow.com/questions/11962172/echo-utf-8-characters-in-windows-batch)</a>, so all I did was add the
</p>

<pre>
<code>chcp 65001</code></pre>

<p>
	command to the beginning of the batch file et voilà!
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">21733</guid><pubDate>Tue, 25 Aug 2020 19:10:00 +0000</pubDate></item><item><title>Running .Net application by App()</title><link>https://lavag.org/topic/21710-running-net-application-by-app/</link><description><![CDATA[<p>
	I know how to run .Net executable by MainWindow() constructor but I have some resources defined in App.xaml and MainWindow() doesn't run without them. How to run application starting with App() constructor? Also I need to pass some parameters into MainWindow().
</p>
]]></description><guid isPermaLink="false">21710</guid><pubDate>Thu, 06 Aug 2020 11:57:27 +0000</pubDate></item><item><title>Creating .NET ICollection</title><link>https://lavag.org/topic/16787-creating-net-icollection/</link><description><![CDATA[<p>After a 20 year hiatus, I'm back to writing text code again. Not just any text code, but C# .NET assemblies. After about a day and a half of googling and self teaching, I've hit the wall.</p>
<p> </p>
<p>I've got a .NET assembly that was provided by a manufacturer that controls some hardware. We are calling the higher level .NET functions from Labview and they work. But we aren't getting acceptable performance for the high level calls, so we are trying to drill down into the lower level calls.</p>
<p> </p>
<p>One of the .NET methods requires an ICollection&lt;T&gt; input, there in this case T is a channel object that is created elsewhere. The ICollection function is described the in the MSDN article: <a href="http://msdn.microsoft.com/en-us/library/92t2ye13" rel="external nofollow">http://msdn.microsoft.com/en-us/library/92t2ye13</a></p>
<p> </p>
<p>For reasons I don't really understand, Labview doesn't apparently support a constructor to ICollection. Something about Labivew not supporting calls to .NET generics, but I'd be lying if I said I understood that. But it seems like it should be possible to create a .NET assembly that creates a reference to an ICollection .NET object that can be passed to Labview. But I can't get it to work.</p>
<p> </p>
<p>I've written a simple program that contains two methods. The first method GetUInt32 simply returns an input integer and was written as a test to see if I could write and assembly and call it from Labview. It works great.</p>
<p> </p>
<p>The second method, GetICollection, is a test case to create a collection of UInt32 integers. Should be really simple, but it generates a compiler error. I suspect I'm doing something really basic incorrectly, but I'm at a loss to understand what. Can someone point me in the correct direction?</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_05_2013/post-7727-0-66918400-1367508522.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_05_2013/post-7727-0-66918400-1367508522_thumb.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=8089" class="ipsImage ipsImage_thumbnailed" alt="post-7727-0-66918400-1367508522_thumb.pn"></a></p>
]]></description><guid isPermaLink="false">16787</guid><pubDate>Thu, 02 May 2013 15:30:39 +0000</pubDate></item><item><title>PIPES</title><link>https://lavag.org/topic/7881-pipes/</link><description><![CDATA[<p>Hi.</p>
<p>In one of the posts I saw something called as "PIPES" which is a part of Labview for Linux version.(which was seen under "Connectivity-&gt;Libraries and executables)</p>
<p>Is the same thing available on Labview for Windows also? How can i get the same?</p>
]]></description><guid isPermaLink="false">7881</guid><pubDate>Tue, 24 Jun 2008 08:43:24 +0000</pubDate></item><item><title>ITreeView activex library</title><link>https://lavag.org/topic/21296-itreeview-activex-library/</link><description><![CDATA[<p>
	Hi<br>
	 
</p>

<p>
	I got an old LabVIEW 8.2 VI that use ITreeView under Windows XP. It works fine.<br>
	Now I have upgraded to LV15 and Windows 8.1 and I got an error "Library not registered in mxLT Open Tree Control.vi"
</p>

<p>
	I would like register the library, but where do I find it? I have search the WEB but didn't find anything i could use(or understand;))<br>
	<font color="#2980b9">Edit: I found this "mscomctl.ocx" under SysVow64. </font><br>
	<font color="#2980b9">I have registered it, but LabVIEW still say it's not registered! Has it something to do with LV15 =32bit and "msconctl.ocx" is in 64bit system folder?</font>
</p>

<p>
	Here is the BD of "mxLT Open Tree Control.vi":
</p>

<p>
	<img alt="image.png.38c81aaa5e06cc914fc1103181b94d5c.png" class="ipsImage ipsImage_thumbnailed" data-fileid="14488" data-ratio="47.04" width="406" src="https://lavag.org/applications/core/interface/js/spacer.png" data-src="https://lavag.org/uploads/monthly_2019_12/image.png.38c81aaa5e06cc914fc1103181b94d5c.png">
</p>

<p>
	 
</p>

<p>
	Hope someone can give me a clue:)
</p>

<p>
	 
</p>

<p>
	Thanks in advance
</p>

<p>
	 
</p>

<p>
	/Bjarne
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">21296</guid><pubDate>Fri, 06 Dec 2019 09:57:01 +0000</pubDate></item><item><title>DLL Linked List To Array of Strings</title><link>https://lavag.org/topic/21269-dll-linked-list-to-array-of-strings/</link><description><![CDATA[<p>
	I have a DLL for a device which holds a linked list of structs. Obviously I cannot pass this to LabVIEW, but all I really need are the serial numbers from within the struct. So my idea is to write a wrapper to map the serial numbers to a string array and return them from a dll. Due to my lack of experience with C and lack of examples with the LabVIEW memory manager dll, I'm having quite a hard time. Because the linked list can be of a dynamic length, I am not sure how to handle the memory allocation. This is my attempt so far.
</p>

<p>
	My questions are
</p>

<p>
	1) How do I properly size DSNewHandle to fit the serial number, or is there no need to since it's a pointer which will just be set equal to the address of s_deviceInfo -&gt; serialNumber
</p>

<p>
	2) how do I assign each new 'h' to 'arr'
</p>

<p>
	3) since the number of devices/serial numbers can vary, can I still manage this on the LabVIEW side by passing in an empty array constant as 'arr' to the dll? Or do I need to modify how I'm doing things?
</p>

<div style="background-color:#1e1e1e;color:#d4d4d4;font-size:14px;">
	<div>
		<span style="color:#d4d4d4;">    </span><span style="color:#569cd6;">typedef</span><span style="color:#d4d4d4;"> </span><span style="color:#569cd6;">struct</span><span style="color:#d4d4d4;"> { </span>
	</div>

	<div>
		<span style="color:#d4d4d4;">        int32 len;  </span>
	</div>

	<div>
		<span style="color:#d4d4d4;">        LStrHandle str[];</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">    } </span><span style="color:#d4d4d4;">**</span><span style="color:#d4d4d4;">LStrArrayHandle;</span>
	</div>

	<div>
		 
	</div>
</div>

<div style="background-color:#1e1e1e;color:#d4d4d4;font-size:14px;">
	<div>
		<span style="color:#d4d4d4;">   </span><span style="color:#569cd6;">int</span><span style="color:#d4d4d4;"> </span><span style="color:#dcdcaa;">iir_get_serial_numbers</span><span style="color:#d4d4d4;">(LStrArrayHandle </span><span style="color:#9cdcfe;">arr</span><span style="color:#d4d4d4;">) {</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">        </span><span style="color:#569cd6;">int</span><span style="color:#d4d4d4;"> i </span><span style="color:#d4d4d4;">=</span><span style="color:#d4d4d4;"> </span><span style="color:#b5cea8;">0</span><span style="color:#d4d4d4;">;</span>
	</div>
	 

	<div>
		<span style="color:#d4d4d4;">        </span><span style="color:#c586c0;">while</span><span style="color:#d4d4d4;">(</span><span style="color:#9cdcfe;">s_deviceInfo </span><span style="color:#d4d4d4;">-&gt; </span><span style="color:#9cdcfe;">next</span><span style="color:#d4d4d4;">) {</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">            LStrHandle h </span><span style="color:#d4d4d4;">=</span><span style="color:#d4d4d4;"> (LStrHandle)</span><span style="color:#dcdcaa;">DSNewHandle</span><span style="color:#d4d4d4;">(</span><span style="color:#569cd6;">sizeof</span><span style="color:#d4d4d4;">(LStrHandle));</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">            (*</span><span style="color:#9cdcfe;">h) </span><span style="color:#d4d4d4;">-&gt; </span><span style="color:#9cdcfe;">cnt</span><span style="color:#d4d4d4;"> </span><span style="color:#d4d4d4;">=</span><span style="color:#d4d4d4;"> </span><span style="color:#dcdcaa;">strlen</span><span style="color:#d4d4d4;">(</span><span style="color:#9cdcfe;">s_deviceInfo </span><span style="color:#d4d4d4;">-&gt; </span><span style="color:#9cdcfe;">serial_number</span><span style="color:#d4d4d4;">);</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">            (*</span><span style="color:#9cdcfe;">h) </span><span style="color:#d4d4d4;">-&gt; </span><span style="color:#9cdcfe;">str</span><span style="color:#d4d4d4;"> </span><span style="color:#d4d4d4;">=</span><span style="color:#d4d4d4;"> </span><span style="color:#9cdcfe;">s_deviceInfo </span><span style="color:#d4d4d4;">-&gt; </span><span style="color:#9cdcfe;">serial_number</span><span style="color:#d4d4d4;">;</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">        }</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">        </span><span style="color:#c586c0;">return</span><span style="color:#d4d4d4;"> </span><span style="color:#b5cea8;">0</span><span style="color:#d4d4d4;">;</span>
	</div>

	<div>
		<span style="color:#d4d4d4;">    }</span>
	</div>
</div>
]]></description><guid isPermaLink="false">21269</guid><pubDate>Wed, 13 Nov 2019 23:11:49 +0000</pubDate></item><item><title>Dynamically calling Mathscript .m file in EXE</title><link>https://lavag.org/topic/18983-dynamically-calling-mathscript-m-file-in-exe/</link><description><![CDATA[<p>I have a request to make an EXE be able to dynamically call a .m file with Mathscript.   The .m file is User supplied and not knowable at build time.   But my understanding is that the EXE compiles in the Mathscript, so this cannot work, and that other dynamic mathscript options (such as â€œevalâ€) do not work in an EXE.  Has anyone encountered this issue before? </p>]]></description><guid isPermaLink="false">18983</guid><pubDate>Mon, 11 May 2015 08:28:48 +0000</pubDate></item><item><title>Problem with a .dll for HID device</title><link>https://lavag.org/topic/20964-problem-with-a-dll-for-hid-device/</link><description><![CDATA[<p>
	Hello,
</p>

<p>
	 
</p>

<p>
	I am a .dll  that act as interface with my HID device and Windows API.
</p>

<p>
	I am a problem to open a connection with my device using the CLFN. But if i run the example, that is made with VC++, that is provided from  the Author of the .dll, the function return me the error code: "Device not Found"
</p>

<p>
	 
</p>

<p>
	The function and prototype in the DLL is:
</p>

<p>
	 
</p>

<p>
	<font face="georgia,palatino"><em>FT260_STATUS</em></font> <strong>FT260_OpenByVidPid</strong>(<font face="georgia,palatino"><em>WORD</em></font> vid, <font face="georgia,palatino"><em>WORD</em></font> pid, <em>DWORD</em> deviceIndex, <font face="georgia,palatino"><em>FT260_HANDLE*</em></font> pFt260Handle)
</p>

<p>
	<font face="georgia,palatino"><em>FT260_STATUS</em></font> is an enum that i defined it as uint8 enum in labview
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	This is how I configured the CLFN:
</p>

<p>
	 
</p>

<p>
	<font face="georgia,palatino"><em>uint8_t</em></font> <strong>FT260_OpenByVidPid@16</strong>(<font face="georgia,palatino"><em>uint16_t</em></font> Vid, <font face="georgia,palatino"><em>uint16_t</em></font> Pid, <em>uint32_t</em> DeviceIndex, <font face="georgia,palatino"><em>uint32_t*</em></font> SessionID)
</p>

<p>
	Convenction call is: stdcall (WINAPI)
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	Can someone help me to understand what is the problem?
</p>

<p>
	 
</p>

<p>
	Thank you very much
</p>
]]></description><guid isPermaLink="false">20964</guid><pubDate>Wed, 15 May 2019 15:18:22 +0000</pubDate></item><item><title>converting local path to URI</title><link>https://lavag.org/topic/20928-converting-local-path-to-uri/</link><description><![CDATA[<p>
	Hi,
</p>

<p>
	I'm trying to convert a local file path c:\... to a URI path file:///wdcwdc%20wdcwc...
</p>

<p>
	Windows MPR.dll (C:\Windows\System32\mpr.dll) does that conversion using WNetGetUniversalNameA
</p>

<p>
	<a href="https://docs.microsoft.com/en-us/windows/desktop/api/winnetwk/nf-winnetwk-wnetgetuniversalnamea#see-also" rel="external nofollow">https://docs.microsoft.com/en-us/windows/desktop/api/winnetwk/nf-winnetwk-wnetgetuniversalnamea#see-also</a>
</p>

<p>
	For some reason, I don't get the prototype to work using the call dll function.
</p>

<p>
	Help will be much appreciated.
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">20928</guid><pubDate>Sun, 05 May 2019 14:17:56 +0000</pubDate></item><item><title>TCP with TLS (SSL)</title><link>https://lavag.org/topic/16329-tcp-with-tls-ssl/</link><description><![CDATA[<p>Hello all,</p>
<p>I am currently trying to create an HTTPS server with LabVIEW.</p>
<p>I have been using the built in TCP VI's for communication with the server and client, however I would like to use SSL or TLS in order to encrypt the data that is being sent across the connection.  I know that I can point to either the self-signed cert that comes packaged with LabVIEW, or the certificate that we have for our server on-site.</p>
<p>I'm fairly certain that I can achieve this by building an assembly in .NET, and then using it in LabVIEW.  I have looked around for TCP with TLS libraries for LabVIEW but could only found some out-of-date ones that didn't work with the newest version of LabVIEW.  Do these libraries exist somewhere?  And if not, is the .NET approach a solid idea?</p>
<p>Thanks,</p>
<p>Brandon Jones</p>
]]></description><guid isPermaLink="false">16329</guid><pubDate>Thu, 15 Nov 2012 21:05:04 +0000</pubDate></item><item><title>Reinsert/reinitialize ActiveX container</title><link>https://lavag.org/topic/20086-reinsertreinitialize-activex-container/</link><description><![CDATA[<p>
	Firstly, I'm reposting from the NI Forums here: <a href="https://forums.ni.com/t5/LabVIEW/Programatically-reinsert-an-ActiveX-Container/m-p/3593100#M1006649" rel="external nofollow">Programatically reinsert an ActiveX Container</a>
</p>

<p>
	TL;DR: My goal is to programmatically carry out whatever happens when I right click on an ActiveX container and choose the option 'Insert ActiveX Object...'. Ideally, I would like to avoid using VI Scripting to do this, but I haven't gotten anywhere so far and so really any solution will be a step forwards.
</p>

<p>
	My most recent attempt (I'm using NI's Actor Framework) has been to place the ActiveX container on an Actor Core panel, then use Pre-Launch Init to open a Static VI Reference, and resize the front panel, with the container set to scale with the front panel. This doesn't work, because the static reference doesn't refer to the same thing that the AF then opens using the Launch Actor VI, but ignoring that problem, it also doesn't help with resizing the container.
</p>

<p>
	Previously, I manually resized the container, but this I could only do after it was in existence, and so the object was already inserted.
</p>

<p>
	My current observation seems to be that after I choose the ActiveX object to insert, there is little/nothing I can do to change the size of the object (I can change the container, but this doesn't do anything to the object - probably the object isn't very friendly-ly coded, but I can't do anything about that...). Consequently, I come back to my goal, which is to call some Invoke Node or similar, to 'Insert ActiveX Object...'.
</p>

<p>
	Is there some way to do this? I don't intend to do it often, so long execution times, recompilation of VIs, shooting a cow over the moon are all fine if needed.
</p>
]]></description><guid isPermaLink="false">20086</guid><pubDate>Tue, 04 Apr 2017 06:20:03 +0000</pubDate></item><item><title>DLLs and Project Instances</title><link>https://lavag.org/topic/20828-dlls-and-project-instances/</link><description><![CDATA[<p>
	Question: if I have VIs running under two different projects (thus separate "instances" of LabVIEW) and both VIs are calling into the same dll, is a separate copy of the dll loaded in each instance?  Or is there only one copy of the dll?  
</p>
]]></description><guid isPermaLink="false">20828</guid><pubDate>Thu, 21 Mar 2019 15:17:23 +0000</pubDate></item><item><title>.NET type conversions in LabVIEW</title><link>https://lavag.org/topic/20574-net-type-conversions-in-labview/</link><description><![CDATA[<p>
	Hello,
</p>

<p>
	I need to implement this simple data casting of c# objects in <abbr title="LabVIEW">LV</abbr>
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">    object o = "MyString";
    SqlString t1 = o as String      </span></pre>

<p>
	 
</p>

<p>
	How this can be done in <abbr title="LabVIEW">LV</abbr>??
</p>

<p>
	 
</p>

<p>
	 
</p>

<p><a class="ipsAttachLink" href="//lavag.org/applications/core/interface/file/attachment.php?id=13349">cast.vi</a></p>
<p><a href="https://lavag.org/uploads/monthly_2018_07/Capture.PNG.229b81dd3e24400c51bd8d1155a8a2a0.PNG" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="13348" src="https://lavag.org/uploads/monthly_2018_07/Capture.PNG.229b81dd3e24400c51bd8d1155a8a2a0.PNG" class="ipsImage ipsImage_thumbnailed" alt="Capture.PNG"></a></p>]]></description><guid isPermaLink="false">20574</guid><pubDate>Mon, 16 Jul 2018 08:34:19 +0000</pubDate></item><item><title>Hidden terminals on the .NET Constructor Node?</title><link>https://lavag.org/topic/20615-hidden-terminals-on-the-net-constructor-node/</link><description><![CDATA[<p>
	So this just happened to me and I'm quite confused by it. As it turns out, the .NET Constructor Node not only provides terminals for error in, error out and the reference, but actually two more "hidden" terminals:
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="13428" src="https://lavag.org/uploads/monthly_2018_08/5b87ee4ed6c59_Constructorhasadditionalterminals.png.b6a2b9f4b74790c0d3f0b3f3001fa815.png" alt="Constructor has additional terminals.png"></p>

<p>
	<strong>Notice</strong>: I left the error terminals untouched and none of the wires are connected (try it yourself). This never occurred to me. Only now, while hunting a null reference exception I found the constructor node looked "off", like this:
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="13429" src="https://lavag.org/uploads/monthly_2018_08/5b87ee9326cdb_Connectedtohiddenterminal.jpg.7159cbf966afb077faef68ede4d3ba73.jpg" alt="Connected to hidden terminal.jpg"></p>

<p>
	The strange part is that the terminal doesn't actually carry the reference (which is why I receive the null exception). It only specifies the type. The upper left terminal is a void type input, so the wire is always broken.
</p>

<p>
	Does anyone know why these extra terminals exist? They don't seem to be part of the specification as far as I can tell.
</p>

<p>
	Any fancy things we can do with this? <img alt=":D" data-emoticon="" src="https://lavag.org/uploads/emoticons/default_biggrin.png" title=":D"></p>
]]></description><guid isPermaLink="false">20615</guid><pubDate>Thu, 30 Aug 2018 13:22:34 +0000</pubDate></item><item><title>How do I pass this structure with union into my Call Library Function Node?</title><link>https://lavag.org/topic/20489-how-do-i-pass-this-structure-with-union-into-my-call-library-function-node/</link><description><![CDATA[<p>
	<span style="color:rgb(39,42,52);font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;">Trying to call the function below:</span>
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted">
<span class="kwd">typedef</span><span class="pln"> </span><span class="kwd">struct</span><span class="pln"> tagZCAN_CHANNEL_INIT_CONFIG </span><span class="pun">{</span><span class="pln">
    UINT can_type</span><span class="pun">;</span><span class="pln"> </span><span class="com">//0:can  1:canfd</span><span class="pln">
    </span><span class="kwd">union</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
        </span><span class="kwd">struct</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">
            UINT  acc_code</span><span class="pun">;</span><span class="pln">
            UINT  acc_mask</span><span class="pun">;</span><span class="pln">
            UINT  reserved</span><span class="pun">;</span><span class="pln">
            BYTE  filter</span><span class="pun">;</span><span class="pln">
            BYTE  timing0</span><span class="pun">;</span><span class="pln">
            BYTE  timing1</span><span class="pun">;</span><span class="pln">
            BYTE  mode</span><span class="pun">;</span><span class="pln">
        </span><span class="pun">}</span><span class="pln">can</span><span class="pun">;</span><span class="pln">
        </span><span class="kwd">struct</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">
            UINT   acc_code</span><span class="pun">;</span><span class="pln">
            UINT   acc_mask</span><span class="pun">;</span><span class="pln">
            UINT   abit_timing</span><span class="pun">;</span><span class="pln">
            UINT   dbit_timing</span><span class="pun">;</span><span class="pln">
            UINT   brp</span><span class="pun">;</span><span class="pln">
            BYTE   filter</span><span class="pun">;</span><span class="pln">
            BYTE   mode</span><span class="pun">;</span><span class="pln">
            USHORT pad</span><span class="pun">;</span><span class="pln">
            UINT   reserved</span><span class="pun">;</span><span class="pln">
        </span><span class="pun">}</span><span class="pln">canfd</span><span class="pun">;</span><span class="pln">
    </span><span class="pun">};</span><span class="pln">
</span><span class="pun">}</span><span class="pln">ZCAN_CHANNEL_INIT_CONFIG</span><span class="pun">;</span></pre>

<p>
	<span style="font-size:16px;">CHANNEL_HANDLE ZCAN_InitCAN(DEVICE_HANDLE device_handle, UINT can_index, <span style="color:#daa520;">ZCAN_CHANNEL_INIT_CONFIG* pInitConfig</span>);</span>
</p>

<p>
	 
</p>

<p>
	<span style="color:rgb(51,51,51);font-family:'PingFang SC', 'Lantinghei SC', 'Microsoft YaHei', arial, '宋体', sans-serif, tahoma;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;">Can anyone give me some tips on how to pass this structure with union into DLL?</span>
</p>

<p>
	 
</p>

<p>
	<span style="color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;">Thanks for any help you can provide!</span><img alt=":)" data-emoticon="" src="https://lavag.org/uploads/emoticons/default_smile.png" title=":)"></p>
]]></description><guid isPermaLink="false">20489</guid><pubDate>Fri, 13 Apr 2018 16:14:33 +0000</pubDate></item><item><title>Accesing COM child object</title><link>https://lavag.org/topic/17931-accesing-com-child-object/</link><description><![CDATA[<p>Hello,</p>
<p> </p>
<p>I'm trying to use a library to interface some LVDT gauges from Marposs. It's implemented through COM objects and I have it working in Excel with VBA with this code:</p>
<p> </p>
<pre class="ipsCode prettyprint">Private Sub CommandButton1_Click()Dim oSmaoMain As SMAO.SMaoMainDim clsInfo As SMAO.InfoDim sInfo As String'Initialize the SMAOMain ObjectSet oSmaoMain = New SMAO.SMaoMainoSmaoMain.Initialize'List all the Installed DriversFor i = 1 To oSmaoMain.DriversCount   sInfo = sInfo &amp; "Driver Name : " &amp; oSmaoMain.Driver(i) &amp; " " &amp; oSmaoMain.DriverDesc(i) &amp; vbNewLineNextMsgBox sInfo, vbOKOnly, "Installed Drivers"'List all the Enabled DriversSet clsInfo = oSmaoMain.InfosInfo = ""For i = 1 To clsInfo.DriversCount   sInfo = sInfo &amp; "Driver Name : " &amp; clsInfo.Driver(i) &amp; " " &amp; clsInfo.DriverDesc(i) &amp; vbNewLineNextMsgBox sInfo, vbOKOnly, "Enabled Drivers"Set clsInfo = NothingSet oSmaoMain = NothingEnd Sub</pre>
<p>When I port this code to LabVIEW I get answer from the SMAO.SMaoMain, correct initilization and even I can read the main objects properties. The problem comes when I try to access it's child object SMAO.SMaonMain.Info. When I get the reference and I make calls to the methods/properties, I get different results, always 0 drivers enabled.</p>
<p> </p>
<p>I've attached the LabVIEW code I'm using and some captures of the creatable objects I can see from LabVIEW.</p>
<p> </p>
<p>Any idea of what could be happening?</p>
<p> </p>
<p> </p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_01_2014/post-50325-0-37873600-1390386768.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_01_2014/post-50325-0-37873600-1390386768_thumb.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=8882" class="ipsImage ipsImage_thumbnailed" alt="post-50325-0-37873600-1390386768_thumb.p"></a></p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_01_2014/post-50325-0-98302700-1390386776.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_01_2014/post-50325-0-98302700-1390386776.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=8883" class="ipsImage ipsImage_thumbnailed" alt="post-50325-0-98302700-1390386776.png"></a></p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_01_2014/post-50325-0-98969700-1390386778.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_01_2014/post-50325-0-98969700-1390386778.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=8884" class="ipsImage ipsImage_thumbnailed" alt="post-50325-0-98969700-1390386778.png"></a></p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_01_2014/post-50325-0-11794200-1390386780.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_01_2014/post-50325-0-11794200-1390386780.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=8885" class="ipsImage ipsImage_thumbnailed" alt="post-50325-0-11794200-1390386780.png"></a></p>
]]></description><guid isPermaLink="false">17931</guid><pubDate>Wed, 22 Jan 2014 10:34:24 +0000</pubDate></item><item><title>Calling GetValueByPointer.xnode in executable</title><link>https://lavag.org/topic/18571-calling-getvaluebypointerxnode-in-executable/</link><description><![CDATA[<p>I've got a 3rd party DLL I call from within my application.  One of the functions returns a pointer to a variable length null terminated string.  I use the mysterious GetValueByPointer.xnode to dereference the string and return it's value.  This works great from within the Labview development environment.  I'm using 2013Sp1.</p>
<p> </p>
<p>But when I compile the application into an executable, the xnode returns an error 7.  It appears the DLL is returning a valid pointer, but the xnode can't dereference it.  My hunch is that the pointer is crossing some kind of protected boundary, but I don't know for sure.</p>
<p> </p>
<p>I suppose I could write a wrapper around the DLL call, but I really don't want to have to do that if there is a simple workaround.  Any ideas?</p>
<p> </p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_10_2014/post-7727-0-17278600-1412865153.jpg" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_10_2014/post-7727-0-17278600-1412865153_thumb.jpg" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=9603" class="ipsImage ipsImage_thumbnailed" alt="post-7727-0-17278600-1412865153_thumb.jp"></a></p>
]]></description><guid isPermaLink="false">18571</guid><pubDate>Thu, 09 Oct 2014 14:42:19 +0000</pubDate></item><item><title>ClearPath-SC API</title><link>https://lavag.org/topic/20544-clearpath-sc-api/</link><description><![CDATA[<p>
	I'm trying to use the Import Shared Library Wizard to call C/C++ calls from the ClearPath-SC SDK in LabVIEW. I'm having issues with the wizard creating the VIs where it's saying that none of the functions can be created. It also seems like it's importing the names of the functions incorrectly as well. Does anyone have any idea what's going on or what I can do to fix it? Thank you.
</p>
<p><a href="https://lavag.org/uploads/monthly_2018_06/Issue.JPG.e730f037cd49c16f4380b984ff125285.JPG" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="13258" src="https://lavag.org/uploads/monthly_2018_06/Issue.JPG.e730f037cd49c16f4380b984ff125285.JPG" class="ipsImage ipsImage_thumbnailed" alt="Issue.JPG"></a></p>]]></description><guid isPermaLink="false">20544</guid><pubDate>Mon, 04 Jun 2018 22:29:05 +0000</pubDate></item><item><title>Data type matching when calling a DLL</title><link>https://lavag.org/topic/20530-data-type-matching-when-calling-a-dll/</link><description><![CDATA[<p>
	To use a controller from LabVIEW I have to use some functions of a DLL.
</p>

<p>
	For one of the functions, according to the header file .h there is a structure data with parameters of different types that I have to pass to the dll. Some of the parameres are BYTE (1 Byte)  and WORD (2 Bytes).
</p>

<p>
	When compiling this kind of structure with Visual C++ and looking at it's size with "sizeof()" it seems to me that 4 Bytes variables have to start in a position multiple of 4. For example if there is a BYTE and then a DWORD, the 3 Bytes after the BYTE are ignored and the DWORD starts at Bytes 5 to 8.
</p>

<p>
	When defining a LabVIEW cluster to match the DLL structure, will LabVIEW do the same? If in my cluster there is a U8 variable and then a U32, will anyway the U8 take 4 bytes?
</p>

<p>
	 
</p>

<p>
	Thank you.
</p>
]]></description><guid isPermaLink="false">20530</guid><pubDate>Thu, 24 May 2018 06:51:23 +0000</pubDate></item><item><title>Call Library Function Exception Error</title><link>https://lavag.org/topic/20465-call-library-function-exception-error/</link><description><![CDATA[<p>
	Was hoping someone might be able to give me a tip on this one...
</p>

<p>
	Trying to call the function below:
</p>

<p>
	typedef struct<br>
	{<br>
	    unsigned int  Length;<br>
	    unsigned int  Id;<br>
	    unsigned int  TimeTag;<br>
	    char    Data[1024];<br>
	}DATA_FRAME;
</p>

<p>
	<br>
	int __stdcall SRVIVR_API_StoreData(void* handle, int partition,  int totalFrames, DATA_FRAME frameData[]);
</p>

<p>
	Here is what the import dll tool produces:
</p>

<p>
	<img alt="1.png" class="ipsImage ipsImage_thumbnailed" data-fileid="13034" src="https://lavag.org/uploads/monthly_2018_03/1.png.357d1cda6b2286de193cdb8f81019814.png"></p>

<p>
	This does not look correct to me and produces the dreaded 1097 exception error.
</p>

<p>
	I modified the call to be:
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="13035" src="https://lavag.org/uploads/monthly_2018_03/2.png.0349426b047f0dbd79e50a0fc31f0dad.png" alt="2.png"></p>

<p>
	Which I believe is closer to the intent of the original C function, but still gives me a 1097 error.  I suspect
</p>

<p>
	that somehow the array pointer that the function is expecting is not correct.  The frameData parameter is being passed
</p>

<p>
	into the function as a 'Adapt to Type', Array Pointer.  I also tried flattening to a single U32 array and passing that in as an array data type but still no joy.  Any ideas?
</p>

<p>
	BTW, I have had success calling many other functions from the dll of the form:
</p>

<p>
	int __stdcall func(void* handle, int param1,  int param2, etc);
</p>
]]></description><guid isPermaLink="false">20465</guid><pubDate>Thu, 15 Mar 2018 12:11:36 +0000</pubDate></item><item><title>Callbacks with DLL, Labview and helper code</title><link>https://lavag.org/topic/20412-callbacks-with-dll-labview-and-helper-code/</link><description><![CDATA[<p>
	Hi all.  I'm going to ask this question without attachments to see if I get an quick obvious answer and if necessary, can upload my code examples.  I've got a 3rd party DLL (no debug info, but know it is stable) that requires callback functions to respond to.  I've gone the route of creating my own DLL to support the callbacks and relay the events to a Labview event structure.  The way I have it set up is:  1) Labview calls an exported function in my DLL simply so that I can store Labview's UserEvent Reference parameter for the PostUserEvent function.  It gets stored in a static variable.  2)  A second exported function passes its callback function pointer up to Labview and Labview passes it to the 3rd party DLL.  
</p>

<p>
	So I launch the system and things seem to work at first - my DLL actually gets called and relays data from the 3rd party DLL to a Labview Event structure.  What seems to be happening:  Getting a valid function pointer to 3rd party DLL, getting the event trigger in my DLL, properly calling the Labview user event structure using data allocated with Labviews native memory functions.  BUT, then I get memory access crashes.  So my question is, do you guys think this is because Labview is trashing (deallocating) my DLL callback function rendering the pointer invalid after a certain time??  And if so, is there a way to prevent this?  And or, should I be taking a different approach and actually create a wrapper where the 3rd party DLL is called from within my DLL?  
</p>
]]></description><guid isPermaLink="false">20412</guid><pubDate>Thu, 25 Jan 2018 22:30:52 +0000</pubDate></item><item><title>How to deal with clusters containing clusters?</title><link>https://lavag.org/topic/20403-how-to-deal-with-clusters-containing-clusters/</link><description><![CDATA[<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	Hi
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	When I call the DLL, there is a structure:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">struct Signal
{
uint32 nStartBit; 
uint32 nLen;
double nFactor; 
double nOffset;
double nMin; 
double nMax;
double nValue;
uint64 nRawValue;
bool is_signed; 
char unit[11];
char strName[66];
char strComment[201]; 
};</span></pre>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	There is another  <span><span>Message </span></span>structure to the above Signal:
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">struct Message
{
uint32 nSignalCount; 
uint32 nID;
uint8 nExtend; 
uint32 nSize; 
Signal vSignals[513]; 
char strName[66];
char strComment[201]; 
}</span></pre>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	  The point is  <u><span><strong>Signal vSignals[513];</strong> </span></u>
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	I've tried to solve it like this，but the program will crash.
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	How to create struct Message ，any good suggestions?  Thanks a lot.
</p>

<p style="margin:0px;font-size:16px;line-height:1.42;color:rgb(51,51,51);font-family:Helvetica, Arial, sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	 
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" data-fileid="12864" href="https://lavag.org/uploads/monthly_2018_01/qq.png.c94c0593ac43520e5fd395b5d9ccbdb5.png" rel=""><img alt="qq.png" class="ipsImage ipsImage_thumbnailed" data-fileid="12864" src="https://lavag.org/uploads/monthly_2018_01/qq.thumb.png.ee8615c98c54c84f6811169608e2718f.png"></a>
</p>

<p><a class="ipsAttachLink" href="//lavag.org/applications/core/interface/file/attachment.php?id=12865">message.vi</a></p>]]></description><guid isPermaLink="false">20403</guid><pubDate>Sat, 13 Jan 2018 16:52:54 +0000</pubDate></item><item><title>PDF extract text</title><link>https://lavag.org/topic/12228-pdf-extract-text/</link><description><![CDATA[<p>Hi all,</p>
<p>I want to be able to extract the text from PDFs from within <abbr title="LabVIEW">LV</abbr>.  I thought this might be a common requirement but searching for "PDF" here returns nil, and Googling fairs little better.  I've discovered that extracting text from a PDF is probably not easy in any language: the text seems to be contained in a very heavily encoded data stream.  I doubt I could write an <abbr title="LabVIEW">LV</abbr> algorithm that could do the extraction well (or even badly, for that matter).  My thoughts turn to interfacing with an existent DLL.  Numerous PDF to text DLLs exist on the Web but I don't know C and its variants so don't really understand DLLs, to be honest.</p>
<p>A compay called <a href="http://www.softinterface.com/" rel="external nofollow">Softinterface</a> seem the most likely key to success.  They've got some good stuff.  I've had a play with some of their DLLs and the <abbr title="LabVIEW">LV</abbr> Import Library wizard which created some VIs but I couldn't get them to do anything (oddly, the header file for the DLL only defined very few of the functions that the DLL appeared to support).</p>
<p>I eventually got something going via the afore mentioned comapany's product ConvertDoc.  This is a PDF to text GUI application that has a command line.  So, I send the command line paramaters to it via the System Exec VI calling the cmd console.  It extracts the text from the PDF and writes it to a text file (not surprisingly).  <abbr title="LabVIEW">LV</abbr> then reads the text file and does what I want with the text.</p>
<p>So, I can do it but only with the clunkiest of methods.  Can anyone point me in the direction of a slicker method of extracting the text from a PDF?  Many thanks in anticipation.</p>
<p>Regards, Graeme.</p>
]]></description><guid isPermaLink="false">12228</guid><pubDate>Tue, 13 Apr 2010 18:31:09 +0000</pubDate></item><item><title>Running a LabVIEW EXE from the Console</title><link>https://lavag.org/topic/11719-running-a-labview-exe-from-the-console/</link><description><![CDATA[<p>Ok, so this is a strange application, but I need to build a little exe that can be called from any scripting language (in this case Python) and can accept command line arguments and write its output to StdOut.  So far, I have accomplished all this using the standard <abbr title="LabVIEW">LV</abbr> properties for getting the command line args and using some kernel32.dll calls to write to the StdOut of the cmd.exe console window.</p>
<p>Where this breaks down is when calling a LabVIEW exe from the console, the console thread is not blocked while the exe runs.  So, the result is the console returns back the command prompt and then a little while later my exe sends the data to the console and it just appears where ever the cursor is currently at. <img src="https://lavag.org/uploads/emoticons/default_sad.png" alt=":("></p>
<p>So, I need to figure out a way for my exe to steal the thread of the console and block it until it is done writting its output.</p>
<p>Any gurus out there have a idea even where to start figuring this one out?  It has me baffled.  <img src="https://lavag.org/uploads/emoticons/default_frusty.gif" alt=":frusty:"></p>
<p>BTW: if you also have a .NET solution for writing to the stdout instead of the old school kernel32.dll solution, I would love to see it.</p>
<p>thanks for the help and/or sympathy.</p>
<p>-John</p>
<p>PS. If you are wondering why the *$@#$! anyone would want to do this, basically it comes down to the need for some non-LabVIEW DEVs to control some cFP hardware over Ethernet and the only way I know how to do this is using LOGOS via DataSockets and that only works in LabVIEW!</p>
]]></description><guid isPermaLink="false">11719</guid><pubDate>Fri, 08 Jan 2010 02:23:45 +0000</pubDate></item><item><title>Application requires manually specifying .NET dll location</title><link>https://lavag.org/topic/18992-application-requires-manually-specifying-net-dll-location/</link><description><![CDATA[<p>I am using MySQL .NET Connector with my LV2013 application which has been working fine for months. Today the new exe started requiring the user to pick the location of the MySQL dlls. Ironically, the dialog opens to the directory with the dlls in it. Currently, the dlls are in the /data directory. I have tried moving them into the same directory as the exe. I did see this <a href="http://forums.ni.com/t5/LabVIEW/dependency-to-NET-dll-has-to-be-resolved-manually-upon-start/m-p/3106199#M890041" rel="external nofollow">post</a>, but it didn't help. I haven't tried putting the dlls into the GAC because it wasn't entirely clear where in the GAC they would go, and in principal, having the dlls in the same directory path as the exe should be enough.</p>
<p> </p>
<p>It would appear this is something related to the OS because the exe works on the dev machine - just not the target.</p>
<p> </p>
<p>Any suggestions would be greatly appreciated.</p>
<p>Chris</p>
]]></description><guid isPermaLink="false">18992</guid><pubDate>Sat, 16 May 2015 15:12:08 +0000</pubDate></item><item><title>How to access controls/indicators from other apps without it displayed in LabVIEW?</title><link>https://lavag.org/topic/11629-how-to-access-controlsindicators-from-other-apps-without-it-displayed-in-labview/</link><description><![CDATA[<p>Hi, Guys,</p>
<p>In my project, I have to use other application which wasn't developed with LabVIEW.</p>
<p>My problem are:</p>
<p>1, How to set value to controls from its UI?</p>
<p>2, How to get data of its indicators?</p>
<p>3, How to simulate mouse actions, left-click and right-click?</p>
<p>4, Important, I'd like the UI is hidden.</p>
<p>Now I can do 1, 3 with its UI displayed, I can't do 2.</p>
<p>Someone recommended a tool named "autoit", but I have no idea about how to start it in LabVIEW.</p>
<p>Personally, I prefer to achieve my target with some windows dll or activX, etc.</p>
]]></description><guid isPermaLink="false">11629</guid><pubDate>Tue, 15 Dec 2009 12:31:47 +0000</pubDate></item><item><title>LibreOffice Array of Array</title><link>https://lavag.org/topic/20290-libreoffice-array-of-array/</link><description><![CDATA[<p>
	Hello, I am trying to copy multiple cells in LibreOffice, using the UNO API. I encountered an issue in the XCellRangeData object.
</p>

<p>
	The object's method returns an array of array of any() type. it seems <abbr title="LabVIEW">LV</abbr> can't compile this, even though the wire appears not to be broken. If I try to parse the array of array into a single dimension and then rebuild, the code is broken. See the attached files. Is there a solution for this issue? The alternative would be to copy cells one by one, which is a much slower solution.
</p>

<p><a href="https://lavag.org/uploads/monthly_2017_09/59b6ddb4e1f9f_Arrayofarraybrokencode.png.57eb832a6f4c45626d8ccd38319c0b29.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="12650" src="https://lavag.org/uploads/monthly_2017_09/59b6ddb5acea6_Arrayofarraybrokencode.thumb.png.6ee435936faf0b7ba4a28ff0df84abc0.png" class="ipsImage ipsImage_thumbnailed" alt="Array of array broken code.png"></a></p>
<p><a href="https://lavag.org/uploads/monthly_2017_09/59b6ddb6f2ab1_Arrayofarraycannotcompile.png.f80a2a5a03830d292f2a182747827e5a.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="12651" src="https://lavag.org/uploads/monthly_2017_09/59b6ddb79f517_Arrayofarraycannotcompile.thumb.png.4153498b32b2af43a40e57ca8e0d267a.png" class="ipsImage ipsImage_thumbnailed" alt="Array of array cannot compile.png"></a></p>]]></description><guid isPermaLink="false">20290</guid><pubDate>Mon, 11 Sep 2017 19:02:54 +0000</pubDate></item><item><title>CINTOOLS for ARM exists? Resize String in c++</title><link>https://lavag.org/topic/20178-cintools-for-arm-exists-resize-string-in-c/</link><description><![CDATA[<p>
	Hello!<br><br>
	I'd like to resize LStrHandle string in a C++ based DLL ... which is perfectly working on desktop Windows (ex.:Win7 32/64 bit) platform by include "extcode.h"  and linking "labviewv.lib", with calling "NumericArrayResize" function.
</p>

<p>
	BUT I'd like to do the same on Windows Embedded Compact 7.0 with ARM(Cortex-A8).
</p>

<p>
	When I build the DLL project on "Smart device / WindowsCE" platform it compiled successfully but the linker stopped because "NumericArrayResize" is unresolved symbol ... I think the reason is that the "labviewv.lib" generated for x86 architecture not for ARM.<br><br>
	So my question is: Is there any libviewv.lib for ARM platform?
</p>
]]></description><guid isPermaLink="false">20178</guid><pubDate>Tue, 27 Jun 2017 17:12:32 +0000</pubDate></item><item><title>MuParser</title><link>https://lavag.org/topic/19895-muparser/</link><description><![CDATA[<p>
	Has anyone taken a crack at calling MuParser or MuParserSSE from LabVIEW?
</p>

<p>
	<a href="http://beltoforion.de/article.php?a=muparser&amp;p=interface" rel="external nofollow">http://beltoforion.de/article.php?a=muparser&amp;p=interface</a>
</p>
]]></description><guid isPermaLink="false">19895</guid><pubDate>Fri, 18 Nov 2016 17:07:15 +0000</pubDate></item><item><title>DLL with Bundle input crashes</title><link>https://lavag.org/topic/20093-dll-with-bundle-input-crashes/</link><description><![CDATA[<p>
	The task is to process a bundle by a DLL embedded in LABVIEW. LABVIEW crashes even if the coded is most simple.
</p>

<p>
	For example, I created an array of double, bundled it and plugged it into the DLL.  The parameters of the DLL are "<u>Adapt to Type</u>". The prototype in Labview is "<u>void  pointertest(void *source);</u>"
</p>

<p>
	<strong>The C program:</strong>
</p>

<p>
	// dllmain.cpp : Defines the entry point for the DLL application.<br>
	#include "stdafx.h"<br>
	#include &lt;stdio.h&gt;<br>
	#include &lt;stdlib.h&gt;<br>
	#include "Header.h"
</p>

<p>
	<br>
	extern "C" __declspec(dllexport)void pointertest(LVCluster *source);
</p>

<p>
	BOOL APIENTRY DllMain( HMODULE hModule,<br>
	                       DWORD  ul_reason_for_call,<br>
	                       LPVOID lpReserved<br>
	                     )<br>
	{<br>
	    switch (ul_reason_for_call)<br>
	    {<br>
	    case DLL_PROCESS_ATTACH:<br>
	    case DLL_THREAD_ATTACH:<br>
	    case DLL_THREAD_DETACH:<br>
	    case DLL_PROCESS_DETACH:<br>
	        break;<br>
	    }<br>
	    return TRUE;<br>
	}<br>
	void pointertest(LVCluster *source) {<br>
	    source-&gt;dimSize = 2;<br>
	    source-&gt;arg[0] = 3.1;<br>
	    source-&gt;arg[1] = 4.2;<br>
	}
</p>

<p>
	 <strong>The header: Header.h</strong>
</p>

<p>
	#pragma pack(push,1)<br>
	typedef struct {<br>
	    __int64 dimSize;<br>
	    double arg[2];<br>
	}LVCluster;<br>
	#pragma pack(pop)
</p>

<p>
	The LABVIEW VI is attached.  I checked the foren. However, I cannot figure out what I did wrong. Please give me a hint.
</p>

<p>
	Your support is highly appreciated.
</p>

<p><a class="ipsAttachLink" href="//lavag.org/applications/core/interface/file/attachment.php?id=12245">pointertest.vi</a></p>]]></description><guid isPermaLink="false">20093</guid><pubDate>Thu, 06 Apr 2017 16:25:58 +0000</pubDate></item><item><title>Does anyone know how to generate a user event from Python code?</title><link>https://lavag.org/topic/19943-does-anyone-know-how-to-generate-a-user-event-from-python-code/</link><description><![CDATA[<p>
	The title asks the question.
</p>]]></description><guid isPermaLink="false">19943</guid><pubDate>Thu, 05 Jan 2017 20:10:24 +0000</pubDate></item><item><title>Should I use LabPython?</title><link>https://lavag.org/topic/19931-should-i-use-labpython/</link><description><![CDATA[<p>
	Hello there:
</p>

<p>
	I have a big project, pretty much already coded in Labview, designed to perform monte-carlo analysis on a set of applications that use data from time synchronized measurements across the electrical power system.
</p>

<p>
	The project is designed to be open source and distributable using both built .exe and vipm.  Therefore I include ONLY libraries that either come with <abbr title="LabVIEW">LV</abbr> or are OpenG (no third party tools that need to be purchased, and no TestStand).
</p>

<p>
	A part I have yet to code is the monte-carlo engine which needs to be end-user programmable.  I have an idea for creating my own set of commands and a labview interpreter, but before I do that, I'm thinking that many of my end users will already have some python ability.  So I'm trying to decide to use labPython.  The problem is that I have not found any documentation or examples for it yet.
</p>

<p>
	What I need to do, is have the python script, written by the user, access controls (mainly clusters or 2-D tables), overwrite the <abbr title="LabVIEW">LV</abbr> control values, then start a test run.  This is essentially test automation.  Python would be nice because then the user can use local variables to calculate the values to be written into the controls.
</p>

<p>
	So I'm looking for your advice:  Should I give LabPython a try?  If so can someone:
</p>

<p>
	1) point me to some documentation
</p>

<p>
	2) point me to some example code (especially how to access controls).  
</p>

<p>
	3) tell me where to go when I need to ask for help (this forum or another)
</p>

<p>
	Thank you so much.
</p>
]]></description><guid isPermaLink="false">19931</guid><pubDate>Sat, 17 Dec 2016 21:58:06 +0000</pubDate></item><item><title>Call Library Function Node fails on target</title><link>https://lavag.org/topic/19907-call-library-function-node-fails-on-target/</link><description><![CDATA[<p>
	Good morning. I'm new of labview and I would like to call C++ code from VI for my application.
</p>

<p>
	I did a
</p>

<ol><li>
		C++ project,
	</li>
	<li>
		generate DLL
	</li>
	<li>
		and I call it from VI.
	</li>
</ol><p>
	It's working on my pc but if I make an application for another pc, the application works but the dll is not working. I installed the c++ redistributable on second pc but I had the same problem.
</p>

<p>
	in particular a message error with "error 42" appears. Can you suggest me some check to fix it ?
</p>

<p>
	thank you very much for your collaboration
</p>
]]></description><guid isPermaLink="false">19907</guid><pubDate>Thu, 01 Dec 2016 12:55:34 +0000</pubDate></item><item><title>Callin a mixed mode (c#,managed c++) dll in Labview</title><link>https://lavag.org/topic/19816-callin-a-mixed-mode-cmanaged-c-dll-in-labview/</link><description><![CDATA[<p>
	I am working on implementing Labview to a Data Distribution Service (DDS) API  which will be later used in conjunction with TestStand. I have a few  dll files which was written in c# and managed c++.  When I tried calling the dll files in LabView, the methods seemed to be missing.
</p>

<p>
	On the other hand I wrote a simple c# code and I am able to call the dlls with the respective methods. I believe it is the third party unmanaged c++ which is causing the problems. Do I need a dll wrapper for this to work?
</p>
]]></description><guid isPermaLink="false">19816</guid><pubDate>Thu, 15 Sep 2016 07:49:44 +0000</pubDate></item><item><title>Re-using the command line interface</title><link>https://lavag.org/topic/15198-re-using-the-command-line-interface/</link><description><![CDATA[<p>I have an app that needs to communicate via the CMD, I think that every call into the CMD is causing quite some overhead. Does anybody know how I can keep a CMD reference open and execute commands in it, and read the output?</p>
<p>Ton</p>
]]></description><guid isPermaLink="false">15198</guid><pubDate>Mon, 14 Nov 2011 19:37:09 +0000</pubDate></item><item><title>Write table to Excel using .NET</title><link>https://lavag.org/topic/19644-write-table-to-excel-using-net/</link><description><![CDATA[<p>
	Now that it looks like Microsoft deprecated ActveX Automation interface in Excel 2016, the only other interface left is .NET interop assemblies. I have tried to reproduce Excel - Write Table.vi using .NET instead of ActiveX. The result of the effort is attached. There is a big problem though: The Range.value2 property could take 'anything' without a problem when using ActiveX (it was taking any variant)! But now it wants a .NET object. And the 'To .NET Object.vi' doesn't accept a 2D array of variants! So, say getting a recordset from a database (which is returned as a 2d array of variants) and then writing it, as it is, to a new Excel workbook is no longer possible as far as I understand. This is really sad. A 2D Table of strings or doubles is still OK. So, if you need to use those, you can with the attached code
</p>
<p><a class="ipsAttachLink" href="//lavag.org/applications/core/interface/file/attachment.php?id=11312">Write Table to Excel with DotNET.vi</a></p>]]></description><guid isPermaLink="false">19644</guid><pubDate>Fri, 10 Jun 2016 04:34:20 +0000</pubDate></item><item><title>create CVI DLL to be called in LUA</title><link>https://lavag.org/topic/19578-create-cvi-dll-to-be-called-in-lua/</link><description><![CDATA[<div style="color:rgb(51,51,51);font-family:Arial;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:15px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	<div>
		Hello everyone,
	</div>
</div>

<div style="margin:0px 0px 10px;color:rgb(51,51,51);font-family:Arial;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:15px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);">
	<div style="margin:0px 0px 10px;">
		<p style="margin:0px;padding:0px;">
			 
		</p>

		<p style="margin:0px;padding:0px;">
			I am a LabVIEW user and new to LabWindows. Currently, I have to plan a project which needs to integrate software in different languages. The situation is that I have one LabVIEW vi needs to be integrated into a HMI which is written in LUA. I am now thinking is it feasible to first convert LabVIEW vi or project first into CVI DLL and than call it in LUA. Does anyone have some experince/ advices about it? I found it is possible to using LUA in LabVIEW with LuaView. How about the other way round?
		</p>

		<p style="margin:0px;padding:0px;">
			 
		</p>

		<p style="margin:0px;padding:0px;">
			Any pointer will be highly appricated.
		</p>

		<p style="margin:0px;padding:0px;">
			 
		</p>

		<p style="margin:0px;padding:0px;">
			Cheers,
		</p>

		<p style="margin:0px;padding:0px;">
			sparkle
		</p>
	</div>
</div>
]]></description><guid isPermaLink="false">19578</guid><pubDate>Mon, 25 Apr 2016 14:53:40 +0000</pubDate></item><item><title>Reading _stdout from a .dll</title><link>https://lavag.org/topic/19529-reading-_stdout-from-a-dll/</link><description><![CDATA[<p>Hi,</p>
<p>   I have a .dll running in LabVIEW, the developer of the .dll is writing all of the data to the standard output (_stdout). I need to be able to read this output with LabVIEW.</p>
<p>I have already been pointed to an old post in the NI Forums:</p>
<p><span style="color:#1f497d;"><span style="font-family:calibri, sans-serif;"><span style="font-size:11pt;"><a href="http://forums.ni.com/t5/LabVIEW/Redirecting-stdout-stderr-stdin-to-from-LabVIEW-in-dlls/td-p/1768662" rel="external nofollow">http://forums.ni.com/t5/LabVIEW/Redirecting-stdout-stderr-stdin-to-from-LabVIEW-in-dlls/td-p/1768662</a></span></span></span></p>
<p> </p>
<p><span style="color:#1f497d;"><span style="font-family:calibri, sans-serif;"><span style="font-size:11pt;">This post is old, and the solution does not work in anything about LabVIEW 2012 (and I need it to work in 2015)</span></span></span></p>
<p> </p>
<p><span style="color:#1f497d;"><span style="font-family:calibri, sans-serif;"><span style="font-size:11pt;">Does anyone know how to display/read the _stdout from a .dll in LabVIEW.</span></span></span></p>
<p> </p>
<p><span style="color:#1f497d;"><span style="font-family:calibri, sans-serif;"><span style="font-size:11pt;">Cheers, Alec</span></span></span></p>
]]></description><guid isPermaLink="false">19529</guid><pubDate>Mon, 21 Mar 2016 10:48:33 +0000</pubDate></item><item><title><![CDATA[Script working in Python 2.5 and 2.7 doens&#39;t when called with labpython]]></title><link>https://lavag.org/topic/19506-script-working-in-python-25-and-27-doenst-when-called-with-labpython/</link><description><![CDATA[<p>Hi All,</p>
<p>I'm trying to get some script running in labpython.</p>
<p>the code is the follwing</p>
<p> </p>
<p>=====================</p>
<div>import socket</div>
<div> </div>
<div>class tcpalinks :</div>
<div>    </div>
<div>    def __init__(self) :</div>
<div>        self.linkslist={}</div>
<div>        print("TCPALINK Init")</div>
<div> </div>
<div>    def gettcpalink(self, visatring = ""):</div>
<div>        if visatring not in self.linkslist :</div>
<div>            sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)</div>
<div>            sock.connect((visatring.split("::")[1],int(visatring.split("::")[2])))</div>
<div>            print("build connection: %s"%(visatring))</div>
<div>            self.linkslist[visatring] = sock</div>
<div>            </div>
<div>        else : </div>
<div>            print("connection already exist %s"%(visatring))</div>
<div>        return self.linkslist[visatring]</div>
<div> </div>
<div> </div>
<div>    def tcpalinkcloseall(self) :</div>
<div>        for sockname in self.linkslist :</div>
<div>            self.linkslist[sockname].close()</div>
<div> </div>
<div>class tcpalink :</div>
<div> </div>
<div>      def __init__(self,sock) :</div>
<div>            self.currentsock=sock</div>
<div>          </div>
<div>      def tcpaquery(self, message) :</div>
<div>           self.currentsock.send(message+'''\r\n''')</div>
<div>           reply=self.currentsock.recv(1024)</div>
<div>           return reply</div>
<div>    </div>
<div>                </div>
<div> </div>
<div> </div>
<div> </div>
<div>listoflinks = tcpalinks()</div>
<div> </div>
<div>currentlink = tcpalink(listoflinks.gettcpalink("TCPIP0::127.0.0.1::41000::SOCKET"))</div>
<div> </div>
<div>currentlink.tcpaquery("stop 1")</div>
<div>listoflinks.tcpalinkcloseall()</div>
<div> </div>
<div> </div>
<p>=====================</p>
<p> </p>
<p>The code works perfectly when called from python25.exe or 27 but when called through the Labpython interface fails claining "socket" is not defined.</p>
<p>I'm pretty sure the instruction is sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) but I can't understand why.</p>
<p> </p>
<p> </p>
<p>===================</p>
<div>Error 1050 occurred at PYTHON Execute Script__ogtk.vi-&gt;PYTHON sandbox.vi:&lt;type 'exceptions.NameError'&gt;, global name 'socket' is not defined</div>
<div> </div>
<div>Possible reason(s):</div>
<div> </div>
<div>LabVIEW:  Error occurred while executing script.</div>
<p>PYTHON Execute Script__ogtk.vi-&gt;PYTHON sandbox.vi:&lt;type 'exceptions.NameError'&gt;, global name 'socket' is not defined</p>
<p>===================</p>
<p> </p>
<p>Any suggestion would be more than welcome.</p>
<p>The same instruction works fine when called directly and not inside the tcpalinks tcpalinks.</p>
<p> </p>
<p>Best Regards</p>
<p>Filippo</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
]]></description><guid isPermaLink="false">19506</guid><pubDate>Wed, 09 Mar 2016 17:51:43 +0000</pubDate></item><item><title>LabVIEW and Python, especially numpy and scipy</title><link>https://lavag.org/topic/19472-labview-and-python-especially-numpy-and-scipy/</link><description><![CDATA[<p>I'm trying to work with Python run under LabView, and I feel I'm failing miserably.</p>
<p> </p>
<p>I have a fresh instalation of LV2015sp1 32 bit, on top of that I've installed the OpenG Toolkit 4.0 and LabPython 4.0.0.4. I have Python 2.7 (Anaconda2 2.5.0) installed as well.</p>
<p> </p>
<p>Everything seems to be fine, as long as I use some simple script, but when I try to use a script involving e.g. numpy then the whole thing freezes at execute_script.vi</p>
<p> </p>
<p>What I might be doing wrong?</p>
]]></description><guid isPermaLink="false">19472</guid><pubDate>Wed, 17 Feb 2016 13:17:05 +0000</pubDate></item><item><title>LabPython Newbie Help!</title><link>https://lavag.org/topic/7195-labpython-newbie-help/</link><description><![CDATA[<p>Hi all,</p>
<p>Title says it all. I'm a newbie to Python (and thus to Labpython) although not to LabVIEW. I've got a friend who is a Python genius but a newbie to LabVIEW. He's written me an algorithm in Python that i want to run in Labpython before trying to check it out before implementing it in LabVIEW (or i may just leave it in Python). Problem is we keep on getting errors and between us have no idea what is wrong. I cannot find any documentation on Labpython or examples (except for one <a href="http://www.openg.org/tiki/tiki-index.php?page=EXAMPLE%20-%20Python%20Client%20to%20LabVIEW%20Server" rel="external nofollow">here</a>).</p>
<p>What i need is a bit of Python code (some advanced stuff would be great) that runs succesfully in Labpython so that my friend can take a look and see the format/style/method of writing python code for Labpython).</p>
<p>Could someone point me in the right direction either with a bit of code or some sort of documentation to help?</p>
<p>Thanks</p>
<p>Phil</p>
]]></description><guid isPermaLink="false">7195</guid><pubDate>Fri, 07 Mar 2008 16:28:24 +0000</pubDate></item><item><title>launch windows login credential dialog with winAPI</title><link>https://lavag.org/topic/19423-launch-windows-login-credential-dialog-with-winapi/</link><description><![CDATA[<p>I'm working on a login/privilege escalation feature that uses domain user/PW and got LDAP authentication figured out, but I was hoping to avoid just using a labview string control for the password entry b/c of security (VI Server, unencrypted, etc). I am trying to call <strong>CredUIPromptForWindowsCredentials  </strong>and launch the native windows login dialog.  It is a function in the System32\credui.dll but I can't get the parameters right.  I keep getting a return value of A0(160) and no dialog.  I think it is the PCREDUI_INFO type screwing it up. It needs:</p>
<p> </p>
<p>DWORD WINAPI CredUIPromptForWindowsCredentials(<br>_In_opt_    PCREDUI_INFO pUiInfo,<br>_In_        DWORD        dwAuthError,<br>_Inout_     ULONG        *pulAuthPackage,<br>_In_opt_    LPCVOID      pvInAuthBuffer,<br>_In_        ULONG        ulInAuthBufferSize,<br>_Out_       LPVOID       *ppvOutAuthBuffer,<br>_Out_       ULONG        *pulOutAuthBufferSize,<br>_Inout_opt_ BOOL         *pfSave,<br>_In_        DWORD        dwFlags<br>);</p>
<p> </p>
<p>I've been told that Rolf would be able to solve this in 30 seconds.  Help me LAVA! You're my only hope!</p>
]]></description><guid isPermaLink="false">19423</guid><pubDate>Fri, 22 Jan 2016 16:43:34 +0000</pubDate></item><item><title>LDAP authentication</title><link>https://lavag.org/topic/18779-ldap-authentication/</link><description><![CDATA[<p>Hi!</p>
<p>   I need to authenticate users on my program relying on LDAP.</p>
<p>At the moment i use a .NET contructor that work but it takes 30 seconds to authenticate the user.<br><br>Is there any other way to do this?</p>
<p>Activex? dll? <br><br>Thank you!</p>
<p> </p>
<p>Attached you can find the snippet of the way i do now.</p>
<p> </p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_01_2015/post-1899-0-42837400-1422614971.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_01_2015/post-1899-0-42837400-1422614971_thumb.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=9910" class="ipsImage ipsImage_thumbnailed" alt="post-1899-0-42837400-1422614971_thumb.pn"></a></p>
]]></description><guid isPermaLink="false">18779</guid><pubDate>Fri, 30 Jan 2015 10:49:55 +0000</pubDate></item><item><title>CFLNs and exception handling</title><link>https://lavag.org/topic/19351-cflns-and-exception-handling/</link><description><![CDATA[<p>I am refactoring code that works as an interface between c++ exceptions and LabVIEW error cluster. So far I have something like this (compressed to an example)</p>
<pre class="ipsCode prettyprint">
typedef struct
{
	LVBoolean status;
	int32_t code;
	LStrHandle message;
} LVErrorCluster;

template&lt;typename Func&gt; int64_t ExceptionGuard_LVErr(Func&amp;&amp; guardfunc, LVErrorCluster *LVError)
{
	try
	{
		return guardfunc();
	}
	catch (WrpExcUser &amp;e)
	{
		return CopyErrorUS(e.whaterr(), e.what(), LVError);
	}
	return NOERROR;
}

//then use the guard like this in a LabVIEW CLFN call

int64_t ErrorTest(LVErrorCluster *lverr)
{
	return ExceptionGuard_LVErr([&amp;]
	{
		throw(WrpExcUser("Some funky user error", -6426429678568));
		return NOERROR;
	}, lverr);
}
</pre>
<p>But my code doesn't catch just the WrpExcUser exception, but also generic stuff like std::bad_alloc, std::bad_function_call that can occur within the guarded section of code and makes them into some user friendly messages instead of the standard "exception occured -1xxx message". Is it legal to catch these exceptions? I wanted to keep my CLFNs error checking to default.</p>
]]></description><guid isPermaLink="false">19351</guid><pubDate>Wed, 25 Nov 2015 19:03:45 +0000</pubDate></item><item><title>Nested DLLs</title><link>https://lavag.org/topic/19340-nested-dlls/</link><description><![CDATA[<p>I need to implement a certain comms protocol into some software I will be creating. This has been provided for me as a DLL. The problem is that the DLL uses callbacks for the message processing functions, which I cannot easily do from LabVIEW. So my idea was to create a small wrapper DLL which implements the callback functions but sends the data to LabVIEW using PostLVEvent.  I will have DLL_A  (supplied by my customer), and DLL_A_Wrapper (created by me)</p>
<p> </p>
<p>Now, something I do not know, can I call DLL_A functions directly from within LabVIEW or do I need to wrap all the DLL_A functions as well?</p>
<p> </p>
<p>I suppose my question is more like, when LabVIEW loads my wrapper DLL, do two copies of DLL_A exist in memory?</p>
]]></description><guid isPermaLink="false">19340</guid><pubDate>Tue, 17 Nov 2015 10:52:42 +0000</pubDate></item><item><title>Setting menubar colour</title><link>https://lavag.org/topic/19257-setting-menubar-colour/</link><description><![CDATA[<p>Hi All,</p>
<p> </p>
<p>Does anybody know how to set the menubar colour in an application? I have done some digging and it seems this is possible using the windows API, just wondering if LabVIEW had some way to do this natively? (I doubt it, just thought I would ask).</p>
]]></description><guid isPermaLink="false">19257</guid><pubDate>Mon, 05 Oct 2015 14:01:41 +0000</pubDate></item><item><title>LabVIEW VI and C callback</title><link>https://lavag.org/topic/19251-labview-vi-and-c-callback/</link><description><![CDATA[<p>Hello,</p>
<p> </p>
<p>I am trying to figure out, if it is possible to create a native LabVIEW I/O interface to C/C++ code, that is using the I/O functions through callbacks.</p>
<p> </p>
<p>The scenario is as follows:</p>
<p> </p>
<p>I made a toolkit to process multimedia formats and (so far only) video codecs, it is using internally FFmpeg shared objects (DLLs or SOs, further just "DLLs").</p>
<p> </p>
<p>They way the FFmpeg DLLs access I/O is through callback mechanism. Following all happens in the wrapper.</p>
<p>If I want the toolkit to read data from some I/O like network or disk, I have to create a session, and part of the session are function pointers to callbacks doing various tasks, one of them is reading data.</p>
<p> </p>
<p>Anytime a user tries to read more data (1 data packet), he forces a call to the session demuxer, that further uses the I/O callback so long, until it parses one packet/hits EOF/corrupt data/etc..., now this works nicely if you want to provide data through standard means like video file or stream URL.</p>
<p> </p>
<p>Since the capabilities of FFmpeg allow for example (de)muxers and codecs for images, I thought it would be cool to give the user possibility to supply his own data, that he reads via LabVIEW from database or whatever. Not just limit the usage of I/Os implemented inside the DLLs.</p>
<p> </p>
<p>All I know, is that I cannot use VIs as callbacks inside C/C++ code, so the only way is to somehow "decallback" the implemented I/O mechanism. </p>
]]></description><guid isPermaLink="false">19251</guid><pubDate>Wed, 30 Sep 2015 17:05:04 +0000</pubDate></item><item><title>Matlab script and MathScript</title><link>https://lavag.org/topic/19235-matlab-script-and-mathscript/</link><description><![CDATA[<p>Dear all,</p>
<p> </p>
<p>My company is starting a project where some Matlab files (.m) need to be executed by LabVIEW. The 2 obvious solutions are Matlab script nodes and MathScript nodes. Unfortunately, even though the latter one is the most cost-effective and light in terms of installation, many of the functions we need are not supported by the Run Time Engine, so it's kind of a deal breaker.</p>
<p> </p>
<p>For the Matlab script nodes, I know Matlab needs to be installed since LabVIEW will request Matlab to execute the scripts through ActiveX. What I don't know is: what version of Matlab? Is there a cheaper "Run Time Engine" of Matlab we can use instead of buying the full-blown developement version of Matlab?</p>
<p> </p>
<p>Any other comment, remark, suggestion, alternatives?</p>
<p> </p>
<p>Thanks!</p>
]]></description><guid isPermaLink="false">19235</guid><pubDate>Mon, 21 Sep 2015 20:13:07 +0000</pubDate></item><item><title>Passing array of string to C dll</title><link>https://lavag.org/topic/14642-passing-array-of-string-to-c-dll/</link><description><![CDATA[<p>Hi all,</p>
<p>I have to call the following function that is part of a C dll:</p>
<p><span style="font-family:'Times New Roman';">icon_regfilt_createRegistrationFilter </span><span style="font-family:'Times New Roman';">(</span><span style="font-family:'Times New Roman';">const char * </span><span style="font-family:'Times New Roman';"><em>extractComponent</em></span><span style="font-family:'Times New Roman';">, </span><span style="font-family:'Times New Roman';">const char ** </span><span style="font-family:'Times New Roman';"><em>extractSubcomponent</em></span><span style="font-family:'Times New Roman';">, </span><span style="font-family:'Times New Roman';">const float * </span><span style="font-family:'Times New Roman';"><em>shifts</em></span><span style="font-family:'Times New Roman';">, </span><span style="font-family:'Times New Roman';">unsigned int </span><span style="font-family:'Times New Roman';"><em>nSubcomponents</em></span><span style="font-family:'Times New Roman';">, </span><span style="font-family:'Times New Roman';">enum </span><span style="font-family:'Times New Roman';">regfilt_interpolation_method_t</span> <span style="font-family:'Times New Roman';"><em>method</em></span><span style="font-family:'Times New Roman';">, </span><span style="font-family:'Times New Roman';">BOOL </span><em><span style="font-family:'Times New Roman';">copySubComponents</span></em><span style="font-family:'Times New Roman';">)</span></p>
<p>How can I pass the extractSubcomponent parameter, that is an array of strings (char**)?</p>
<p>In C it is quite simple, this is how the function is used:</p>
<p>char * registrationDataFormat;</p>
<p>      char* extractionDataFormat;</p>
<p>      const char* subComponents[3] = {"Red", "Green", "Blue"};</p>
<p>      float shifts[3] = {0.0f, 0.0f, 0.0f};</p>
<p>// Create a registration filter for the component named Color 1</p>
<p>      registrationFilter = icon_regfilt_createRegistrationFilter("Color 1", subComponents, shifts, 3, NN, FALSE);</p>
<p><span style="font-family:Arial;">In LabVIEW I tried a few:</span></p>
<p><span style="font-family:Arial;">- create the array of strings in </span><abbr title="LabVIEW"><span style="font-family:Arial;">LV</span></abbr><span style="font-family:Arial;"> and pass it directly to the call library node declaring it as "Adapt to type" and "Handle by value"</span></p>
<p><span style="font-family:Arial;">- create the array of strings in </span><abbr title="LabVIEW"><span style="font-family:Arial;">LV</span></abbr><span style="font-family:Arial;"> and pass it directly to the call library node declaring it as "Adapt to type" and "Pointer to handles"</span></p>
<p><span style="font-family:Arial;">- converting in </span><abbr title="LabVIEW"><span style="font-family:Arial;">LV</span></abbr><span style="font-family:Arial;"> the array of strings to a 2D array of numbers and passing this to the Call library function node (but I can't change the function in order to pass the array sizes)</span></p>
<p><span style="font-family:Arial;">but the problem is that in </span><abbr title="LabVIEW"><span style="font-family:Arial;">LV</span></abbr><span style="font-family:Arial;"> 8.5 it always crashes and in </span><abbr title="LabVIEW"><span style="font-family:Arial;">LV</span></abbr><span style="font-family:Arial;"> 2010 the function runs and returns a pointer as it is expected, without any error, but actually it doesn't create the memory structure that should create.</span></p>
<p><span style="font-family:Arial;">Have you ever passed an array of strings to a dll? How can I do this?</span></p>
<p><span style="font-family:Arial;">Thank you very much for your help!</span></p>
]]></description><guid isPermaLink="false">14642</guid><pubDate>Fri, 29 Jul 2011 09:08:50 +0000</pubDate></item><item><title>Android APK Instrumentation</title><link>https://lavag.org/topic/19217-android-apk-instrumentation/</link><description><![CDATA[<p>Curious to know if anyone has created a way for LabVIEW or TestStand to interact with a Instrumented Android APK file or 'App'.  The Standard Android Development environment includes tools like Robotium or Monkeyrunner which are great if you are using Java or Python.  In my case we already have LabVIEW in place for testing the embedded HW and subsystems but would like automated Android UI interaction as well.</p>]]></description><guid isPermaLink="false">19217</guid><pubDate>Wed, 09 Sep 2015 13:09:16 +0000</pubDate></item><item><title>Trying to target both 32 and 64 bit code</title><link>https://lavag.org/topic/19190-trying-to-target-both-32-and-64-bit-code/</link><description><![CDATA[<p>Hello,</p>
<p> I wrote an application which can use either a 32 bit or a 64 bit dll, it loads the dll from a path specified in an INI file. This code works properly on the development machine (LV2013, both 32 and 64 bit, both with a debugger and as an EXE) but doesn't work on the tester machine as an executable. It throws error code 13 (in LV2013 - file is not a resource, in LV2014 - Failed to load DLL due to invalid format or missing dependencies). </p>
<p>However, when I change all the Invoke nodes to use a static predefined path, everything is OK.</p>
<p>What am I doing wrong here? I rather maintain one code base and build for each target than maintain a code for each target.</p>
<p> </p>
<p>The API dll is from signalhound.com <a href="http://signalhound.com/spike" rel="external nofollow">http://signalhound.com/spike</a></p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_08_2015/post-46572-0-18482600-1440600902.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_08_2015/post-46572-0-18482600-1440600902.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=10633" class="ipsImage ipsImage_thumbnailed" alt="post-46572-0-18482600-1440600902.png"></a></p>
]]></description><guid isPermaLink="false">19190</guid><pubDate>Wed, 26 Aug 2015 15:01:48 +0000</pubDate></item><item><title>Setting up NLog filtering in LabVIEW</title><link>https://lavag.org/topic/19191-setting-up-nlog-filtering-in-labview/</link><description><![CDATA[<p>I've got a working event logger that uses NLog.dll in LabVIEW. It does 95% of what I would like it to do, but I wanted to implement adding programmatic filtering. To filter a log event, you need to first create a rule (which works fine in LabVIEW), and than add a condition to it's list of Filters. The API reference for the ConditionExpression is here;</p>
<p> </p>
<p><a href="http://nlog-project.org/documentation/v4.0.0/html/T_NLog_Conditions_ConditionExpression.htm" rel="external nofollow">http://nlog-project.org/documentation/v4.0.0/html/T_NLog_Conditions_ConditionExpression.htm</a></p>
<p> </p>
<p>There's an Operator that will convert a string to the Condition object that I need as an input to the ConditionExpression. But, since you can't call that in LabVIEW, anyone have any ideas on how to get around that? I suppose I could write a quick .dll myself that inputs a string and outputs the appropriate Condition object. Just didn't want to go down the path if I didn't have to.</p>
<p> </p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_08_2015/post-53468-0-19404400-1440634628.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_08_2015/post-53468-0-19404400-1440634628.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=10634" class="ipsImage ipsImage_thumbnailed" alt="post-53468-0-19404400-1440634628.png"></a></p>
]]></description><guid isPermaLink="false">19191</guid><pubDate>Thu, 27 Aug 2015 00:18:05 +0000</pubDate></item><item><title>Call library function node and .dylib</title><link>https://lavag.org/topic/9051-call-library-function-node-and-dylib/</link><description><![CDATA[<p>Dear Lava users</p>
<p>(im sorry if this post is more a c/c++ code porting problem than a actual labview problem, but... <img src="https://lavag.org/uploads/emoticons/default_smile.png" alt=":)"> )</p>
<p>I just bought myself a brand new apple Mac book Pro, 15" with OS X Leopard (10.5.X i think?) installed.</p>
<p>After playing around and familiarizing my self with mac, OS X and its unix like environment, i decided to port some of my labview code wrappers that we use at work to interface with various things, previously compiled for both windows in visual studio 6 and 8 and linux red hat 4 and 5. (gcc 3.4.2 and gcc 4.1.2 i beleive, but not 100% sure).</p>
<p>So i did some reading, and it seemed that on mac a ".dll" from windows and ".so" from unix/linux on OS X is called ".dylib". i installed the Xcode package, labview 8.6 for mac, and some other stuff that might come in handy.</p>
<p>After modifying my makefiles (basically replasing -shared with -dynamiclib and recompiling with gcc in the terminal) i tried to load the new "myFile.dylib" in labview.</p>
<p>Unfortunately labview didn't read any of my callbacks, and the dropdown list where you can choose function in the "call library node" was grayed out or empty.</p>
<p>so not knowing what whent wrong i made a small "cout" callback like this:</p>
<p>############# myCout.cpp #################</p>
<p>#include &lt;iostream&gt;</p>
<p>#define API __attribute__(( __cdecl__ ))</p>
<p>extern "C" void API Cout(char * myCout)</p>
<p>{</p>
<p>    std::cout &lt;&lt; myCout &lt;&lt; std::endl;</p>
<p>}</p>
<p>################ Makefile #################</p>
<p>CC = g++</p>
<p># Backup files from various editors ...</p>
<p>BAKS = ,* *~ *.bak *.BAK .es1* .B* %*% .ec1 .ek1 .*~ core a.out *JNL *.lst \\\#*\\\# .nfs* *%</p>
<p>#</p>
<p>CFLAGS = -g -c -I/usr/include -o $@</p>
<p>LDFLAGS =</p>
<p>OBJ = </p>
<p>LDLIBS =</p>
<p>#</p>
<p>all: cout.so</p>
<p>#</p>
<p>cout.so: cout.o</p>
<p>    @-$(RM) $@ $(W)$@</p>
<p>    $(CC) $^ $(LDLIBS) -o $@ -dynamiclib //only changed this on mac</p>
<p>#</p>
<p>cout.o: cout.cpp</p>
<p>    $(CC) $(CFLAGS) cout.cpp</p>
<p>#</p>
<p>clean:</p>
<p>    $(RM) *.o  $(BAKS)</p>
<p>making the .dylib went fine. no errors, and no warnings. but still I'm unable to load this library and use its function in LabVIEW.</p>
<p>What am i doing wrong??</p>
<p>Any help would be highly appreciated. </p>
<p>X</p>
<p>Update: I realized after some searching that i can't use "dylib" in mac, but have to use something called ".framework" (bear with me cos this is all new to me <img src="https://lavag.org/uploads/emoticons/default_smile.png" alt=":)">) so then i hoped all i had to do was replacing the "-dynamiclib" with "-framework" and name the output xxx.framwork, but now it won't compile <img src="https://lavag.org/uploads/emoticons/default_sad.png" alt=":("> (said something about "argument to -Xlinker missing" )</p>
<p>guess it's time for bed and try with some fresh eyes tomorrow.</p>
]]></description><guid isPermaLink="false">9051</guid><pubDate>Wed, 17 Dec 2008 21:08:24 +0000</pubDate></item><item><title>calling dll</title><link>https://lavag.org/topic/19043-calling-dll/</link><description><![CDATA[<p>I can't call the following dll function ....  </p>
<pre>int sqlite3_open(  const char *filename,   /* Database filename (UTF-8) */  sqlite3 **ppDb          /* OUT: SQLite db handle */);</pre>
]]></description><guid isPermaLink="false">19043</guid><pubDate>Thu, 18 Jun 2015 12:22:25 +0000</pubDate></item><item><title>Heap corruption</title><link>https://lavag.org/topic/19112-heap-corruption/</link><description><![CDATA[<p>Hello,</p>
<p> </p>
<p>I am passing some data from dll to labview. It is an array of clusters. Cluster looks like this:</p>
<pre class="ipsCode prettyprint">
typedef struct 
{
	LStrHandle longname;
	LStrHandle name;
	uint8_t intraonly;
	uint8_t lossless;
	uint8_t lossy;
} CodecInfo, **CodecInfoHdl;

typedef struct CodecInfoArr
{
	int32_t dimsize;
	CodecInfo Arr[1];
} CodecInfoArr, **CodecInfoArrHdl;
</pre>
<p>But I think it is reproducable with any kind of array of clusters where are other handles, like LStrHandle in my case.</p>
<p>The operation is pretty straightforward.</p>
<p>I check the incoming handle, I handle the situation where it is empty or filled with data and in the next step I have an empty handle to work with.</p>
<p>So far I have an array handle returned from DSNewHandle allocated for the resulting array size.</p>
<p>I start copying the data, but since there are strings involved, I call my general char2LStrHandle function to fill string handles.</p>
<pre class="ipsCode prettyprint">
void PrintChar2LVStrHandle(const char *charstr, LStrHandle *StrHandleP, bool forcenew = false)
{
	MgErr error = mgNoErr;
	std::string temp = "";
	if (charstr)
	{
		temp.assign(charstr);
	}
	if ((!IsHandleEmpty(StrHandleP)) &amp;&amp; !forcenew)
	{
		error = DSDisposeHandle(*StrHandleP);
		if (error != mgNoErr)
			throw(WrpExcUser("PrintChar2LVStrHandle()", error));
	}
	*StrHandleP = (LStrHandle)(DSNewHandle(Offset(LStr, str) + sizeof(uChar)));
	if (*StrHandleP == nullptr)
		throw(WrpExcUser("Could not allocate string handle", CUSTOMERROR));
	//(**StrHandleP)-&gt;cnt = 0;
	error = LStrPrintf(*StrHandleP, (CStr)"%s", temp.c_str());
	if (error != mgNoErr)
		throw(WrpExcUser("Could not print to string handle", error));
}
</pre>
<p>There is a lot of junk&amp;unnecesary code, but the core of the function is to check the handle, and if it is valid, just print into it. The function that checks the handle looks like this:</p>
<pre class="ipsCode prettyprint">
bool IsHandleEmpty(const LStrHandle *h)
{
	MgErr err, heaperr = mgNoErr;
	err = DSCheckHandle(*h);
	//heaperr = DSHeapCheck(0);

	if (err)
		return true;
	return false;
}
</pre>
<p>It is just a stupid wrapper around DSCheckHandle. </p>
<p> </p>
<p>Now the problem is, that with the way the array handle allocated the array elements, some handle pointers, from time to time point to memory so unfortunately, that the array elements that get processed later have string handle pointer pointing to memory that is already filled with data from previous array filling loop iterations. It is not the exactly same memory, since the data is little off (garbage, count is wrong etc.), but it is sufficient enough for the DSCheckHandle return, that the handle is valid. So the memory gets a treatment like it would be a real handle and it corrupts the labview heap, so when the data gets deallocated, LabView / runtime will crash.</p>
<p> </p>
<p>So far I tackled the solution with simple optional parameter (bool forcenew = false) and went through all the function references in code to set the flag if the data comes from new array handles.</p>
<p> </p>
<p>Finally the question: Is there more elegant solution to this, somehow correctly check the incoming string handle ?</p>
]]></description><guid isPermaLink="false">19112</guid><pubDate>Sat, 18 Jul 2015 20:31:14 +0000</pubDate></item><item><title>Using LabVIEW Clusters with .NET Invoke Nodes</title><link>https://lavag.org/topic/18943-using-labview-clusters-with-net-invoke-nodes/</link><description><![CDATA[<p>I was writing a long summary of what I was trying to do, when I realized it might be best to start off with a simple question:</p>
<p> </p>
<p>Is it possible to pass a LabVIEW cluster to/from a .NET invoke node?  </p>
<p> </p>
<p>I have complete control over both the .NET and <abbr title="LabVIEW">LV</abbr> code, but I have not been able to find a way to do this.</p>
]]></description><guid isPermaLink="false">18943</guid><pubDate>Mon, 20 Apr 2015 17:10:31 +0000</pubDate></item><item><title>Setting the timeout for a web service call using .NET</title><link>https://lavag.org/topic/18928-setting-the-timeout-for-a-web-service-call-using-net/</link><description><![CDATA[<div>I am calling a web service using system.net.webclient().  So far it is working fine but now I want to set the timeout to something other than the default.  Unfortunately, the timeout is not an exposed property for webclient().  From what I have read, webclient() is a child of the httpwebrequest() class, and that class has a timeout that can be set.  But httpwebrequest in system (2.0.0.0) has no public constructors. All the examples on the web show how to override the webrequest getter to set a different timeout.  Unfortunately this exceed my .net skills.  Does anyone know how to solve this in LabVIEW?</div>
<br><div> </div>
<br><div>Here is the C# example:</div>
<br><div><a href="http://stackoverflow.com/questions/1789627/how-to-change-the-timeout-on-a-net-webclient-object" rel="external nofollow">http://stackoverflow.com/questions/1789627/how-to-change-the-timeout-on-a-net-webclient-object</a></div>
<br><div> </div>
<br><div>NOTE: I am trying to solve this problem in LabVIEW 2011 so am stuck with .NET 2.0 for the system assembly.</div>
<br><div> </div>
<br><div>thanks,</div>
<br><div> </div>
<br><div>-John</div>
<br>]]></description><guid isPermaLink="false">18928</guid><pubDate>Thu, 09 Apr 2015 00:24:27 +0000</pubDate></item><item><title>Reading the string output of a DLL</title><link>https://lavag.org/topic/18917-reading-the-string-output-of-a-dll/</link><description><![CDATA[<p>Hi,</p>
<p> </p>
<p>I am writing a LabVIEW API based on a 3rd party DLL. The DLL function I am working on right now returns a string and 2 U32. The string is only an output, but the 2 U32 are used as both inputs and outputs. So long story short the 3 parameters are defined as pointers. The 2 U32 work as specified in the documentation, one of them (psize) returning the number of characters that the string is supposed to return.</p>
<p> </p>
<p>However I can't get the string properly. The documentation tells me that it is a C String and I configured the parameter as such, but when I run the function I get only the first character of what I'm supposed to get. The next test I made (see below) returns all the other characters except the first one and helped me understand why this first test returned only the first character: the string is Unicode! This means that each character (though able to be represented in ASCII) takes 2 bytes, one of them being the null character. And since a C string ends when the null character is encountered, this explain why LabVIEW only gives me the ASCII value of the first character.</p>
<p> </p>
<p>In the second test I'm talking about, I modified the parameter to be a Pascal String Pointer instead of C String Pointer. I got all the characters except the first one, which makes sense I guess since the first character is the length in a Pascal string.</p>
<p> </p>
<p>Basically so far I haven't managed to find a way to read the whole string in one call. I would love to find a solution where I just ask for an array of bytes and just perform my own parsing, but the DLL returns an Invalid Parameter error when I try it.</p>
<p> </p>
<p>Have you run into something similar? Do you have any tips?</p>
<p> </p>
<p>Help would be much appreciated!! (on top of this issue, LabVIEW crashed 50% of the time <img src="https://lavag.org/uploads/emoticons/default_throwpc.gif" alt=":throwpc:"> )</p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_03_2015/post-14511-0-88844600-1427763648.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_03_2015/post-14511-0-88844600-1427763648_thumb.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=10117" class="ipsImage ipsImage_thumbnailed" alt="post-14511-0-88844600-1427763648_thumb.p"></a></p>
]]></description><guid isPermaLink="false">18917</guid><pubDate>Tue, 31 Mar 2015 01:01:02 +0000</pubDate></item><item><title>LabPython Error</title><link>https://lavag.org/topic/18912-labpython-error/</link><description><![CDATA[<p>Greetings All - I had the unrealistic idea that I could use LabPython with Python 3.x</p>
<p>But unfortunately am getting this error straightaway when creating a new session...</p>
<p> </p>
<p><a class="ipsAttachLink ipsAttachLink_image" href="https://lavag.org/uploads/monthly_03_2015/post-162-0-13037200-1427680531.png" rel="external nofollow"><img src="https://lavag.org/uploads/monthly_03_2015/post-162-0-13037200-1427680531.png" data-fileid="%7B___base_url___%7D/applications/core/interface/file/attachment.php?id=10110" class="ipsImage ipsImage_thumbnailed" alt="post-162-0-13037200-1427680531.png"></a></p>
<p> </p>
<p>Is this a show stopper or is there some hope to work around this?</p>
]]></description><guid isPermaLink="false">18912</guid><pubDate>Mon, 30 Mar 2015 01:58:26 +0000</pubDate></item><item><title>PyByWire</title><link>https://lavag.org/topic/18915-pybywire/</link><description><![CDATA[<p>Has anyone tried this out yet?  </p>
<p> </p>
<p><a href="http://sourceforge.net/projects/pybywire/" rel="external nofollow">http://sourceforge.net/projects/pybywire/</a></p>
<p> </p>
<p>I gave it a go but without an example or docs could not really make heads or tails of its capabilities.  It has a good pedigree since it is written by the same person who developed the zmq libraries. </p>
]]></description><guid isPermaLink="false">18915</guid><pubDate>Mon, 30 Mar 2015 17:15:01 +0000</pubDate></item><item><title>How to call PostLVUserEvent() with a cluster of scalars from C++?</title><link>https://lavag.org/topic/15229-how-to-call-postlvuserevent-with-a-cluster-of-scalars-from-c/</link><description><![CDATA[<p>I'm working with a C++ programmer and trying to get some data into <abbr title="LabVIEW">LV</abbr>. We've looked at the examples for PostLVUserEvent() both on NI's site (<a href="http://zone.ni.com/devzone/cda/epd/p/id/1480" rel="external nofollow">here</a>) and on LAVA  and managed to get events in <abbr title="LabVIEW">LV</abbr>.</p>
<p>The problem is that the event data is a struct with a DWord and a few floats or doubles and for some reason when we try to create an equivalent <abbr title="LabVIEW">LV</abbr> cluster (a U32 and SGLs or DBLs) the first integer gets through fine, but the floating points values are completely meaningless.</p>
<p>We also did a quick test with a cluster with just three INTs and we still only get the value for the first one - the other two are always zero.</p>
<p>I don't have the code at the moment (and it's too messy anyway at the moment), but does anyone know what would be the correct C/C++ code to get the event reference from <abbr title="LabVIEW">LV</abbr> (although that part seems to work fine) and to send an event of a struct with a few scalars (preferably with doubles as well)?</p>
]]></description><guid isPermaLink="false">15229</guid><pubDate>Tue, 22 Nov 2011 18:15:16 +0000</pubDate></item><item><title>Iron Python Example</title><link>https://lavag.org/topic/18875-iron-python-example/</link><description><![CDATA[<p>Greetings - Does anyone have a working example of <abbr title="LabVIEW">LV</abbr> calling an IronPython script.  I have seen this old link</p>
<p> </p>
<p><a href="https://decibel.ni.com/content/docs/DOC-1133" rel="external nofollow">https://decibel.ni.com/content/docs/DOC-1133</a></p>
<p> </p>
<p>but it no longer compiles and it does not seem to correlate any longer with the current IronPython .net asembly.</p>
<p> </p>
<p> </p>
]]></description><guid isPermaLink="false">18875</guid><pubDate>Thu, 12 Mar 2015 15:56:26 +0000</pubDate></item><item><title>CONFIGURING WINDOWS SDK FUNTIONS IN LABVIEW</title><link>https://lavag.org/topic/9120-configuring-windows-sdk-funtions-in-labview/</link><description><![CDATA[<p>Hi all...HAPPY NEW YEAR.</p>
<p> I've been having alot of problems with calling SDK funtions. Is there any resources that clarifies the funtion parameters and how to configure them in labview.</p>
<p>found this link <a href="http://zone.ni.com/reference/en-XX/help/370051H-01/cvi/calling_windows_sdk_functions/" rel="external nofollow"><span style="color:#3366cc;"></span></a> These are the some of the dll's I need to call.</p>
<p>One of the things I'm tring to do is find USB devices. The first thing I need to do;</p>
<p>-call the SetupDiGetClassDevs which is in the setupapi,dll. see link <a href="http://msdn.microsoft.com/en-us/library/ms792959.aspx" rel="external nofollow"><span style="color:#3366cc;"></span></a></p>
<p><strong>SetupDiGetClassDevs</strong> returns a handle to a device information set that contains all installed devices that matched the supplied parameters.</p>
<p>Depending what I set for parameters i can get imformation on all devices connected to all ports.</p>
<p>My problem is don't know how the parameters are configured.</p>
<p><strong>HDEVINFO</strong></p>
<p>  <strong>SetupDiGetClassDevs(</strong></p>
<p>    <strong>IN LPGUID</strong>  <em>ClassGuid</em><strong>,  OPTIONAL   (how do I configure each of the parmteters in labview)</strong></p>
<p>    <strong>IN PCTSTR</strong>  <em>Enumerator</em><strong>,  OPTIONAL </strong></p>
<p>    <strong>IN HWND</strong>  <em>hwndParent</em><strong>,  OPTIONAL</strong></p>
<p>    <strong>IN DWORD</strong>  <em>Flags</em></p>
<p>    <strong>);</strong></p>
<p>There are more call I need to make ,but need to get this imformation first.  </p>
<p>Thanks</p>
<p></p>
]]></description><guid isPermaLink="false">9120</guid><pubDate>Fri, 02 Jan 2009 17:42:24 +0000</pubDate></item></channel></rss>
