Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Enumerated Types Vs Delphi Records

Status
Not open for further replies.

mattlacey

Programmer
Oct 11, 2001
22
0
0
GB
I'm writing a Delphi(5) app using calls to external DLLs. The sample code provided by the company who produced the DLLs is in VB and some of the calls to the procedures I need involve passing enumerated types as variables.

When trying to make these calls in Delphi I substituted the enumerated types with records, but it is not working.

The problem is not making the cals to the DLLs coz i can call other procedures fine.

Anyone got any ideas?
Does this make sense?
 
Is this because when you call the procedure you get an 'Enumerated Type expected' type of Error, or do you actualy know what the DLL procedures expect?

A Record need not be an enumerated Type, 'enumerated' just means numbered (whole numbers). I dont think this type of procedure will accept any 'Types' you define in your delphi code this may include records.

Someone may correct me here but I dont think you will be able to use anything other that Integer and/or PChar's as parameters for a DLL procedure written in another language. Arrays or Multidimensional arrays of these should be OK as well.

Steve.
 
The procedure was expecting expecting 3 parameters, the first a longinteger, the second a record containing 6 fields and the third a record containing 95! fields.

I have now got the call working, I think it may have been a memory allocation or a casting issue (It wasn't raising any error, just crashing out of the procedure.)

I have now added definitions for each field (including size in the case of strings) and it works OK. I just didn't want to define the different sizes for 101 strings.

Thanks for your suggestion Steve.

matt.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top