LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Labview from VC++

I'm attempting to call Determinant.vi
(vi.lib\analysis\7linalg.ilb\Determinant.vi) from
Visual C++. I've actually gotten the
Determinant.vi to take a matrix that I pass it
from Visual C++ and return the determinant to me.
However, to get the determinant.vi to return an
answer to VC++, Labview has to be running, and
Determinant.vi has to be manually opened
from the Functions palette and placed on the block
diagram panel. Should determinant.vi have to be
opened before I can use it from VC++?


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 1 of 5
(4,336 Views)
bshumake@my-deja.com wrote in article <7qh3tk$uv7$1@nnrp1.deja.com>...
> I'm attempting to call Determinant.vi
> (vi.lib\analysis\7linalg.ilb\Determinant.vi) from
> Visual C++. I've actually gotten the
> Determinant.vi to take a matrix that I pass it
> from Visual C++ and return the determinant to me.
> However, to get the determinant.vi to return an
> answer to VC++, Labview has to be running, and
> Determinant.vi has to be manually opened
> from the Functions palette and placed on the block
> diagram panel. Should determinant.vi have to be
> opened before I can use it from VC++?

Yes LabVIEW has to be running. You can achieve this by opening
a reference to the LabVIEW active X Object. Windows then will start
the Active X server for that object, e.g LabVIEW.

Then using the appropriate LabVIEW Active X methods you can load
VIs if you know their absolute file path and afterwards you can call the
VI as you have discovered.
Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 5
(4,336 Views)
What I'm asking is does the vi that I'm using have to be manually opened
(using LabVIEW), and manually placed in a block diagram window (using
LabVIEW) in order to use its functionality from Visual C++? I would
think you could do all of this from VC++ without having to load the vi
using LabView. My program is designed to start LabView, open the
Determinant.vi and begin using it. My program does this, but I get an
exception from the GetVIReference call if I have not opened up LabView
and the VI that I want to use before running my VC++ program. If I open
LabView and the VI that I want to use before I run my VC++ program, then
everything works fine. Has anybody else had this problem?


In article <01bef468$934b14e0$e101010a@martigny>,
"Rolf Kalberma
tter" wrote:
> bshumake@my-deja.com wrote in article <7qh3tk$uv7$1@nnrp1.deja.com>...
> > I'm attempting to call Determinant.vi
> > (vi.lib\analysis\7linalg.ilb\Determinant.vi) from
> > Visual C++. I've actually gotten the
> > Determinant.vi to take a matrix that I pass it
> > from Visual C++ and return the determinant to me.
> > However, to get the determinant.vi to return an
> > answer to VC++, Labview has to be running, and
> > Determinant.vi has to be manually opened
> > from the Functions palette and placed on the block
> > diagram panel. Should determinant.vi have to be
> > opened before I can use it from VC++?
>
> Yes LabVIEW has to be running. You can achieve this by opening
> a reference to the LabVIEW active X Object. Windows then will start
> the Active X server for that object, e.g LabVIEW.
> Then using the appropriate LabVIEW Active X methods you can load
> VIs if you know their absolute file path and afterwards you can call
the
> VI as yo
u have discovered.
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 3 of 5
(4,336 Views)
Sorry for not being able to tell you exactly what you have to do but I have
used Active X only from inside of LabVIEW and someone still needs to
convince me that Active X is something more serious than just having a
few nice demos which work only sometimes. The hassle of distributing
an application which uses Active X seems overwhelming to me and
version conflicts are more common than not.

Do you have an Active X method like Open VI or something like this or
does GetVIReference allow for a complete path? Check out that the
path to the VI you want to open is correct. If you just define the name
LabVIEW won't be able to find the VI as the VI server in LabVIEW
does not search for VIs. It tries to find a VI with that name first in
memory and if i
t isn't there it tries to load a VI from the literal path
you specify. If both fail you get an error back.

bshumake@my-deja.com wrote in article <7qj86j$g81$1@nnrp1.deja.com>...
> What I'm asking is does the vi that I'm using have to be manually opened
> (using LabVIEW), and manually placed in a block diagram window (using
> LabVIEW) in order to use its functionality from Visual C++? I would
> think you could do all of this from VC++ without having to load the vi
> using LabView. My program is designed to start LabView, open the
> Determinant.vi and begin using it. My program does this, but I get an
> exception from the GetVIReference call if I have not opened up LabView
> and the VI that I want to use before running my VC++ program. If I open
> LabView and the VI that I want to use before I run my VC++ program, then
> everything works fine. Has anybody else had this problem?
Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 5
(4,332 Views)
> I'm attempting to call Determinant.vi
> (vi.lib\analysis\7linalg.ilb\Determinant.vi) from
> Visual C++. I've actually gotten the
> Determinant.vi to take a matrix that I pass it
> from Visual C++ and return the determinant to me.
> However, to get the determinant.vi to return an
> answer to VC++, Labview has to be running, and
> Determinant.vi has to be manually opened
> from the Functions palette and placed on the block
> diagram panel. Should determinant.vi have to be
> opened before I can use it from VC++?
>

I'm assuming you are doing this through the LV ActiveX
server interface. There are some C++ classes on the ftp
site that should simplify this. Also, when you get a
reference to a VI, you can use only the name of the
VI if the VI is loaded into memory, bu
t you must use
the full path if you need LV to load it into memory for
you. As for having LV be automatically launched, this
is handled automatically by COM, but only on certain OSes.
Again, the C++ classes should make it easier.

Greg McKaskle
0 Kudos
Message 5 of 5
(4,328 Views)