Solved

Calling A DLL.

Posted on 1997-05-05
2
807 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

631 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