ActiveX Variant Pointer - Variant?

Hello.
I have an ActiveX control that requires a VARIANT to be passed in. The VARIANT needs to contain a SAFEARRAY of int32s. I have a DLL that assembles the variant SAFEARRAY from a standard LabVIEW array. However, because of limitations on Call Library Function Nodes my DLL function has arguments of long * and VARIANT *. So I end up with a VARIANT pointer rather than a plain VARIANT.
Q. Why can't Call Library Function Nodes just return a VARIANT?
Moving along, I wire the VARIANT pointer to a "To Variant" vi and then wire the output to my ActiveX control method.
=> The ActiveX control (IDL SetNamedArray) is meant to share memory with the container application. I assume this is possible by sharing the SAFEARRAY pointed to by p
array within the VARIANT. The problem is that this doesn't work. The error returned is that "memory is locked" in the vi.
Q. Does LabVIEW lock SAFEARRAYs?
If anyone has had any experience manipulating SAFEARRAY VARIANTs in LabVIEW and passing them to ActiveX controls I'd be most interested to hear of any tricks and undocumented features.
cheers,
Novak.

> But I need to do something different because wiring an LV array
> straight into the method will copy the data into the IDL ActiveX
> control but the memory is not shared between LV and IDL - I get the
> memory locking error and the method fails (returns 0). Thats why I
> tried making the VARIANT myself. I've contacted IDL and when I
> resolve this issure I will post my findings because it might be of
> general interest amongst users of ActiveX controls in LV.
>
If you want there to be shared memory between the two, then you should
probably look to make additional methods, one that allocates if
necessary and copies the LV data into the shared space, and another to
return the value to the LV diagram from the shared memory.
Greg McKaskl
e

Similar Messages

  • ActiveX variant to LabVIEW variant

    Hi Ppl,
    I'm reading ActiveX data from an application(TestStand) in LabVIEW. The data I get is of the type ActiveX Variant. When I use variant to data node I'm able to convert the data to the corresponding data type. Howevere in my application the data type varies dynamically and I cannot use the variant to data node.
    I will have to flatten it to string. But the flatten to string node does not work with ActiveX variants. It only works with LabVIEW variant types. So is there any way that i could convert ActiveX variant types to LabVIEW variant. I tried the to variant node too. I too does not convert it as expected.
    Thanks,
    Sathish
    Here is how both the variant types differ
    Activex variant (boolean):
    '': OLE Variant 
    Variant Type -> VT_BOOLValue -> FALSE
    LabVIEW variant(boolean):
    'Boolean': boolean (TRUE or FALSE) 
    FALSE

    Hi lordsathish,
    Unfortunately, there is no way in LabVIEW to access type data for OLE/ActiveX variant data.  However, you can obtain information about the datatype of a TestStand PropertyObject using the ValueType method:
    myObject.Type.ValueType
    This will return the data type (see the ValueType help entry for more details).  you can then use the specific type methods (getValBoolean, etc) to extract data.  In the case that you have an array, you can use the ArrayDimensions and ElementType to extract the data from the array.  In the case of a container, the contained items will be considered propertyObjects, so you can use the getNumSubProperties and getPropertyObject methods to access the contained items.
    Refer to the PropertyObjectType reference help for details on these methods
    I hope this clarifies!
    Al B.
    Staff Software Engineer - TestStand
    CTA/CLD

  • LabView to ActiveX Variant

    Hello,
    I was looking for some help with this. I have had issues in the past with placing arrays into an ActiveX Variant and found that ActiveX variants are not the same as LabView variants. I am tring to place a 0 or a 2 into Property input which is variant type. At this moment, it does not work. My guess is that the activex variant isn't handling the input well. I may be wrong, but my intuition say this is my issue. Does anyone have a way to deal with this? Here is NI's response to the issue. 
    Thank You for your responses.
    -=-=-=-=
    Hi Chuck,
    I was able to talk to R&D and it looks like there is not necessarily a
    simple or new way to handle ActiveX Variant data in LabVIEW. From a previous
    issue I found, the engineer had worked with R&D and said:
    "Use the 'Database Variant to Data' VI instead of the 'Variant to Data' VI
    While the name may be misleading, the Database Variant datatype is the same
    datatype as the ActiveX Variant. The native LabVIEW Variant is different from
    the ActiveX and Database Variant datatypes."
    The customer in that case had a few issues using this VI, though, so it may
    also not help your implementation either; there also is not a "Data to
    Database Variant" function that I am aware of. Furthermore, I understand
    that this VI is the same direction of dataflow as RolfK's example. As far as
    the "Data to ActiveX Variant" implementation, R&D said that it
    would have to be implemented the same way that Rolf has made his VIs. The
    R&D engineers referenced the following example, which is also linked by
    "lvb" in the LAVA forum post:
    NI Community: Dereferencing Pointers from C/C++ DLLs in LabVIEW
    https://decibel.ni.com/content/docs/DOC-9091
    Finally, I did find a post in the LabVIEW idea exchange, which I believe was
    started by "lvb" on the LAVA forum you found. If you are not familiar
    with the Idea Exchange, it is where LabVIEW users can propose and
    "Kudos" (or vote) for ideas that they wish would be implemented in
    LabVIEW. While this does not guarantee that a feature will be in a future
    version of LabVIEW, it does more effectively put it on NI R&D's radar.
    LabVIEW Idea Exchange: Support OLE Variant or ActiveX Variant Type Access
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Support-OLE-Variant-or-ActiveX-Variant-Type-Access/idi...
    Attachments:
    GM FLIR A320 ImageGrab AE.jpg ‏16 KB

    appears it is okay to wire directly like that. I found examples with I16 wired straight to property input. Must be the resister I am writing to isn't work like it should.

  • How do you pass an ActiveX Variant from an external application to LabVIEW?

    Background: I created a LabVIEW ActiveX server. I can access it with my external application (Matlab). I have a control variable in my LabVIEW executable. I want to use Active X to set the value of my control variable from my external application.
    Documentation: The only reference in the documentation for this task is in the Using ActiveX with LabVIEW in the LabVIEW 2009 help. It simply says "Use the variant control and indicator to pass data to or from ActiveX controls." I also went through all the ActiveX examples in the example finder and did not find any vis that passed variables using ActiveX.
    Questions:
    What should my control variable look like in LabVIEW? Should it be a refnum, a variant, or a data type? Does it have to be wired to a vi connector?
    Do I need to do any magic on this variable, such as change its properties?
    How do I pass the value from my external application to the variable in my LabVIEW executable?
    Thank you.

    Hello Lyn,
     The control variable should be a refnum and it would have to be wired to Automation Open with the correct reference.
    Here are some great examples of using ActiveX Server in LabVIEW
    LabVIEW Executable Used as ActiveX Server in LabVIEW
    http://decibel.ni.com/content/docs/DOC-9647
     Calling ActiveX Code from LabVIEW
     http://decibel.ni.com/content/docs/DOC-9073
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • ActiveX Variant in Invoke Node?

    I'm trying to do some stuff with a Word document through ActiveX in LabVIEW. This is mostly going well, but I am unsure of what the variant options are on the invoke nodes. I have included a picture with the variants on the invoke node circled. Where are these variants documented? What kind of data/type needs to be in the variant to use these options?
    Thanks.

    Whoops... I meant to put this inthe LabVIEW board, not the TestStand board. Will someone please move it to the appropriate board for me?
    Thanks.

  • Using ActiveX variant BTY_string conversion problem

    All,
    I am using LV5.1f1 with a self written activeX libray. I am using a variant
    object type (B-string) to communicate with the library. On the LV side, I
    convert an array of 6 U16/u8 byte to string with the u8 string conversion
    icon.
    It is said, that Lv automatically converts all input objects going to the
    invoke node of the ActiveX object. This is not true, as the string result
    on the library side is wrong in one of the 5 bytes.
    Can anybody help ?? Pleeease

    > I am using LV5.1f1 with a self written activeX libray. I am using a variant
    > object type (B-string) to communicate with the library. On the LV side, I
    > convert an array of 6 U16/u8 byte to string with the u8 string conversion
    > icon.
    >
    > It is said, that Lv automatically converts all input objects going to the
    > invoke node of the ActiveX object. This is not true, as the string result
    > on the library side is wrong in one of the 5 bytes.
    The automatic part refers to the fact that LV maps things like arrays to
    Safe Arrays and LV strings to Variant strings. It cannot however know
    what formatting you expect within a string, and that seems to be your
    problem. When you are converting the LV array to a string, are you using
    a Format to String node where you specify nu
    meric formatting options, or
    are you simply casting them to a binary representation of the string. It
    sounds like you are casting to a binary string. If so, you will probably
    find that the dual byte fields have their bytes swapped since LV always puts
    these binary string representations into big-endian format. You are probably
    better off just wiring the array straight into the ActiveX property or Invoke
    node without any type of casting or converting. If your ActiveX server is
    using strings to pass binary information and expects it to be in little-endian
    order, then you can use the Swap Bytes node that is in the Advanced functions
    I believe.
    Greg McKaskle

  • LabView 8.5 ActiveX Variant Data

    Hi all,
    First off, I admit I have no idea what I'm doing with this ActiveX stuff however I did find some vi's that do almost what I need.  My question is, how do I know what data I need to squirt into the purple texts under sheets to achieve the result I need.  Specifically, the After which I assume controls whether the new added sheets occur before or after the first sheet created by excel.  I got lucky with the Count but is there another document I need from say Microsoft that tells me what type of data each of these takes?  Sorry for being so ignorant but this is how we learn, no?
    Mark
    Attachments:
    ActiveX.jpg ‏52 KB

    That sounds like you don't have the Visual Basic Help files installed. A "normal" installation of Excel doesn't install this. You have to install them using "advanced customization" of the application. If you're installing Excel as part of office this checkbox is present right below where you select which product(s) to install. Then, in the "Advanced customization" window expand "Office Shared Features". Then make sure that the item "Visual Basic for Applications" and its child entry "VIsual Basic Help" are both selected to be "Run from My Computer".
    As noted, though, this information can also be found on the web from MSDN.

  • Passing Variant to dll using call library function node

    Hi,
    Using LV2012
    I have a dll that the following prototype:
    SetTestResult(LPCTSTR Serial, int Test, int Result, VARIANT measuredValue);
    How can I pass the Variant to this node when my variant can be either int or float.
    I have tried "ToVariant" function but it is not sending data and gets error 1517 on LabView. For configuration parameters for variant I have used ActiveX type and datatype as activeX Variant Pointer.
    So for call library function node my prototype looks like this:
    int32_t SetTestResult(CStr Serial, int32_t Test, int32_t Result, VARIANT  *measuredValue);
    Can someone help me understanding What am I doing wrong here please?
    Thank you,
    Hiren
    Hiren Patel

    Hello Hiren,
    Posting your code (even without the DLL) would definitely make it easier for people to point out potential issues.  Here is an example that demonstrates passing an ActiveX variant to a DLL built in CVI, I would suggest cross-checking the way the Call Library Function Node has been configured.
    Example:Transferring an ActiveX Reference Pointer to a CVI DLL
    http://zone.ni.com/devzone/cda/epd/p/id/3343
    Regards,
    Tom L.

  • Fastest type of database connection/use

    Hi all,
    i have (inherited) a large piece of code that is constantly pulling medium-sized amounts of data (20 rows by 10 cols of numbers, strings and xml) from a db. We will make up to 400 calls to execute a single operation. This can get very slow.
    Does anyone have suggestions as to how to speed this up? I can see a few options:
    1. batch some of the queries together as much as possible;
    2. pull bunches of data once out of the db, keep in memory, and sort through in LV when needed;
    3. switch from ODBC to, say, ADO (is that easy to do?);
    4. try to run queries in parallel (can that even be done?).
    This is LV 7.1 on XP with SQL Server 2000/5/8 and ODBC.  
    all suggestions welcome. and thanks. 

    cross referencing Michael's other thread:
    (1): As noted in the thread above batching inserts is definitely worth it.
    (2): Reading from LabView memory is going to be faster than hitting the database, but you don't want to rewrite a database server in LabView! Beyond making sure that you are not asking for the same data over and over, my recommendation is to let the database be the database. 
    (3): I haven't used ODBC in a long time.We use ADO via the ADODB Active X object and SQLOLEDB. It is pretty fast. (We can read about 1000 rows/second from a table with 50+ columns of numeric/timestamp data.) We have also tried ADO.NET and although it should be fast (SQL Server 2008 Management Studio uses it, for example) we found it between 10 and 40 times slower than ADO when called from LabView. (LabView's .NET implementation is apparently more focused on compatibility than speed.)
    ADO is very easy. If your code is all pure SQL, you really only need a few methods: Connection.Open, Connection.Execute (which returns a Recordset), and Recordset.GetRows. GetRows() is very fast; it returns an ActiveX variant that you cast to a 2D array of (ActiveX) variants that you can then convert to LV data. Jeffrey Travis' LabSQL is one set of wrappers around ADO; I think there's another one out there. Microsoft wants you to use ADO.NET for new designs but I can't see ADO going away any time soon. (And when it does, ODBC will still be around! Maybe you want to stay where you are...)
    This is probably a good time to point out that there is a ghastly memory leak in ADO under Vista/2008 Server . Follow Microsoft's suggestions for changing the connection string to avoid it.
    (4): You can absolutely run queries in parallel; just open multiple connections to the DB and do it. You have to make sure all of the VIs you are using are re-entrant all the way down. 
    Other ideas:
    How are you converting from database types to LabView types? That can be a bottleneck.
    Are you stitching data from more than one table together to build your internal data structure? Consider making a view that abstracts a join in SQL Server so it does the gluing and you do a single read.
    Can you make your LabView program less synchronous? LabView queues are fast and robust; if you can measure your data and then toss it off into a queue to get logged to the DB by another thread, you'll be able to read data faster.
    Make sure SQL Server has plenty of RAM.  

  • Need help in using ActiveX to retrieve a VARIANT

    Need help in using ActiveX to retrieve a VARIANT.
    Variant is shown as       var{VT_Ul1,1}  in debug
    Using the following
    hr = CA_VariantGetShort (&var, &value);
    I get 0 for my answer instead of 1.
    Solved!
    Go to Solution.

    Answered my own question.
    VT_Ul1 is an unsigned char and not a short.

  • Assigning a variant string to a function pointer issue?

    Hello,
    This is a little complex for me to describe, so I will try my best to explain !
    I don't know if this is doable in C?
    Basically, I need a function pointer to hold the name of a function coming form a character array!
    From the examples I have seen, it seems that what I am trying to do is not the conventional way of doing function pointers, but I don't see any other way of doing what I need to do.
    In one instance, the function pointer in my code, will require to be assigned a function name like this:
    _g_BlkFuncs_ =_BUF_FUNC_PTR_ParseBlockStatus;
    and at other instances, the same function pointer needs to be assigned to a function called:
    _g_BlkFuncs_ =_INV_FUNC_PTR_ParseBlockStatus;
    and at other instances:
    _g_BlkFuncs_ =_AND_FUNC_PTR_ParseBlockStatus;
    or
    _g_BlkFuncs_ =_OR_FUNC_PTR_ParseBlockStatus;
    etc....
    The only time I will know which function to assign is when I will retrieve the first part of the function name from a table called
    _x_UserPrgBlock_. The first part being the name differentiator such as "_BUF_", "_INV_", "_AND_", "_OR_" and so forth which
    is initially stored in the one of the table members called m_LogicElement_ residing in the _x_UserPrgBlock_ table or struct.
    In the example below, I made it simple by hard coding the assigning of the m_LogicElement_ member as "_BUF_" (see the line commented as "Manual assignment line" below). In reality the  m_LogicElement_ member is assigned from
    a user defined string which will vary from time to time. 
    Here is the sample snippet which shows the issue.
    ================================STRUCT.h
    #ifndef STRUCT_H
    #define STRUCT_H
    typedef struct USR_PRG_CNV{ // User program converter table
    char m_LogicElement_[2][knst_BUF_LOGIC_ELEM]; // Name of the logic block
    } User_Prg_Block;
    #endif
    =================================_BUF.h
    #ifndef BUF_H
    #define BUF_H
    void _BUF_FUNC_PTR_ParseBlockStatus(void);
    #endif
    ================================_BUF.c
    void _BUF_FUNC_PTR_ParseBlockStatus(void){
    int i = 0;
    i = 10;
    ===============================UPC.h
    #ifndef UPC_H
    #define UPC_H
    void AssignmentFunc();
    #endif
    ===============================UPC.c
    User_Prg_Block _x_UserPrgBlock_[2];
    void AssignmentFunc(){
    strcpy(_x_UserPrgBlock_[0].m_LogicElement_, "_BUF_"); // Manual assignment line
    ===============================DFP.c
    #include "_BUF.h"
    void (*_g_BlkFuncs_) (void);
    char volatile _g_FuncPtrStrVariant_[35];
    void SomeFunction(){
    strcpy(_g_FuncPtrStrVariant_, _x_UserPrgBlock_[0].m_LogicElement_); // Get "_BUF_"
    strcat(_g_FuncPtrStrVariant_, "FUNC_PTR_ParseBlockStatus"); // Complete the function name
    // Now try to assign the full function name to the function pointer
    //_g_BlkFuncs_ = _BUF_FUNC_PTR_ParseBlockStatus;
    //_g_BlkFuncs_ = &_g_FuncPtrStrVariant_;
    _g_BlkFuncs_ = _g_FuncPtrStrVariant_; // ???
    ==============================Main.c
    void main(){
    AssignmentFunc();
    SomeFunction();
    In reference to the following line listed above:
    _g_BlkFuncs_ = _g_FuncPtrStrVariant_;
    I do realize that conventionally, it should be:
    _g_BlkFuncs_ =_BUF_FUNC_PTR_ParseBlockStatus;
    The problem I find myself faced with is that the function that "_g_BlkFuncs_" points to, has to vary in accordance to the name of the function stored in the _g_FuncPtrStrVariant_ character array! The reason is that the _g_FuncPtrStrVariant_
    array is actually built up to the name of the function based on the current contents of m_LogicElement_ residing in the _x_UserPrgBlock_ table.
    I think!!!!! that even if I use an array of function pointers, it won't solve the issue.
    In summary, in C, is there a way to assign a name of a function built from a character array to a function pointer?
    All help sincerely appreciated!
    Thanks

    I am interpreting your question a little different than Brian.
    If I understand you correctly you are asking:  "Given the name of a function as a string, how do I get a pointer to that function".
    The unfortunately fact is that C++ does not support reflection, so getting a function by name is not possible.  By the time the linker has done its thing, the function name has been stripped from code.
    This means if you need to support string lookup of a function name you need to support an alternate mechanism to handle this.  If you were using C++, a map would be an ideal mechanism.  C can still do this, but the mechanism is a lot uglier
    due to the lack of data structures like std::string and std::map.

  • Trouble creating Variant format for ActiveX Function (MintMT Controller)

    Hello!
    I am creating a VI to control 2-axis motion using the MintMT activeX library and have run into a problem.  I was able to easily call and execute functions from Labview until I ran into one (VectorA) that requires an array of variant input.  I cannot format my input correctly and have exhausted myself trying different combinations of building this array and converting to variant type (To Variant). I also have wired Labview arrays directly (with no luck). The arrays are very small (only 2 elements). Finally I tried the OpenG library (Cluster to Varray and Array to Array of Vdata) without success.  The error code is: LabVIEW:  (Hex 0x80070057) One or more arguments are invalid.
    Any advice?
    Attached is the documentation for the function:
    VectorA
    Prototype:
    VB      VectorA(nNumberOfAxes As Integer, nAxesArray As Variant,
                    fPosArray As Variant)
    Delphi  VectorA : (nNumberOfAxes: Smallint; nAxesArray: OleVariant;
                       fPosArray: OleVariant)
    C++     void VectorA(short nNumberOfAxes, VARIANT nAxesArray, VARIANT fPosArray);
    C       void VectorA(__int16 nNumberOfAxes, __int16 *nAxesArray, float *fPosArray);

    Hi Mr. NiceGuy,
    The code from the manufacturer has a To Variant converter between the arrays and the Property Node. I'd recommend converting the arrays to variants in your code. You can find that To Variant VI on the Functions Palette » Programming » Cluster, Class, & Variant »Variant. Let us know if that works.
    Hillary
    Regards,
    Hillary E
    National Instruments

  • Variant Input Parameters with ActiveX Objects

    I've created an ActiveX library that exports a variety of objects using Visual C++ Version 6.0. I'm testing the methods and properties of these objects using both LabVIEW and Visual Basic clients. The problem I'm facing is that when testing under LabVIEW, I can't access methods that expect a VARIANT input parameter. The declaration in C++ of one object's such method looks like this:
    void CChassis::Configure (VARIANT config, int rate);
    I can create the ActiveX object with both LabVIEW and Visual Basic. I can invoke methods that do not use VARIANT input parameters using both as well; but, when I create a second ActiveX Object (a CConfiguration) and use the LabVIEW Variant operator, my attempt to invoke Configure fails with a "No Such Interface (E_NOINTERFACE)" error. The invocation fails identically if I wire the CConfiguration directly to the Variant input, as well. If I instead create a constant VARIANT as an input parameter, my Configure method gets called, although the method recognizes that I passed an invalid object.
    Using Visual Basic I can invoke the Configure method without problems while encapsulating a CConfiguration object within a Variant.
    So my question is, have I found a LabVIEW error, or is my approach flawed? If my approach is flawed, where have I gone wrong? Thanks in advance! I'm using LabVIEW version 7.0.

    Hi,
    Have you tried to put in plain data or an object reference into your variant parameter?
    I think plain data should work... for object references i don't know.
    Some time ago, i also coded a small activex library, where i passed object references by parameters in delphi. I did not use variant parameters, but the real interfacedeclaration types (like IMyObject**). This worked fine. I also uses "dual" interfaces for the objects, which get passed by parameter. But i don't really know if this is helpfull for vb.
    Finally, you can also use a workaround:
    For each of your Objects, that you want to use from LabView and which you want to pass by a parameter, you
    insert an new Property "int32 Object_Handle".
    When an Object gets created, it ask a "ObjectHandleManager" (gets written by you) to get an own unique Object_Handle which it stores into its property "Object_Handle".
    The ObjectHandleManager generates an new Object Handle and memorizes the Handle assoziated with the calling object's reference.
    Now, at each time, when you want to pass a object reference to a library function of your self, you can pass the Object_handle as an integer value. In the called function, you can ask your ObjectHandleManager for the real ObjectReference.
    But thats not a very comfortable workaround.

  • Variant Configuration - Conf. Supporting Points - Planning Profiles

    Iu2019m currently working on an implementation where we are implementing R/3 (SD, Manufacturing, LO, FI, etc) and APO Demand Planning.  In doing so weu2019re using VC (Variant Configured) Products where weu2019re forecasting at the KMAT Level which should drive the dependent requirements for non-VC items and those VC items that we maintain a Planning Profile (MDP6) and then Conf. Supporting Points for the items.  This is fine for the products that we actually want to maintain a split factor for but most of the VC items we have from a planning perspective we donu2019t actually want/need to maintain a probability usage for the VC items.  In trying to maintain the Planned Independent Requirements we receive error messages stating we need to maintain the profile and also manage supporting points. 
    I was able to release a forecast from DP and place it in Demand Management R/3 but if you want to change it in R/3 youu2019re forced to maintain the profile and supporting points.  Also, even using the released forecast from DP when I run MRP I get en error message 52 u201CNo BOM Selectedu201D and then opening the order that is generated I get message 61259 Material requires configuration and the message (below) indicates that characteristic values need to be maintained. 
    What Iu2019m looking for is a way to allow MRP to plan these items without having to maintain a profile for thousands of materials.  Also, so it would enable the ability to maintain the forecast for those items in MD62.
    ERROR MESSAGE IS BELOW:
    Material requires configuration
    Message no. 61259
    Diagnosis
    Orders and requirements for a configurable material must have characteristic values.
    Usually, you should create a variation for configurable materials managed in inventory management which has the default variant configuration.
    System Response
    MRP: Requirements without characteristic values for a material cannot be planned in MRP.
    Procedure
    Check requirements or orders.
    Create a configuration evaluation for the material in the material master record if necessary.

    Hi,
    Please check below link.
    http://help.sap.com/saphelp_ides/helpdata/en/0a/857463c87611d1a7760000e8a5f6c8/content.htm
    Regards,
    Anil

  • ActiveX - Word - Casting Objects to Variants

    Hi there,
    I'm just getting used to using Active X to automate MS Office tasks. I have the full suite, and the report generation tool does some things, but there's plenty more that I would like to do and I'm giving Active X a go (it's basically what NI do anyway).
    I am having trouble with some of the methods as they have an input variant type, yet nobody tells me what the format of the variant is. As an example I give you this VI which looks to add a caption to a picture. I see the following documentation from Microsoft, which tells me that:
    Documentation for method
    Label
    Type: System.Object
    Required Object. The caption label to be inserted. Can be one of the WdCaptionLabelID constants.
    Title
    Type: System.Object
    Optional Object. The string to be inserted immediately following the label in the caption (ignored if TitleAutoText is specified).
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.range.insertcaption%28v=office...
    - So, I should cast my variant as "System.Object" (?!). I could probably assume that Title is just a simple string, but where would I find that out formally? My guesswork will eventually fail.
    Enum for Caption type:
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdcaptionlabelid%28v=office.15...
    - I've tried casting both as a string and a number, neither work (I would assume an enum is a number, I've tried 0,1,2)
    Any help would be appreciated, even if this may be more Microsoft not documenting their object structure than NI's problem, we're all working towards the same goal! It is possible that there's another mistake as to why this program doesn't run, but I still need the general method...
    Note that you need to have an input file specified to make the program run.
    Thanks for your help,
    Rik
    Solved!
    Go to Solution.

    rik_aspinall wrote:
    4) Great catch on .NET support. The limitation was not well publicized.
    5) Word, Interop, ActiveX, .NET and COM all seem to be things that make this technology work. Moreover, .NET seems like it is trying to keep old technologies going, which is worrying for long term support. The fact that nobody made this easy and well documented as a solution means I'll ask an open question: is this functionality/technology becoming obsolete, and if so, what will replace this, and when?
    Thanks to tyk007 and bob for your help!
    Rik
    Performing COM Interop in LabVIEW is time-consuming for a number of reasons - mostly due to the architectural design of many COM components. Well designed components are loosely coupled but this often means many calls on many objects - many of which often have optional parameters. My suggestion is to use a .Net asembly if wrapping to LabVIEW is required. It's not that it's not possible to implement directly in LabVIEW (it obviously is) but you need a lot of infrastructure in your code to ensure that you don't loose that same coupling or, more importantly, readability in your own LabVIEW extension.
    In your scenario I would ask myself : Is this interface I am building a long term solution or code that I am likely to change often? If yes, then you could encapsulate the COM Interop calls and effectively create a Facade that provides the end user (eg. LabVIEW) the functionality that you need via a determined interface without exposing the changeable parts (the COM Interop). However you need to be comfortable creating said .Net assembly which can be daunting if you don't have the experience.
    http://en.wikipedia.org/wiki/Facade_pattern
    As far as future support goes - it's a really, really good thing that .Net is helping to keep these older technologies going. Long term support is becoming an increasing bigger concern for those markets (read - most business rather than consumer solutions) and there are millions of applications out there running right now running at least one of those technologies. This is one of the reasons I recommended to you that a Facade may be the best long term solution - there will always be an Office API. A Facade will always provide the same interface either way, so calling code is unaffected when the way you interface to the API does.
    PS: Windows 8 exposes the core programming framework WinRT which is basically built on ... COM. I cant see it's predecessor going anywhere for many years yet.

Maybe you are looking for

  • How to specify a policy file in a WS client (AXIS2)

    I am trying to access a dot net web service and i want to make use of the policy file they gave me. i read that AXIS2 supports WS-Policy in the client side but i still can not figure out how to tell the client to use the file. I searched thouroghly f

  • When I use my phone as a hotspot I can no longer connect to the Internet on it

    Hi, when I use my phone as a personal hotspot I can no longer use the Internet on it. I know some friends that whilst their phone is set up as a hotspot they can still use the Internet on it, how can I get mine so I can still use the Internet whilst

  • CS4 Web Standard Install Error?

    Hi, Trying to install CS4 Web Standard from the disk on a Windows 7 32 bit system. I ran setup and it immediately started "Checking System Profile" but froze toward the end of the Initialization, after confirming that it was not going to finish out I

  • Ref Cursor Output

    Hi, the I have the following procedure with an ref cursor as an output. CONCERN_ID_PK -- CONCERN_ID_FK -- ECN_ID_PK -- ECN_NO 315 -- 315 -- 87 -- 4711 i must store the values in variable like p_concern_id_pk p_concern_id_fk p_ecn_id_pk p_ecn_no becau

  • R/3 Extraction

    Hi,     If i run the infopackage to extract data from r/3 to bw data is not loaded. In monitor details tab it shows "Application document not posted" and Errors occured in Rfc ". But my r/3 connection is ok. regards, subbu