Solved

Calling A DLL.

Posted on 1997-05-05
2
787 Views
Last Modified: 2012-05-04
Okay, here is an interesting one for someone.  I just got a DLL that handles Video etc... I would like to port the .H to Delphi if someone could point me in the right direction here.  Ready? Here goes?
Part One
What is this in Delphi?
#ifndef _INC_AVICAP
#define _INC_AVICAP
#ifndef VFWAPI
#ifdef WIN32
    #define VFWAPI  _stdcall
    #define VFWAPIV _stdcall
#else
    #define VFWAPI  FAR PASCAL
    #define VFWAPIV FAR CDECL
#endif
#endif
Part Two And this?
#ifdef __cplusplus
#define AVICapSM ::SendMessage  /* SendMessage in C++*/
#else
#define AVICapSM SendMessage    /* SendMessage in C */
#endif  /* __cplusplus */

#ifdef __cplusplus
extern "C" {            /* Assume C declarations for C++ */
#endif  /* __cplusplus */

#ifndef RC_INVOKED
#pragma pack(1)         /* Assume byte packing throughout */
#endif  /* RC_INVOKED */

#ifndef RC_INVOKED
Part Three And this?
#define capDriverConnect(hwnd, i)                  ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (WPARAM)(i), 0L))      

And this?
typedef LRESULT (CALLBACK* CAPSTATUSCALLBACK) (HWND hWnd, int nID, LPCSTR lpsz);
And finally the most important one This
HWND VFWAPI capCreateCaptureWindow (
        LPCSTR lpszWindowName,
        DWORD dwStyle,
        int x, int y, int nWidth, int nHeight,
        HWND hwndParent, int nID);

BOOL VFWAPI capGetDriverDescription (WORD wDriverIndex,
        LPSTR lpszName, int cbName,
        LPSTR lpszVer, int cbVer);
I don't know C but if someone would translate that for me I will be able to translate the other 200 calls myself.
Is a typedef struct  a Record?
Thanks, and if anyone knows a good online reference for this I would appreciate it.
Note: Once I'm done translating I can e-mail the translated header and SDK.
Okay thanks.  Please send to:
doreen_harrison@bc.sympatico.ca
There are a few of using one email address but I will get it.  Can you send some examples too?  Do you have any other video capture stuff? Like load the driver etc...? That would be great to get that code.  I'm looking forward to seeing it! It will be a great learning tool.  Thanks.
0
Comment
Question by:Jeremy Shorte
2 Comments
 
LVL 3

Accepted Solution

by:
mheacock earned 200 total points
ID: 1335916
Sounds to me like you are trying to convert the Video for
Windows .H to Delphi.  If you are trying to convert the
VfW1.1 .H (16 bit), I have already done this and would be more
than willing to send you the files.

If you need the 32 bit VfW, then perhaps the 16 bit will
point you in the right direction.

As for the defines...you can't translate them directly.  You
have to translate as you see them in the C code.

In Part one those defines are for whether the .H is compiled
as 32-bit or 16-bit.  Convert for which ones you need.

Also the part three is a C macro...you can't translate this
directly...you either ignore it (what I usually do) or
create a Delphi proc/func to handle it.

Typedefs are records.

As a bonus:

  function capCreateCaptureWindow(lpszWindowName: PChar; dwStyle: Cardinal; X, Y, nWidth, nHeight: Integer; hwndParent: Handle; nID: Integer): Handle; stdcall;

BOOL...I can't remember but it is either Boolean or WordBool...
you'll have to check the WINDOWS.H to see how it is defined and
choose an appropriately sized Boolean in Delphi.

Anyhow, if you want the converted VfW .H for Delphi 1.0 (but should prove useful if you have VfW 32 bit), just reply here with
your e-mail address.
0
 

Author Comment

by:Jeremy Shorte
ID: 1335917
Edited text of question
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question