LabView interface with DLL that uses ActiveX

I've written a DLL using Microsoft Visual Studio 2005. This DLL uses ActiveX (MSXML4.0). It works fine being called from other applications created in Microsoft Visual Studio. It crashes being called from LabView 7.1. By commenting out everything, I've figured out that it crashes on the call to ActiveX (no problems if this call is commented out). What should I do to make it work?
I've tried using CoInitialize at the initialization of DLL; it didn't solve the problem.
Additional information: DLL is using MFC in a Static Library, not using ATL, Character set = Not Set.
The functions are defined in C calling convention (not __stdcall).
Please help.
Thank you.
Irina Kaliniouk

Thank you for your answer, but that is not the case. There is no UI in this DLL, but it is using some convinenient MFC classes, like threads, CString, etc. The threading really was not even involved in the example that crashed. The function that crashed was
selectNodes on MSXML2::IXMLDOMNodePtr. Here is the code:
MSXML2::IXMLDOMNodeListPtr selectNodes (LPCTSTR expression, MSXML2::IXMLDOMNodePtr pStartNode)
CComBSTR quesryBstr (expression);
return pStartNode->selectNodes (quesryBstr.m_str); //_bstr_t(expression));
where the pStartNode was a root node of
MSXML2::IXMLDOMDocument2Ptr m_pXMLDoc;
hr = m_pXMLDoc.CreateInstance ("Msxml2.DOMDocument.4.0", NULL, CLSCTX_INPROC_SERVER);
I commented out really everything except this function, so there was nothing to corrupt the memory or any other problems.  
What can be of a problem?
Thanks.

Similar Messages

  • TrueTime Card and how to interface with dll file!?

    I am trying to interface with a PCI-SG 2U (IRIG) timing card (Used to made by TrueTime, now Symmetricom).  Does anyone have a solution for this card in LV 2009?  
    If not, can anyone give advice on writing code to interface with .dll file?  I am not sure how to pass through the "GENERIC_READ | GENERIC_WRITE" into the function to open the device. The function says to open it is: 
    TT_OpenDevice(boardID, GENERIC_READ | GENERIC_WRITE, &hDevice)
    No clue on how to pass this in.  Can anyone help?
    Thanks - 
    Tom

    Thanks Mike.  I do have the .h file and the sdk information.  I went through and used the Import>Shared Library Tool and was able to find all the header information that way.  I guess that my problem/question is, the documentation says that it is a DWORD to pass as an input, but LabVIEW says it is a uint32.  I guess the real question is, what the heck do I pass in to the dll function?  Should it be the string "GENERIC_READ | GENERIC_WRITE" or something else?
    Thanks - 
    Tom

  • Distributing labview code. Should I use Activex or DLLs?

    I need to allow VB access to my functions. Is Activex really slow? Can I have operator dialogs embedded in dlls? Has anybody ever distributed serious labview code using either?

    Performance-wise I'm not avare of major differences one way or another. The main thing I would consider is the conceptual differences between the two approaches:
    ** With ActiveX you have a seperate program running that you are controlling remotely.
    ** With DLLs you have discrete bits of code that you are linking to from your program.
    Given what you and your users are going to want to do, which model fits the application better? Also, how much work do you want the external code to do?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Passing strings to a LAbVIEW application from Visual-C++ using ActiveX

    Hello all,
    I have built a LabVIEW application with ActiveX server enabled. I can
    start the application, and can read and set simple control values like
    numerics.
    But now I want to pass (SetControlValue) strings and read (GetControlValue) strings from controls.
    After searching a whole day for examples or HowTos I found nothing. Can
    anyone give me tip where I can find something about that?
    Examples are also appreciated.
    Best regards
    Heinrich Eidloth

    The problem you are running into is that a BSTR is not a normal string (%s in the printf), but a wide character string (i.e., two bytes per character) string with the size stored in it. If the string contains ASCII characters, such as Hello World, then the one of the bytes per character is 0 (for example, 'H' would be 0x48 0x0).
    When printf sees this, it thinks that it is a normal, null terminated string of "H". That is what you are seeing. You might try the %S (capital S) since that tells it the string is a wide character string.
    Also note that BSTR's are part of the COM (Automation) system and so are don't freed with a delete or free() statement. Instead you need to release the memory with a SysFreeString() call.
    If you aren't very familiar with C/C++, then you've taken on an advanced topic on top of a complicated language. If you can, you might want to try using either VB6 or .NET (C# or VB.NET). Those languages handle all of this for you automatically and you don't have to worry about freeing the memory.
    If not, the book I started with to learn COM programming was this one (http://www.amazon.com/gp/product/1572313498/104-3574382-6511132?v=glance&n=283155&n=507846&s=books&v...).
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • Labview interfacing with a multiplexer

    Hello,
    I would just like some help with figuring out how to set-up Labview to interface with a multiplexer. On my  ciruit board, I have an eight channel multiplexer which is connected to eight different-value resistors. What I would like is that on my front panel, there should be an drop-down control that allows the user to select any resistor that is connected to the multiplexer. So basically, Labview should be able to send binary information to the multiplexer, which would then select the appropriate resistor. I am fairly new with Labview and don't know how to go about this problem. Any suggestions will be appreciated.
    Thanks

    Hi,
    All the adress and enable inputs are TTL compatible  (the multiplexer that I'm using is the ADG608 from Analog Devices) and I am currently using the NI PCI-6036E/BNC-2110 starter kit. So, is there a way to implement the interface using this DAQ device? Can I use DAQmx to create a channel just as I would for a normal voltage signal? But I'm not sure how the interface will communicate with the multiplexer.
    Thanks

  • Labview interface with wireless camera

    Has anyone interfaced labview with a wireless webcamera? I have an application that needs to interface my existing labview program with a wireless webcam (802.11b) to monitor a certain space and display live video on the main labview screen.
    Thanks in advance.

    kmoorthy76107 wrote:
    > Has anyone interfaced labview with a wireless webcamera? I have an
    > application that needs to interface my existing labview program with a
    > wireless webcam (802.11b) to monitor a certain space and display live
    > video on the main labview screen.
    > Thanks in advance.
    Most probably your webcam comes with drivers for Video for Windows (VfW)
    or DirectX. In that case you can just use:
    Irene He's IVision Toolkit:
    http://www.hytekautomation.com/Products/ IVision.html
    or
    Pete Parentes WebCam library:
    http://www.cs.unc.edu/~parente/labview/ index.shtml
    The first is a rather impressive Video Manipulation library with a
    nice video capture interface to DirectX/VfW too, and the second is a
    simple video capture library to access any VfW compliant
    device.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Labview interface with micro contoller

    i am new to labview. I need to know whether DAQ card is needed to interface with micro controller? if no need then any one can you explain how to inter face microcontroller 89c51 with Labview...... if needed then explain how to interface?
    JAGADESAN ASOKAN
    J@G@De5@N
    Solved!
    Go to Solution.

    In general, no, you don't need a DAQ, because in your case, the uC is the DAQ. Your challenge is to set up an interface between the computer and the uC (whether using LabVIEW or anything else).
    In my opinion, the easiest way to accomplish that is to set up a serial interface with the uC, and use LabVIEW to control / read the uC serially using VISA. This would require the least amount of hardware and least cost. I2C, if available, is also a way to go if you have the interface.
    Richard

  • Step by step Labview interface with XBee

    Hey,
    Im currently trying to interface my XBee modules with Labview. I have read the other posts on this subject and have not been able to link my XBee and Labview. I am very new to Labview and would be great to recieve more detailed and descriptive steps on this. Eventually I am going to connect Labview to an Arduino Fio, using two XBee. However for now all I need is successfull interface between labview and XBee. I need to send a signal, recieve it in labview, and send something back. 
    I am using USB explorer boards for connecting XBee's to my computer. I have alraedy configured XBee's using moltosenso network manager (same as XCTU). I cant get VISA wizard to see the USB port. 
    If anyone can explain thoroughly how to interface XBee to labview it would be great! thanks.

    Hello Theguat,
    Thanks for posting at NI forums! I’m linking some discussion forums and information on interfacing Xbee with LabVIEW.
    http://forums.ni.com/t5/LabVIEW/Xbee-using-labview/m-p/739214?requireLogin=False
    http://forums.ni.com/t5/LabVIEW/How-to-send-signals-through-XBee-connected-in-USB-port/m-p/2135382
    http://forums.ni.com/t5/LabVIEW/Connecting-labview-to-xbee/m-p/1070547?requireLogin=False
    https://decibel.ni.com/content/thread/15238
    https://decibel.ni.com/content/thread/10814
    Best Regards,
    Alina M
    Applications Engineering
    National Instruments

  • Calling test sequence from CVI DLL that use ATL COM object does not work

    I am trying to call some DLL function writen in CVI from teststand. The CVI DLL is using ATL COM object(Written by me).
    The ATL COM object making instance of several ATL COM object inside it (including two controls that contains dialog). If I use a client writen in VC++ 6 and use the ATL COM (writen by me) works perfectly. But if I try to use it from CVI DLL it does not work any more.
    What is wrong? The client is passing an IUnknow interface to my component. Can anybody explain me what is wrong?

    It is not clear from your question as to what is specifically failing. If possible, one option would be to remove TestStand from the picture and see if the problem still occurs using a CVI EXE that invokes the CVI DLL.
    Scott Richardson - NI
    Scott Richardson
    National Instruments

  • XI interface with third party using Java API

    Hi All,
    We have the following requirement:
    XI needs to interface with an external third party system which has JAVA API capabilities and the corresponding JAR files available to us.
    I have seen a few threads where it was mentioned that we could call the Java methods directly in User Defined functions:
    Process Integration (PI) & SOA Middleware
    My question: Is this approach feasible in our scenario? Also I guess we do not need to configure any adapter for this Java Method call within the UDF.
    Your help will be greatly appreciated and rewarded.
    Regards,
    Jai.

    Thanks Stefan.
    Our requirement has slightly changed. We have installed a thirdparty application on XI Server (within our network , inside filrewall). The application with Java API Jar file. All it does is a Lookup and retruns a value.
    We are planning to import the Jar file into imported Archives and call the method within a UDF.
    Is this feasible? I am going to give it a try.
    Your expert comments are greatly appreciated.
    Thanks
    Jai

  • Reports 6i with buttons that use the rwrun depreciated functionality

    I have several reports that drill down to other reports.
    I understand that this functionality has been depreciated with the Oracle Reports 10gr2.
    How do I code hyperlinks to perform this same type of function - displaying the first report in PDF and then having the user mouse over and click the link so that a second report will display... I would like to use PL/SQL to code the links...
    This was the code from the button that I was using previously to perform this task... (FYI - we generate our reports in French and English)
    begin
    -- Run the Service Requisitions for Service report
    SRW.RUN_REPORT('report='||:p_path||'FCS707.rdf'||' destype=preview desformat=default paramform=no'||' p_service_id='||:p_service_id ||' statuscd=0'||' p_dialect_cd='||:p_dialect_cd||' p_path='||:p_path);
    EXCEPTION
    WHEN SRW.RUN_REPORT_FAILURE THEN
    IF :p_dialect_cd = 'ENGLISH' THEN
    SRW.MESSAGE(2,'Error Running Report.');
    ELSE
    SRW.MESSAGE(2,'Erreur à l'||''''||'exécution du rapport');
    END IF;
    end;
    I have about 16 reports that use this functionality and need to find a work around ASAP. As part of our conversion effort, we are now generating our reports to display a PDF document within a browser.
    Thanks in advance
    Darla

    Darla
    You should be able to do something like you are doing in the srw.run_report, assuming you have the reports server running. You will choose a field or item to be your hyperlink on the first report. Give that item a format trigger like:
    function F_cFormatTrigger return boolean is
    begin
      srw.set_hyperlink('http://my_repserver:7777/reports/rwservlet?report='||:p_path||'FCS707.rdf'||'&destype=cache&desformat=pdf&paramform=no& p_service_id='||:p_service_id ||'&_status_cd=0'||'&p_dialect_cd='||:p_dialect_cd||'&p_path='||:p_path);
      return (TRUE);
    end;You can make the reports server call dynamic also, but I have made it a static, i.e. http://my_reportserver:7777

  • Green screen with videos that used to open

    I just updated to the new creative cloud, which also caused me to have to install quick time in order to import video layers into photoshop as I was trying to edit videos. Now some videos that used to import perfectly fine now import a single green layer and if you try to play the video in photoshop it only plays sound, with no acknowledgement it should be playing video

    I don't know how old the videos or the converter is, however a few years ago and that maybe generous both Microsoft and Apple had an mp4 format and they were not compatible with each other. Eventually Apply won because of the h.264 codec. It was better quality and compressed better.
    If it plays in other programs, then the codec has to be there in one form or another. It could be that quicktime uses it internal codecs and photoshop is looking for those installed on your computer. (guessing)
    There use to be a small program that would read a video file and tell you what the codec is. I don't recall the name at the moment but a quick search on download.com by cnet should provide a link if it is still available and for your current computer. (whether it has been updated or not)
    On the same site, you can search for codecs. Be wary installing them, not all are up to par. There are some people who have other intentions for the codecs than what they were written for. Some require that the codecs be used for personal use only unless you pay them a fee which could be a high amount in some cases.
    Use google and bing to search the author to see if there are any complaints.
    However if you are able to convert them to another format, then go ahead as long as it works and you don't have to deal with con-artists and high fees.
    That said, it doesn't happen all the time, but it does happen I have read complaints about it.

  • I have an application that uses ActiveX containers and today, when I opened it, they were empty.

    Yesterday everything was o.k but today the containers appear empty (there must be a treeview in one container and a CWGraphControl in another). Misteriously the Run arrow isn´t broken, and the property and invoke nodes are o.k. The problem is only in the front panel.
    I'm working with LabVIEW 6.0.2 on a win NT machine.
    Thanks in advance

    I don't have an answer but I can also confirm that 6 developers I know have seen similar behavior.
    I am generating ActiveX objects through VB and inserting them into LabVIEW 6.0.2 on Windows NT. About once every couple of weeks or so, upon inserting the object into the container, the container is empty after the insertion is done.
    It should be noted that the objects inserted have been used sucessfully for weeks on end without modification or incident. Also, after this problem occurs NO other ActiveX object can be inserted or even exist on the Panel of LabVIEW 6.0.2.
    I have seen this bug in LabVIEW 5.1.1 and I have talked to other people at the advanced uses group meeting (LAVA) (Mt. View office - Bay area) that have experienced a very similar problem to
    this.

  • Labview interfacing with NI cDAQ-9172

    I currently have access to a NI cDAQ-9172 with a NI-9205 AI input
    board and a NI-9481 relay control board. I basically have the DAQ
    Assist tools for the analog inputs and the relay outputs, however, I'm
    having trouble interfacing them together, such as if the two analog
    outputs are above x Volts, turn on the relay control; otherwise, turn
    it off. Do I need to create a task for a specific DAQ Assist tool in
    order to control the behaviour of the relay outputs based on the
    analog inputs?

    Hello Stanley,
    Let me try to address your questions in order:
    1. LabVIEW gives you the ability to program several design patterns
    including Finite State Machine, Master/Slave and Producer Consumer.
    LabVIEW even provides templates for these design patterns, which you
    can create by going to the File menu and selecting New.... The image below shows where you can select from the different design pattern templates.
    For more information about the state machine design pattern specifically, I would recommend that you examine this tutorial.
    2. I believe the "DAQmx Tools" you referred to are the DAQmx sub-VIs in
    the DAQmx sub-palette. You must use the inputs (controls) and outputs
    (indicators) to configure these VIs, there is no pop-up menu like there
    is for the DAQ Assistant. However, you are able to generate the sub-VIs
    from a configured DAQ assistant using the right-click menu, as shown in
    the diagram below. This would allow you to configure your NI-DAQmx operation with the pop-up window, and then optimize performance using the DAQmx sub-VIs.
    3. Based on the description of your application, I would strongly
    suggest that you consider either the state machine template discussed
    above or the NI LabVIEW Statechart Module. This module is designed to
    give you a higher level of abstraction for complex systems. Since you
    already have a flow chart, it seems that it would be pretty easy to
    convert that to a statechart to programmatically implement it. You can
    see a video here on how to implement state machines in the LabVIEW Statechart Module.
    If you have questions about how to architect your program specifically,
    I would recommend that you post to a new forum. You are more likely to
    get better insight and more relevant information on that topic if you
    post a new question that reflects the appropriate topic.
    Message Edited by Matt A on 09-17-2007 07:37 PM
    Matt Anderson
    Hardware Services Marketing Manager
    National Instruments
    Attachments:
    Generate NI-DAQmx Code.JPG ‏16 KB
    Design Patterns.JPG ‏73 KB

  • Access "controls" or buttons on a LabVIEW VI with DLL

    Hello Experts,
    I have a LabVIEW GUI executable file and need to access "control" or buttons on it via another programming lanuguage (Visual Basic .NET) say if the user presses a "EXIT" button on the VB.NET GUI, it goes and clicks the "EXIT" button on the LabVIEW GUI. Is this possible to do using LabVIEW built DLL's ? If not, could you please guide me to the right apprach ?
    Thank you very much for your time !

    Yes, the front panel comes up after my calling but I am not able to access any "controls" or buttons on it. However, if now (after calling) I manually click on this front panel, it works but I want my VB.NET code to be able to do that.
    Our vendor owns the source code and they only provide the executable file to be able to communicate to their mechanical system. We, as a OEM, integrate their mechanical system into our system and provide our end customers with the VB code that controls the entire system.

Maybe you are looking for