06-28-2009 01:25 AM
I am trying to interface BlackMagic frame grabber hardware that has a COM driver. The C++ demos for the driver work flawlessly, but I fail to access the COM components from LabVIEW. The driver is initiated in C++ with
CoCreateInstance(CLSID_CDeckLinkIterator,NULL,CLSCTX_ALL,IID_IDeckLinkIterator,(void**)&pIterator);
As far as I understand the corresponding LabVIEW command should be to use Automation Open with either CDeckLinkIterator or IDeckLinkIterator as automation refnum. However for both refnums LabVIEW returns an error when executing Automation Open: Error 3005 occurred at Automation Open: Object specified is not creatable.
When I look at the demo code provided with the COM driver, there are really two COM commands that are executed before the CoCreateInstance
AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)
CoInitialize(NULL)
Does anyone have a clue why the Automation Open might be failing in LabVIEW but CoCreateInstance is not failing in C++. Is there a possible workaround? I have tested this with both 64- and 32-bit LabVIEW 8.6.1.
Tomi
06-29-2009 07:55 AM
Tomi,
You may need to place your ActiveX control in an ActiveX Container on the front panel and wire that control into the Automation Open vi.
I attached a simple code snippet too.
-cb
06-29-2009 08:07 AM
06-29-2009 08:25 AM
It seems that LabVIEW tries to instantiate the interface IDeckLinkIterator, not the coclass.
That doesn't work. Try to select the coclass (probably CDeckLinkIterator or just DeckLinkIterator)
from the "Select ActiveX Class" dialog.
The two C++ commands you mentioned just initialize MFC and create the COM apartment.
LabVIEW calls CoInitialize() itself to create the COM apartment and AfxWinInit() is just for initializing
the MFC in C++ so probably these commands don't have anything to do with your problem
Interfacing between COM and LabVIEW can really be painful.
Does you frame grabber have a .NET interface? It may be easier to use than the COM interface.
03-18-2010 05:55 PM
Dear Tomi,
I have to write a routine to pilot the Decklink from Teststand, and I find the documentation as well as the examples quite fuzzy.
I try first to do the job in LabVIEW, but some things are quite obscure … For example, I understand that I shoud obtain a reference to the object thru the QueryInterface method of IUnknown , but I don't know where to find this class or ActiveX server … that's the same with CoCreateInstance...
I may help me a lot if you could send me a sample written in LabVIEW. I hope it will be possible for you … thanks in advance !
Phil
03-19-2010 05:30 AM - edited 03-19-2010 05:34 AM
to add some material to my previous post, I join a snippet with the main functions I want to use in the API, with some questions or comments.
Phil
03-19-2010 12:10 PM - edited 03-19-2010 12:11 PM
Hi,
I made some progress...
I found a response to my first question in the forum, with a link to :
http://digital.ni.com/public.nsf/allkb/6EC98441BFAF93A486256DCD000179A2?OpenDocument
so the solution of this problem is in snipet decklink1
My remaining problem is about the configuration of the callback. It doesn't seem to work like in LV examples, or forum examples, as I cannot reference my callback VI as the callback function, and I get no event in the 'register for event' node.
Phil
03-19-2010 12:25 PM
here is a snippet about my problem with the callback registration (I put it in a desactivated structure to avoid LV crashing when creating the snippet).
Phil
PS : you can send me your comments during the week-end, I will read them with pleasure !
03-21-2010 06:33 PM - edited 03-21-2010 06:35 PM
Hello,
It seems it wasn't a good idea to post my question after the previous discussion, that was quite old, so I've open a new discussion on the board .
this way:
http://forums.ni.com/ni/board/message?board.id=170&thread.id=484530
Have a nice end of week-end
Phil
06-11-2010 03:45 PM
Could one of you please provide an example of a VI that uses the Decklink API?
Thanks!