LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Queue element form external code in LabView 6.1 ?

Hello,

is it in LabView 6.1 possible to insert a queue Element from external code?

If not, I found an example about Windows message queues, here they create a new Queue which can transfer data between external code and Labview.
But there is an limitation over the binary data to transfer. It should have always the same size, so I can't use that example with data which have an dynamical lenght like labview strings.
The problem here is that this example use the win32 queue method which have an template which need an fix c type. If i insert here the Labview sting type, it causes an memory failure "Memory is full" because the win32 queue method only allocates that number of bytes for the Labview string which ar
e counted in the definition. ( I think 5 bytes; 4 for the lenght and 1 for the string element).
Does anybody know how to manage that problem?
Or have somebody an idea to transfer data between an C-Thread an Labview with other metods?

Every help would be great.

Thanks a lot

Robert
0 Kudos
Message 1 of 3
(2,573 Views)
It is not possible to add and remove queue elements from external code. If I had a need to do this, I might just create a VI in my application to handle adding and removing queue elements and call it using ActiveX. Alternatively, if the external code is being called directly from LabIEW, you could just return values from the external code to LabVIEW and then insert them in the queue.

I haven't ever looked at the Windows Messaging example, but Windows Message Queues are usually for capturing things like mouse events and keybourd strikes. I'm not sure this is quite what you're looking for.

Maybe if we knew what type of application you were trying to write and what data you wanted to share, we could make other suggestions.
0 Kudos
Message 2 of 3
(2,573 Views)
Hello,
thank you for your answer. I think it's not possible to add and remove queue elements from external code with the Labview "standard queue", but i have an example dll which have all queue functions (create, insert, remove, flush,...) with the hole c code for win 32. There I'm able to access the functiuons (create, insert, remove,...) from Labview and from external code.
In the Windows Messaging example is used this feature. There is a Windows hook Function (callbackfunction) in the dll which capture the Windows message and send it to Labview code with a queue. ( Here is no function call to the dll necessary!) Here Labview is able to receive data from external code over a queueing method!
The only problem I have, is that this queue example can only handle data with fix size, for example cluster with some scalar values, or only integer values. But i have data with dynamic size; string data for example, which can have a size of 10 or 320 elements. Or an Labview Array wich have an dynamic lenght. with this to data types the example doesn't work, and I don't know how to change the code so that this data types are supported too.

When I asked this questen the first time,an Ni-Engineer anwered me, that it's not possible to insert queue elements from external code with labview 6.0.2 but the will add this feature in further versions.
Maybe in Labview 6.1 is it possible?

Note: it's different if I speak from the Labview standard queue, or an other queue like from the example which is included in the Windows Message example.

The example I have is following:
I have written an USB Device Driver for an USB Device, and want to communicate between that Driver and Labview. The data from the USB Device comes asyncronous, received from a seperate Thread in the dll. Now i have the problem to get the data into Labview. A Queue would be here the best solution I think. At the moment I only copy the data into Labview Variables (array) and set a notification where the labview application is waiting for.When the Thread in the dll will receive the data much faster than labview can get it (copy it out from the array variable) , the data will be lost. In a queue that will never appear.
So i want to use a queue functionality. I think that will solve my problem, or?
0 Kudos
Message 3 of 3
(2,573 Views)