PeterB Posted January 12, 2010 Report Share Posted January 12, 2010 Hi folks, Are there any examples showing how to write a LabVIEW executable which can act as an ActiveX Automation Server and support event callbacks from other languages ? e.g. within say a C# or .NET program, I want to do the reverse of what you see in the LabVIEW example here: C:\Program Files\National Instruments\LabVIEW 8.6\examples\comm\axevent.llb\ActiveX Event Callback for Excel.vi I would like an external client's callback code (accessing my LabVIEW ActiveX automation server) to be executed when I programmatically initiate the event from my LabVIEW code regards Peter Quote Link to comment
PeterB Posted January 13, 2010 Author Report Share Posted January 13, 2010 OK, so rewording my situation and question. I have a LabVIEW program with ActiveX Server enabled. Properties and methods can be accessed fine from other programming languages. (specifically a C scripting language used by Test Complete). How do I fire an ActiveX event from the LabVIEW side which subsequently will cause some callback code to run in the other language. Essentially I want to do the reverse of what you see in the LabVIEW example here: C:\Program Files\National Instruments\LabVIEW 8.6\examples\comm\axevent.llb\ActiveX Event Callback for Excel.vi So instead of the NewWorkbook event coming from Excel causing "NewWorkbookCallback.vi" to run , I will be (programatically) firing my_own_custom_event from my vi causing some code to run in the other language. regards Peter Badcock Product Development ResMed Ltd Quote Link to comment
PeterB Posted January 14, 2010 Author Report Share Posted January 14, 2010 Perhaps what I am trying to do is not possible. If one opens up the example I referred to at [2] , Right Click on the Automation refnum constant and "Select ActiveX Class" "Browse" and navigate to the type library file (*.tlb) created by the LabVIEW Application Builder (for a particular EXE you create - mine is named HelloWorld), you will find it only contains properties and methods - it does NOT contain events. Is that a limitation of LabVIEW ? Can LabVIEW not export events into type libraries ? (at least that is what is suggested in the help file [1]). I don't want to register for events from other applications, I want to register for events from a LabVIEW application (albeit eventually from another programming environment). I cannot seem to build a LabVIEW application which exports events into its type library. regards Peter Badcock Product Development ResMed Ltd [1] Enable ActiveX server—(Windows) Enables the ActiveX server so the application can respond to requests from ActiveX clients. The functionality of the ActiveX server in the application is a subset of the LabVIEW ActiveX server. When you build an application myapp.exe, Application Builder also creates an ActiveX type library myapp.tlb. The type library defines an application class and a virtual instrument class and exports both Application properties and methods and VI properties and methods. When you distribute the application, include the type library with the executable file. [2] C:\Program Files\National Instruments\LabVIEW 8.6\examples\comm\axevent.llb\ActiveX Event Callback for Excel.vi Quote Link to comment
mje Posted January 14, 2010 Report Share Posted January 14, 2010 I've wondered this several times over the years as well and not come up with a solution. Recently I was hoping to find a way to do this in a .NET context, but came up dry. *waits...* Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.