Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

using video with Fortran

NSwindale
New Contributor I
1,712 Views

I would like to write a program that can access a video device (e.g .a webcam). That means calling functions in vfw.h. Is there an interface module?

For example,  the line:

case (ID_FILE_VIDEOCAPTURE)
   hWndC=capCreateCaptureWindow('My Capture Window'C, IOR(WS_CHILD,WS_VISIBLE), 0, 0, 160, 120, ghwndClient, nID)

gives an unresolved external symbol error.

I have tried various USE statements to no avail e.g. USE IFWINTY  and USE IFPORT

 

 

Thanks,

NickS

 

 

 

 

 

Labels (2)
0 Kudos
14 Replies
andrew_4619
Honored Contributor II
1,690 Views

Avicap32/Vfw does not exist in the Fortran include modules. You will need to create your own interfaces.

0 Kudos
NSwindale
New Contributor I
1,629 Views

Thank you!

I am wondering how one finds out which modules to use for which functions other than just trying - or wading through the modules themselves. 

0 Kudos
Steve_Lionel
Honored Contributor III
1,660 Views

Here's an interface to this routine - you may need others. You'll want to USE this module, add to it as needed.

 

 

module Vfw32
use IFWINTY
implicit none

interface
function capCreateCaptureWindow (lpszWindowName, dwStyle, x, y, nWidth, &
  & nHeight, hwndParent, nID) bind(C,name="capCreateCaptureWindowA")
import
!DIR$ ATTRIBUTES STDCALL :: capCreateCaptureWindow
integer(HANDLE) :: capCreateCaptureWindow
character, dimension(*), intent(IN) :: lpszWindowName
integer(DWORD), value, intent(IN) :: dwStyle
integer(DWORD), value, intent(IN) :: x, y, nWidth, nHeight
integer(HANDLE), value, intent(IN) :: hwndParent
integer(DWORD), value, intent(IN) :: nID
end function capCreateCaptureWindow
end interface
end module Vfw32

 

 

0 Kudos
NSwindale
New Contributor I
1,629 Views

Thank you very much - most helpful. I'll also check for updates re. the next message.

0 Kudos
Shiquan_Su
Employee
1,636 Views

The code example here has been passed to the proper group for further work.


0 Kudos
Steve_Lionel
Honored Contributor III
1,612 Views

Look up the documentation of the function on Microsoft's site. For example,  capCreateCaptureWindowA function (vfw.h) - Win32 apps | Microsoft Docs

 

Towards the bottom of the page, look to see which Library it is defined in. For example:

Steve_Lionel_0-1653595488271.png

Here we see it is in library Vfw32.lib. If Intel provides a module for this, it is the same as the library name, VFW32 in this case. But that module is not in the Intel set. 

You can, of course, always search the compiler's Include folder for the name of the routine you want to see if there's a hit.

During my time at Intel, I did a LOT of work on the Windows API modules, updating some and creating some new ones when I saw requests. I don't recall ever seeing this library come up before.  Creating and updating these modules is a lot of hard work, and Microsoft adds new APIs faster than I could add them to modules. Before I retired, I managed to get KERNEL32 mostly up to date, with changes in USER32 and some others.

 

0 Kudos
NSwindale
New Contributor I
1,590 Views

Over the years I have come to appreciate the huge amount of work that must have gone into making so much of the Windows API accessible to Intel Fortran programmers. It has always been there when I needed it and it has enabled very many useful things (except until now - and I don't mind having to write a few interface routines having seen an example). Thanks so much - enjoy your retirement.

0 Kudos
Steve_Lionel
Honored Contributor III
1,612 Views

I just realized that I messed up the module I created for you by omitting the value attribute where it was needed. I have edited the reply above.

0 Kudos
mfinnis
New Contributor II
1,603 Views

For what it's worth, this is a module I used when I did some video stuff a few years ago.

NSwindale
New Contributor I
1,590 Views

That could be very useful - I will try it.

Thanks,

Nick

0 Kudos
Ron_Green
Moderator
474 Views

We can add this Interface.  But we need a good sample or testcase to see if it works.  Does anyone have a small-ish sample code?

thanks

 

Ron

0 Kudos
Steve_Lionel
Honored Contributor III
417 Views

Ron, I'm not sure what brought you back to this thread, but if you were to do something here it would be to add a module defining everything in vfw.h, which is quite a lot.

0 Kudos
Ron_Green
Moderator
415 Views

and would require a lot of tests to insure quality and no regressions.  

We have a Feature Request based on this thread for this specific interface.  I think we can close it as 'wont fix' or morph it into a FR for a vfw module.  

0 Kudos
NSwindale
New Contributor I
393 Views

I think I am the person who started this thread some years ago. I just checked and found that I ended up using the code link sent by mfinnis above to create a VFW32 module. It contained what I needed - that may be enough at this point and the thread can be closed as far as I am concerned.

Belated thanks!

 

 

0 Kudos
Reply