Calling LabVIEW from C# Using ActiveX?
Hi,
I try to call LabVIEW VI's from C# using ActiveX/COM, but I am not
successful. I was able to do this from C++ and there are nice articles on
the NI site dealing with the C++ integration.
I tried to follow the instructions of the C# help, using a wrapper for the
LabVIEW application call. I included the TypeLib that I created with the
tlbimp-tool in my project. Basically my code looks like this:
LabView50TypeLib._Application myLV = new
LabView50TypeLib.ApplicationClass() ;
LabView50TypeLib.VirtualInstrument myVI = new
LabView50TypeLib.VirtualInstrument();
myVI = myLV.GetVIReference(,?,?);
myVI.SetControlValue();
myValue= myVI.GetControlValue();
myLV.Quit();
I even don't know if the fi
rst line is correct. I know that the second line
is not OK, because there is no class "VirtualInstrument" - but from what
class should I derive my instance for the VirtualInstrument? And different
from my C++ implementation, the GetVIReference now needs 3 parameters
instead of 1 (the path).
What am I doing wrong? Does anybody have a working example on this?
Thanks a lot & best regards,
Martin Schellenberger
Hello
After adding a reference to the LabVIEW type lib to the project (I just to o to Project >> Add Reference and I browse for the typelib myself), and including the labview namespace at the top,here is what I tried
using LabVIEW;
//form code here
//Event for button code
LabVIEW.Application lv = new LabVIEW.ApplicationClass();
LabVIEW.VirtualInstrument vi= lv.GetVIReference(@"c:\a.vi","",false);
vi.FPWinOpen=true;
vi.Run(true);
So all it does is it opens the VI and runs it, seems to work fine. Hope this helps
Bilal Durrani
NI
Bilal Durrani
NI
Similar Messages
-
Problem calling java from vb via activex bridge
I am trying to call java from vb via ActiveX Bridge and I am running into problems. I would appreciate any help.
I am using Visual Basic 2010 express, and Java JDK 1.6.0_16. I have used the http://download.oracle.com/javase/1.4.2/docs/guide/beans/axbridge/developerguide/index.html page as a guideline. To try to make it work I took the following steps:
1. Wrote a very simple java class (below):
package xxx;
import java.io.Serializable;
public class axb implements Serializable {
public int get_axb_Handle() {
int Address = 12345678;
return Address;
2. After I compiled, and created the jar file. I built the dll using the following command:
"C:\Program Files\Java\jdk1.6.0_16\bin\packager" -out "C:\Program Files\Java\jdk1.6.0_16\jre\axbridge\bin" E:\axb\dist\axb.jar xxx.axb
3. I then registered using: regsvr32 axb.dll
4. In Visual Basic Express IDE I use Project -> Add Reference to add Iterop.axb (dump below), and axb namespace
5. In my basic code I use the following lines
Dim axb1 As axb.axb
axb1 = New axb.axb <== Crash here with AccessViolationException ( full exception below)
What am I missing? Any help would be greatly appreciated
Thanks
Iterop.axb partial dump
___[MOD] C:\Documents and Settings\Elie A. Cohen.USINC022\My Documents\Visual Studio 2010\Projects\Repo API Example\Repo API Example\obj\x86\Release\Interop.axb.dll
| M A N I F E S T
|___[NSP] axb
| |___[INT] axb.axb
| | | .class interface public abstract auto ansi import /*02000006*/
| | | implements axb.axbDispatch/*02000003*/
| | | implements axb.axbSource_Event/*02000005*/
| | | .custom /*0C000018:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 34 45 36 44 30 44 41 38 2D 36 41 45 44 // ..$4E6D0DA8-6AED ...
| | | .custom /*0C000019:0A000007*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.CoClassAttribute/*01000009*/::.ctor(class [mscorlib/*23000001*/]System.Type/*01000007*/) /* 0A000007 */ = ( 01 00 0C 61 78 62 2E 61 78 62 43 6C 61 73 73 00 // ...axb.axbClass. ...
| |
| |___[CLS] axb.axbClass
| | | .class public auto ansi import /*02000004*/
| | | implements axb.axbDispatch/*02000003*/
| | | implements axb.axb/*02000006*/
| | | implements axb.axbSource_Event/*02000005*/
| | | .custom /*0C00000F:0A000008*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ClassInterfaceAttribute/*0100000A*/::.ctor(int16) /* 0A000008 */ = ( 01 00 00 00 00 00 ) ...
| | | .custom /*0C000010:0A000009*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ComSourceInterfacesAttribute/*0100000B*/::.ctor(string) /* 0A000009 */ = ( 01 00 0F 61 78 62 2E 61 78 62 53 6F 75 72 63 65 // ...axb.axbSource ...
| | | .custom /*0C000011:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 43 44 42 46 36 42 33 33 2D 45 32 33 46 // ..$CDBF6B33-E23F ...
| | | .custom /*0C000012:0A000002*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.TypeLibTypeAttribute/*01000003*/::.ctor(int16) /* 0A000002 */ = ( 01 00 02 00 00 00 ) ...
| | |___[MET] method .ctor : void()
| | |___[MET] method equals : bool(object)
| | |___[MET] method getClass : object()
| | |___[MET] method get_axb_Handle : int32()
| | |___[MET] method hashCode : int32()
| | |___[MET] method notify : void()
| | |___[MET] method notifyAll : void()
| | |___[MET] method toString : string()
| | |___[MET] method wait : object(object,object)
AccessViolationException exception
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at WindowsApplication1.Form1.getPatientHandle_Click(Object sender, EventArgs e) in C:\Documents and Settings\Elie A. Cohen.USINC022\my documents\visual studio 2010\Projects\Repo API Example\Repo API Example\Repo API Example.vb:line 13
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:In case you haven't figured it out already... Or if anyone else is curious... Or for myself when I get old and forgetful...
h2. Object Creation
For starters, when you create an ActiveX object from within VB, use:
Set myObject = CreateObject("JavaObject.Bean")When I refer to JavaObject.Bean, I'm meaning the full object name + ".Bean". So, in your case, you should use:
Set myObject = CreateObject("xxx.axb.Bean")h2. Location
The .dll file must be located in the JRE that is used at the time of calling. Meaning, the .dll file must be placed under <jre_home>\axbridge\bin and registered there.
In your case:
DLL:
C:\Program Files\Java\jre6\axbridge\bin
Jar:
C:\Program Files\Java\jre6\axbridge\libh4. A Note:
The only supported JRE is a 32bit version as far as I know with regards to the ActiveX bridge. Just like the packager.exe can only be found in the 32bit JDK.
h2. Methods
h3. Object Types
ActiveX Bridge does not support passing literals or arrays. However, it does support passing java's primitive data types as Objects.
Simply meaning:
h4. Invalid:
public int get_axb_Handle() {
int Address = 12345678;
return Address;
}h4. Valid:
public Integer get_axb_Handle() {
int Address = 12345678;
return Address;
}On a normal circumstance, there's little difference between the two methods. However, in the second example, the JVM does a typecast from a literal data type to a object data type, resulting in a valid object to pass through to Visual Basic. Now, obviously there are multiple ways to do a proper change, new Integer(int) for example. It doesn't matter to me. At the end of the day, you have to pass an object.
As a side note, the same idea applies when receiving data from Visual Basic.
h4. Invalid:
public void set_axb_Handle(int newHandle) {
int Address = newHandle;
}h4. Valid:
public void set_axb_Handle(Integer newHandle) {
int Address =newHandle; -
Calling BRM from UDF using JNDI lookup with @EJB annotation
Hi Experts
I am trying to implement a UDF to invoke my BRM Rules set via JNDI Lookup instead of a SOAP Channel lookup.
I have had a look at the following links/docs:
Calling BRM from UDF using Public API
http://www.gleanster.com/system/resources/W1siZiIsIjIwMTIvMDgvMDcvMjAvNDcvNTAvNDMvVGhpbmdzX1lvdV9TaG91bGRfS25vd19hYm91dF9TQVBfTmV0V2VhdmVyX0JSTS5wZGYiXV0/Things%20You%20Should%20Know%20about%20SAP%20NetWeaver%20BRM.pdf
For item 1 above, the example looks really good, but it doesnt explain how I get access to the following required imports from my UDF:
import com.sap.brms.qrules.ejb.*;
import com.sap.brms.qrules.engine.AbstractProject;
import com.sap.brms.qrules.engine.RuleEngine;
import com.sap.brms.qrules.engine.RulesetContext;
import javax.ejb.EJB;
The second document is really good as well, but I could not figure out how to get it to work from my UDF.
So, can anyone help me to understand specifically what is required to get this to work?
Is is possible to invoke the rule set from my UDF?
How do I give my UDF access to all the required jars/imports?
I have manage to create a new DC (Development Component) with a public part and this enables me to get my code to compile on my local PC but I am not able to activate it due to the server not having access to the same java packages as my local copy.
Any help would be greatly appreciated.You resolve the dependency by importing the required jars with using the dependency tab for the mapping program.
As stipulated before, I have managed to resolve the dependency issue but I have now getting the same error as in the forum: Calling BRM from UDF using Public API
The specific error is:
com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:238)
Has anyome manage to get invoke a BRM Ruleset using JNDI? -
How to call LabVIEW from TestDirector
Hai to all,
I want to call LabVIEW function from TestDirector. That TestDirector using VBScript. is it posible? if posible can you give the procedure.
thanks for advance!
reddyHello,
in this case you have to contact Mercury for more informations. There are no experiences in this way from the LV side.
Regards
Thomas D.
NI Germany
(SRQ 204139) -
Calling BDC from Java using JCO
Hello Everyone,
Is it possible to call a BDC from Java program using JCO ?Are you serious with that question? Did you try to build the web service client before? Because this is exactly the same. Try to find "building web service clients" instead "Calling BPEL from java". By default (probably) every BPEL process has both WSIF and SOAP end points, just use correct WSDL address.
-
Calling package from java using JNDI properties
Hi there,
I have created an interface to transfer data from oracle to JMS XML Queue. It is inside a package and have generated a scenario.
The scenario works well when executed from the ODI designer. When I execute it from java it throws an error. The error is
java.sql.SQLException: Cannot load connection class because of underlying exception: 'javax.jms.JMSException: Cannot create the initial JNDI context
Is there any ways to set the JNDI properties, (any set methods for ODIConnection object)
CheersAre you serious with that question? Did you try to build the web service client before? Because this is exactly the same. Try to find "building web service clients" instead "Calling BPEL from java". By default (probably) every BPEL process has both WSIF and SOAP end points, just use correct WSDL address.
-
Not able to call Java from flex using RemoteObject
hi,
I am badly stuck in compiling my flex app to connect to Java code on the server side using LCDS remoteObject component.
My swf file wouldn't trigger a method on the Java class, below is the snippet of all relevant codes, i just don't know what to do.
Please help on what am i missing or what i am doing wrong in this.
------> 1. here is the ant target that uses mxmlc compiler option
<target name="flex-compile" depends="copy-all">
<mxmlc
file="${uisrc}/OnlineServicesPortal.mxml"
output="${prjdeploydir}/OnlineServicesPortal.swf"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="true"
incremental="true"
as3="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
</library-path>
<compiler.source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.include-libraries dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs/datavisualization.swc" />
<include name="libs/fds.swc" />
<include name="libs/player/10/playerfds.swc" />
<include name="locale/en_US/datavisualization_rb.swc" />
<include name="locale/en_US/fds_rb.swc" />
</compiler.include-libraries>
<!--compiler.services filename="${src}/flex/services-config.xml"/-->
<!--context-root context-path="portal"/-->
<default-size width="500" height="600" />
</mxmlc>
</target>
---------2. services-config.xml file
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
<channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
----------3. remoting-config.xml file
<service id="remoting-service"
class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
<channel ref="my-http"/>
</default-channels>
<destination id="portal">
<properties>
<source>com.mssb.portal.impl.PortalService</source> <!---this class file is valid & exists-->
</properties>
</destination>
</service>
-----------4. mxml file
<mx:RemoteObject id="myRO" destination="portal" result="createFieldsResultHandler();" fault="createFieldsFaultHandler();">
</mx:RemoteObject>
myRO.persistServiceDefinition(serviceDef) //called from action script function invoked upon a click of a button.actually , I have laready given print stataement for the data in the context property file that you can see in the output. Today I am also able to call the bpel process using the same java program from my DOS command promt(cmd). Don't understand why the problem is occuring in unix.
please help. -
Calling labview from external code
hello all,
I m a student and new to labview,i just want to ask that whether i can call VI developed in LAbview form my c++ code?
plz reply,it's urgent.
waititng for replies.
Thanx9866662680 wrote:
hello all,
I m a student and new to labview,i just want to ask that whether i can call VI developed in LAbview form my c++ code?
plz reply,it's urgent.
waititng for replies.
Thanx
If
you have the Application Builder or the LabVIEW Professional Developer
system you can compile the VI into a DLL and call that DLL as a
standard C DLL from Visual C(++). OTherwise you could call LabVIEW over
Active X and execute the VI through that. There are examples for
calling LabVIEW through Active X in your LabVIEW installation.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Call LabVIEW Virtual Instrument through ActiveX Server from C/C++
I am trying to access a VI by C/C++ almost identical to the reference example that can be found on this site for Visual Basic. However, somehow, I am unable to succeed to use the ActiveX Call() function. The program always crashes, whatever I try. Because the Visual Basic version works without any problems, I hope someone can point me the error in the code.
Thanks!
#include "stdafx.h"
#import "LabVIEW.tlb"
#define VIPATH "D:\\Program Files\\National Instruments\\LabVIEW 7.0\\examples\\apps\\freqresp.llb\\Frequency Response.vi"
using namespace LabVIEW;
int _tmain(int argc, _TCHAR* argv[])
// Initialization
HRESULT he = NULL;
he = CoInitialize(NULL);
// Create instance of
labview application engine
_ApplicationPtr pLV;
he = pLV.CreateInstance("LabVIEW.Application");
// Create instance of virtual instrument
VirtualInstrumentPtr pVI;
he = pVI.CreateInstance("LabVIEW.VirtualInstrument"); /* ?not? mandatory */
// Get reference to a VI at location VIPATH
_bstr_t viPath(VIPATH);
_bstr_t password("");
VARIANT_BOOL resvForCall = FALSE;
long options = 0;
pVI = pLV->GetVIReference(viPath,password,resvForCall,options);
// Show front panel
pVI->FPWinOpen = TRUE;
// Call the referenced VI as subVI
_variant_t paramNames[5] = {"Amplitude", "Number of Steps", "Low Frequency", "High Frequency", "Response Graph"};
_variant_t paramVals[5] = {}; /* VT_EMPTY */
/* Fill ParamVals with values from VI */
for (int i = 0; i < 5; ++i) paramVals[i] = pVI->GetControlValue(paramNames[i].bstrVal);
/* Call VI -> !!! CRASH !!! :-( */
pVI->Call(paramNames,paramVals);
// Release references and close application
pLV->AutomaticC
lose = TRUE;
pVI.Release();
pLV.Release();
CoUninitialize();
return 0;This may not be the easiest way. Although i have not used _variant_t. But it seems like your VARIANT type is VT_EMPTY for everything. You need to build up an array of variants with correct type, that matches the type of control you are assigning data to like VT_INT for int numeric, VT_BSTR for string control etc
VARIANT paramNamesVarArg, paramValuesVarArg;
SAFEARRAY *paramNames, *paramValues;
::VariantInit(¶mNamesVarArg);
paramNamesVarArg.vt = VT_ARRAY | VT_BYREF | VT_BSTR;
// create safearray of strings
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1;
paramNames = SafeArrayCreate(VT_BSTR, 1, rgsabound);
paramNamesVarArg.pparray = ¶mNames;
long index = 0;
_bstr_t paramName = "Numeric";
BSTR *bstrVal;
retVal = SafeArrayPtrOfIndex(paramNames, &index, (void **)&bstrVal);
*bstrVal = paramName.copy();
//do the same method for paramValuesVarArg
::VariantInit(¶mValuesVarArg);
paramValuesVarArg.vt = VT_ARRAY | VT_BYREF | VT_I4;
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1;
paramValues = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
paramValuesVarArg.pparray = ¶mValues;
VARIANT *dispVarVal;
VARIANT tempVar;
tempVar.vt = VT_I4;
retVal = SafeArrayPtrOfIndex(paramValues, &index, (void **)&dispVarVal);
*dispVarVal = tempVar;
viPtr->Call(¶mNamesVarArg, ¶mValuesVarArg);
Hope it helps.
A Rafiq -
Printing labels from CVI using ActiveX and WORD
I'd like to print labels from CVI. I managed to create the label type I need
in WORD. Now I want to use that in CVI. The following macro describes exactly
what I want. Maybe someone can translate this to CVI, please ???
Sub Macro2()
' Macro2 Macro
' Macro recorded 17-02-00 by IT-Systems
Documents.Add Template:= _
"C:\Program Files\Microsoft Office\Templates\Normal.dot", NewTemplate:=
False
Application.MailingLabel.DefaultPrintBarCode = False
Application.MailingLabel.CreateNewDocument Name:="10.63230", Address:=""
, AutoText:="ToolsCreateLabels1", ExtractAddress:=False
End SubWe do not have an example that will do *exactly* what you need, but you should
find an ActiveX example program, either in the CVI samples folder or on the
Example Programs Database, that illustrates how to print a document in Word.
The function you will need to call that actually invokes the print method
is Word_DocumentPrintOutOld. It's defined in word2000.h; the prototype,
in case you were curious is:
HRESULT CVIFUNC Word_DocumentPrintOutOld (CAObjHandle objectHandle,
ERRORINFO *errorInfo,
VARIANT background, VARIANT append,
VARIANT range, VARIANT outputFileName,
VARIANT from, VARIANT to, VARIANT
item
VARIANT copies, VARIANT pages,
VARIANT pageType, VARIANT printToFile,
VARIANT collate,
VARIANT activePrinterMacGX,
VARIANT manualDuplexPrint);
"Han Stehmann" wrote:
>>I'd like to print labels from CVI. I managed to create the label type I
need>in WORD. Now I want to use that in CVI. The following macro describes
exactly>what I want. Maybe someone can translate this to CVI, please ???>>>Sub
Macro2()>'>' Macro2 Macro>' Macro recorded 17-02-00 by IT-Systems>'> Documents.Add
Template:= _> "C:\Program Files\Microsoft Office\Templates\Normal.dot",
NewTemplate:=>_> False> Application.MailingLabel.DefaultPrintBarCode
= False> Application.MailingLabel.CreateNewDocument Name:="10.63230",
Address:="">_> , AutoText:="ToolsCreateLab
els1", ExtractAddress:=False>End
Sub> -
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.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.
[email protected] wrote in article <7qj86j$g81$[email protected]>...
> 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
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
I am trying to run a LabVIEW VI from DIAdem. I looked in the help files but the example seems to only open LabVIEW 7.0 and not open the VI. The process stops on the LabVIEW startup screen. Also I have LabVIEW 7.1 loaded on my machine and would like to be able to select which version of LabVIEW I start with DIAdem. Is any of this possible?
Thanks in advance.
AJLHi AJL,
If your VI happens to be in the LabVIEW directory or subdirectory structure, you can use native functions in DIAdem 9.1 to call that VI from DIAdem. If the VI is further configured to run when opened, it will automatically start:
IF IsAvailLabVIEW = TRUE THEN
LVTemplatePath = "examples\DIAdem\File\File Headers\"
LVTemplateVI = "Binary File Analyzer.vi"
Call LaunchLabVIEW
END IF
Otherwise you will need to create VBScript object variables from the VI server of LabVIEW and execute their methods and set their properties to have the same remote control over the VI as you would from another VI using VI server. The example Tom pointed you to shows this in intricate detail, in the context of a very large application. Here's what VI server looks like in VBScript:
Dim lvapp, vi, viPath, paramName(0), paramVal(0)
Set lvapp = CreateObject("LabVIEW.Application")
viPath = "C:\Favorite LV Menu\Binary File Analyzer.llb\Binary File Analyzer.vi"
Set vi = lvapp.GetVIReference(viPath)
vi.FPWinOpen = True
paramName(0) = "file path"
paramVal(0) = "C:\DIAdem Hands-On\ReadMe.txt"
Call WndShow("SHELL", "MINIMIZE")
Call vi.Call(paramName, paramVal)
Call lvapp.Quit()
You can read and write more than one parameter for VIs with multiple input/output terminals. Note that the paramName() and paramVal() variables are VBScript arrays. The number of elements in these arrays does NOT have to match the number of terminals-- all you need to put in these VBScript arrays are the parameters that you care to read/write in the VI.
Ask if you have additional questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
How do I open Windows Media Player 11 in a new window via labview 8.5 using ActiveX
Hello,
Although familiar with Labview, I am new to the ActiveX Controls. I have managed to open and play movie files in Labview with ActiveX controls but the player is embedded in Labview's front panel. How can I control what file is played and when it starts in Labview but have Windows media player 11 open in a separate window.
Additionally, where can I find a description of the ActiveX properties.
Thank youI'm trying to accomplish this same thing and am having a hell of a time finding the right Class, right Methods, and/or right Properties for a solution. Some classes seem to return obscure errors when I try to create them use the invoke node "launchURL" (the WMPLib.ICore for example). If I use the Player base class (which MSDS says is the root class and the class that is used when you create an embedded player) I don't get anything.
What I would like is to progmatically launch Windows Media Player to play a particular video clip in full screen on the secondary monitor. It seems like this should work:
But doesn't... any ideas for this? The C# examples are difficult to understand for me. Also, the WMP class library is a MESS! (IMHO). Thanks for your input. -
Can anyone point me in the right direction on the best practice for calling an RFC using SSO from an EJB?
When using the local interface for the EJB, the only solution I see is to pass the authenticated IUser instance from the portal component to the EJB business method through the method signature.
I am guessing that there is a better way to get access to an authenticated user in the EJB container.Thanks for the reply.
Actually I was able to solve the problem last night. To get SSO to work in my local EJBs I created an RFC destination in the destination service using the visual administrator. I then used the destination service at runtime to pull the system definition from the J2EE system definitions store instead of the portal system landscape definitions and my connection object was created as expected.
Here is the code to create the connection in my EJB business method:
//get the user
IUser user = UMFactory.getUserFactory().getUserByUniqueName(this.myContext.getCallerPrincipal().getName());
// get the destination service
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sapportals.portal.prt.registry.PortalRegistryFactory");
InitialContext context = new InitialContext(env);
IDestinationsService destinationsService =
(IDestinationsService) context.lookup(IDestinationsService.SERVICE_JNDI_NAME);
// define a destination filter to restrict to the RFC defined destinations
DestinationFilter destinationFilter1 =
new DestinationFilter(DestinationFilter.SOURCE_J2EE_DESTINATION_SERVICE, DestinationFilter.TYPE_SAP);
// get a user specific connection
IConnection connection = destinationsService.getConnection(user, "ECC", destinationFilter1); -
How to Call RFC from PortalService using a ServiceUser
Hi,
I have some code that calls an RFC using JCO.
(I have other code I wrote using JCA to connect from a portlet, but that requires a Session and uses an IProfile)
Our security team wants me to use a Serviceuser instead. But I can't seem to figure out how to use a ServiceUser to call an RFC.
If I can just get an IConnection, i can use the rest of my JCA code to call the RFC. But I'm stuck getting the connection
The closes I've gotten is this:
com.sapportals.portal.security.usermanagement.IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("myserviceuser");
IConnectorGatewayService cgs=PortalRuntime.getRuntimeResources().getService (IConnectorGatewayService.KEY);
ConnectionProperties cp=new ConnectionProperties(new Locale(),user);
IConnection conn=cgs.getConnection("mySAPsystemalias",cp);
There are two problems with this (or maybe more)
The connectionproperties takes an IProfile not an IUser
I also thought I needed a com.sap.security.api.IUser, not the one above.
Can someone point out what is wrong or a different way?
thanks
Chris BuchholzChris,
You could always use a JCO JNDI connection, in which case you dont need anything other than a HashMap of the the following properties
client
messageserverHost
systemLangauge
group
type
systemType
systemId
serverPort
username
password
The username and password you supply can be a service user or a normal logon user as far as I know.
Cheers,
Steve
Maybe you are looking for
-
Video's audio out of Sync once imported to Encore CS6
Hello Everyone, I'm having some issues with Encore CS6 on my iMac running OS X 10.9.5. I'm trying to burn some video that i've captured off of VHS using Elgato Video Capture. It outouts the files as .mp4 The videos play fine outside, but as soon as
-
Contacts not showing in messages
So I got a new sim card for my phone, all my contacts are still there, and if I click on "To:" in messages, I can go into contacts and select someone, but in my messages, no names show up. It's just everybody's numbers. Why is this?
-
in color when i select send to final cut pro all the color corrections are lost when opened on final cut. It appears that I successfully rendered all of my clips in Color, but when I open the NEW sequence in FCP (the one from color) they do not look
-
Selection varuable on Compounded Info Object in Query Designer
Hi, To identify the inconsistencies inconsistencies in the source system abt the description I am Text Description of Application Status Source System dependent Application Status is compounded on Source System.... There will be 3 values for Appl
-
Wrong SQL (WHERE Clause) with Generic DS based on Wiew
Hi to all of you, we have a problem that happens sometimes (it seems to have a random behaviour). Generic Extractors based on Views sometimes are interpreted on R/3 ORACLE without considering Selection Conditions imposed in InfoPackages (that are in