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
678 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
10 Replies
andrew_4619
Honored Contributor II
656 Views

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

NSwindale
New Contributor I
595 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. 

Steve_Lionel
Black Belt Retired Employee
626 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

 

 

NSwindale
New Contributor I
595 Views

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

Shiquan_Su
Employee
602 Views

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


Steve_Lionel
Black Belt Retired Employee
578 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.

 

NSwindale
New Contributor I
556 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.

Steve_Lionel
Black Belt Retired Employee
578 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.

mfinnis
New Contributor I
569 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
556 Views

That could be very useful - I will try it.

Thanks,

Nick

Reply