LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automation Open (CoCreateInstance) with BlackMagic DeckLink frame grabber

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

--
Tomi Maila
0 Kudos
Message 1 of 10
(6,388 Views)

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.

  1. Place ActiveX Container on front panel - rt-click front panel, Containers...ActiveX Container
  2. Rt-click the container and select "Insert ActiveX Object..."
  3. Browse to your ActiveX control and place it in the container.

I attached a simple code snippet too.

 

-cb

0 Kudos
Message 2 of 10
(6,361 Views)
Well, I got it working by err... chaning nothing but reprogramming everything with a different version of LabVIEW. I still don't know why I failed in the first place. Maybe there was a code generation error or linkage error with the ActiveX library.
--
Tomi Maila
Message 3 of 10
(6,355 Views)

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.

 

0 Kudos
Message 4 of 10
(6,352 Views)

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

0 Kudos
Message 5 of 10
(5,974 Views)

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

 

 

 

 

Message Edité par Ficare le 03-19-2010 05:34 AM
0 Kudos
Message 6 of 10
(5,960 Views)

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

 

 

Message Edité par Ficare le 03-19-2010 12:11 PM
0 Kudos
Message 7 of 10
(5,932 Views)

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 !

0 Kudos
Message 8 of 10
(5,928 Views)

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

Message Edité par Ficare le 03-21-2010 06:34 PM
Message Edité par Ficare le 03-21-2010 06:35 PM
0 Kudos
Message 9 of 10
(5,895 Views)

Could one of you please provide an example of a VI that uses the Decklink API?

Thanks!

0 Kudos
Message 10 of 10
(5,516 Views)