LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing ActiveX server which generates events

Hi,
I want to create an ActiveX server using LabWindows/CVI 6.0

How can I generate events in the server which trigger a callback in the ActiveX client process ??
0 Kudos
Message 1 of 5
(3,168 Views)
Good question. Our ActiveX Server Creation wizard doesn't support events that can be exposed through COM to the client application. You could implement it yourself with COM programming through the SDK, but we haven't added it to the wizard yet. We only document what our wizard can do and how to do it. Consult the SDK help for how to add events to your server outside of our wizard through SDK functions.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 5
(3,168 Views)
Thank you for a quick answer.

Can you give me a hint of which functions to use or where to look in the SDK help ?
0 Kudos
Message 3 of 5
(3,168 Views)
Sure, I can give you a few hints. Let me start by saying though that this will be several orders of magnitude harder to program that what you are used to with our wizards. Basically, how server events work are they are implemented as a separate interface where the functions are implemented in the client instead of the server. What you would have to do is manually edit the IDL file and add a event interface that is externally sourced. Below you can see an example of the declaration for externally sourced interface _INIDSCtlEvents from DataSocket

coclass CWDataSocket {
[default] interface INIDSCtl;
[default, source] dispinterface _INIDSCtlEvents;
};

Then, the normal way to implement client registration of event handling woul
d be through the IConnectionPoint interface in the SDK. This will take quite a bit of work to implement though and you would probably want different connection points for each event. Alternately, if you are the only one using the server (it doesn't have to be COM standard), you could implement another function in one of your other interfaces that would take in a IUnknown interface pointer from the client and be able to cast and call it.

I don't know how much COM you have done, so my information may not make a lot of sense. If it doesn't, this is going to be quite an arduous process for you since it will require a good COM understanding. I would start by reading about the IConnectionPoint and IEvent interfaces and looking at type libraries of servers that have events to see how they are implemented in the IDL. Also, find a good COM book that covers events.

Another thing to realize is once you've manually edited the IDL and implementation files generated from our server wizard
, regenerating the files from the wizard will remove those edits. So, have a separate copy where you are making the changes.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 4 of 5
(3,168 Views)
Hello Chris,

I have been reading your reply with much interrest.
But could you tell me please if National Instr. will upgrade the wizard, to be able to create events for a server. If yes in what version of Labwindows/CVI?

Best regards,
Rob van Oeveren
NEDAP
0 Kudos
Message 5 of 5
(3,168 Views)