LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CIN Confusion

So I've been struggling for a few days to create a program in c++ that I can interface to LabVIEW using a CIN.  I made the c++ program, but how do I make a .lsb file without visual studio?  I have the express version, and the instructions I found in the knowledge base don't cover the express version.  Furthermore, I don't know a thing about command line programming, so I'm stumped by the instruction "build a .lvm."  I figured out, I think, that I have to use the lvsbutil, but it wants me to put in a bunch of parameters that I can't even seem to guess at, and I can't find any help, instructions, or application notes for this utility.  I've sifted the forums, and read all the notes and instructions, but I feel they have huge holes in them, like the above "build a .lvm."  I have programmed in c++, and LabVIEW for years, but I never used visual studio, and I don't own a copy, which probably makes this difficult.  Can anybody give me a step by step way to get even one of the CIN examples that ships with LabVIEW to work without using visual studio?

Thanks,
Benjamin
0 Kudos
Message 1 of 8
(2,746 Views)
First you have to explain why you want to use a CIN. CIN's are concidered obsolete (although not officially). Dll's are much easier to work with.


Regards,


Wiebe.
0 Kudos
Message 2 of 8
(2,734 Views)
I don't have a good answer to that question.  I was having problems making a dll that didn't crash LabVIEW, so I thought maybe it would be easier to use a CIN.  What I'm doing is trying to use the createpolygonrgn from the windows API to make a nonstandard window shape, but one of the inputs is an array of type defined POINT structures that LabVIEW can't duplicate, so I thought I would use a CIN, or dll, or if you have a better idea, I'll use that too, so I can take in an array of clusters of two elements, or something similar, from LabVIEW that defines a polygon region, and transform it into an array of POINT structures that may be used to get a handle to a polygon region.

Thanks,
Benjamin
0 Kudos
Message 3 of 8
(2,719 Views)
A point structure is simply a bundle with two I32 or U32 (or maybe I16's) in LabVIEW . Structs are more or less the same as bundler/clusters, as long as there are no strings in it. You can also wire an array with two 32 bit numbers (or 8 8 bit numbers) or a flattended string, but you might have to swap bytes (little endian/big endian thing). The dll simply expects a pointer to two numbers right behind each other.


You'll have to put the input on "adapt to type". It also works when you put the clusters in an array. Then the dll expects a number of elements, and then the data.


Btw. There is already some code for this (, but I think it's password protected). Are you doing this as an excersise?


Regards,


Wiebe.
0 Kudos
Message 4 of 8
(2,707 Views)
OK, so here is the code I'm trying to execute.  I've tried changing the inputs and outputs to just about everything, and still whenever I run it, LabVIEW crashes.  It's not too complicated.  If anyone can tell me what I am doind wrong here, I'm pretty sure I can take it from here.

Thanks,
Benjamin
0 Kudos
Message 5 of 8
(2,694 Views)

Hi,

change the calling convention from C to stdcall

cosmin

0 Kudos
Message 6 of 8
(2,688 Views)
Alright, so I have it running.  I can't believe I forgot to change the calling convention.  Sometimes you just need another pair of eyes I guess.  Anyway, I can't seem to figure out how the dll is interpreting the clusters.  The shape of the window is not the shape that it should be base on the number I have in the array.  Does anyone know how this data is being interpreted?  And no, this isn't being done as an exercise, it's for one of my customers.

Thanks,
Benjamin
0 Kudos
Message 7 of 8
(2,657 Views)
Scratch that, the coordinates make perfect sense, I was just looking at them funny.  I'm having a slow week apparently.

Regards,
Benjamin
0 Kudos
Message 8 of 8
(2,653 Views)