Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calling A DLL.

Posted on 1997-05-05
2
Medium Priority
?
810 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 400 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

Technology Partners: 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

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 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