Solved

Calling A DLL.

Posted on 1997-05-05
2
780 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
Comment Utility
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
Comment Utility
Edited text of question
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now