Solved

Calling A DLL.

Posted on 1997-05-05
2
806 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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