Hi guys,
I gotta work with a DLL that need to declare one parameter as structure.
I got a example in delphi and it show this parameter like this
NBioAPI_FIR_PAYLOAD = record
Length : DWORD;
Data : array of BYTE;
end;
After call the dll im suppose to get the info parameter like this:
payload.length
or
payload.data
Thanks of any help
regards,
Diego Imenes
How to declare this dll's parameter
Re: How to declare this dll's parameter
dempty wrote:Hi guys,
I gotta work with a DLL that need to declare one parameter as structure.
I got a example in delphi and it show this parameter like this
NBioAPI_FIR_PAYLOAD = record
Length : DWORD;
Data : array of BYTE;
end;
After call the dll im suppose to get the info parameter like this:
payload.length
or
payload.data
Thanks of any help
regards,
Diego Imenes
Diego, you can create a lib of this dll with the implib command of BCC55 like this and incorporate into you linkeditor list:
implib.exe dll_file.lib dll_file.dll
Peace and lighting!
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Re: How to declare this dll's parameter
JC wrote:dempty wrote:Hi guys,
I gotta work with a DLL that need to declare one parameter as structure.
I got a example in delphi and it show this parameter like this
NBioAPI_FIR_PAYLOAD = record
Length : DWORD;
Data : array of BYTE;
end;
After call the dll im suppose to get the info parameter like this:
payload.length
or
payload.data
Thanks of any help
regards,
Diego Imenes
Diego, you can create a lib of this dll with the implib command of BCC55 like this and incorporate into you linkeditor list:
implib.exe dll_file.lib dll_file.dll
How could this help me? As I said the problem isnt work with DLL the problem is work with a dll that one of the parameters need to be a structure and not just a simple var
do you know structure? here is example how to declare a simple structure in c++
struct person
{
string name;
int age;
};
Diego,
I've never used structure so I can't answer your question directly however, the following might be of help to you:
1. http://www.xharbour.com/xhdn/referenceg ... e&id=19643
2. http://www.xharbour.com/xhdn/referenceg ... e&id=19640
But you'd need to register and login first.
I've never used structure so I can't answer your question directly however, the following might be of help to you:
1. http://www.xharbour.com/xhdn/referenceg ... e&id=19643
2. http://www.xharbour.com/xhdn/referenceg ... e&id=19640
But you'd need to register and login first.
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Diego,
You can create and manage a structure from FWH this way:
or
Please make a search for MEMBER in all FWH PRGs (sources and examples) and you will find a lot of examples.
Anyhow, sometimes is better to directly code it using C language. If you provide an example of use in Delphi, we will help you to convert it to C, that you can use from FWH + [x]Harbour
You can create and manage a structure from FWH this way:
Code: Select all | Expand
STRUCT oMyStruct
MEMBER length AS LONG // 32 bits
MEMBER data AS LPSTR // pointer to a string stored outside the struct
ENDSTRUCT
or
Code: Select all | Expand
STRUCT oMyStruct
MEMBER length AS LONG // 32 bits
MEMBER data AS STRING LEN 100 // 100 bytes inside the struct
ENDSTRUCT
Please make a search for MEMBER in all FWH PRGs (sources and examples) and you will find a lot of examples.
Anyhow, sometimes is better to directly code it using C language. If you provide an example of use in Delphi, we will help you to convert it to C, that you can use from FWH + [x]Harbour
Last edited by Antonio Linares on Tue Aug 19, 2008 4:24 pm, edited 1 time in total.
Thanks Antonio!
Now I'm in doubt with another stuff. How do I declare this parameter in dll code?
Here is the example in Delphi:
DLL declaration
NBioAPI_GetInitInfo = Function(hHandle : DWORD; nStructureType : BYTE ; pInitInfo : NBioAPI_INIT_INFO_PTR_0):DWORD; stdcall;
structure declaration
NBioAPI_INIT_INFO_PTR_0 = ^NBioAPI_INIT_INFO_0;
NBioAPI_INIT_INFO_0 = record
StructureType : DWORD; // must be 0
MaxFingersForEnroll : DWORD; // Default = 10
SamplesPerFinger : DWORD; // Default = 2 : not used
DefaultTimeout : DWORD; // Default = 10000ms = 10sec
EnrollImageQuality : DWORD; // Default = 50
VerifyImageQuality : DWORD; // Default = 30
IdentifyImageQuality : DWORD; // Default = 50
SecurityLevel : DWORD; // Default = NBioAPI_FIR_SECURITY_LEVEL_NORMAL
end;
As you can see my problem is just with the last parameter, that is: pInitInfo : NBioAPI_INIT_INFO_PTR_0
I declared this dll function like this in FWH
DLL32 FUNCTION NBioAPI_GetInitInfo(hHandle as DWORD, nStructureType as BYTE, pInitInfo as ??????) AS DWORD PASCAL LIB "NBioBSP.dll"
how about the last one with "??????" ? I really dont know how to declare the structure type info as a dll parameter.
Although, I''ve more than three functions in this dll with this kind of parameter
Thanks again for anyhelp!
Now I'm in doubt with another stuff. How do I declare this parameter in dll code?
Here is the example in Delphi:
DLL declaration
NBioAPI_GetInitInfo = Function(hHandle : DWORD; nStructureType : BYTE ; pInitInfo : NBioAPI_INIT_INFO_PTR_0):DWORD; stdcall;
structure declaration
NBioAPI_INIT_INFO_PTR_0 = ^NBioAPI_INIT_INFO_0;
NBioAPI_INIT_INFO_0 = record
StructureType : DWORD; // must be 0
MaxFingersForEnroll : DWORD; // Default = 10
SamplesPerFinger : DWORD; // Default = 2 : not used
DefaultTimeout : DWORD; // Default = 10000ms = 10sec
EnrollImageQuality : DWORD; // Default = 50
VerifyImageQuality : DWORD; // Default = 30
IdentifyImageQuality : DWORD; // Default = 50
SecurityLevel : DWORD; // Default = NBioAPI_FIR_SECURITY_LEVEL_NORMAL
end;
As you can see my problem is just with the last parameter, that is: pInitInfo : NBioAPI_INIT_INFO_PTR_0
I declared this dll function like this in FWH
DLL32 FUNCTION NBioAPI_GetInitInfo(hHandle as DWORD, nStructureType as BYTE, pInitInfo as ??????) AS DWORD PASCAL LIB "NBioBSP.dll"
how about the last one with "??????" ? I really dont know how to declare the structure type info as a dll parameter.
Although, I''ve more than three functions in this dll with this kind of parameter
Thanks again for anyhelp!
its solved!
i declared the structure in fwh in this away:
struct info
MEMBER StructureType AS DWORD
MEMBER MaxFingersForEnroll AS DWORD
MEMBER SamplesPerFinger AS DWORD
MEMBER DefaultTimeout AS DWORD
MEMBER EnrollImageQuality AS DWORD
MEMBER VerifyImageQuality AS DWORD
MEMBER IdentifyImageQuality AS DWORD
MEMBER SecurityLevel AS DWORD
endstruct
also i declared the dll
DLL32 FUNCTION NBioAPI_GetInitInfo(hHandle as DWORD, nStructureType as INT, pInitInfo as LPSTR) AS 12 PASCAL LIB "NBioBSP.dll"
calling the function
NBioAPI_GetInitInfo(teste, 0, @info:cbuffer)
and after i could get all information that i need
? info:StructureType,info:MaxFingersForEnroll,info:SamplesPerFinger,info:DefaultTimeout,info:EnrollImageQuality,info:VerifyImageQuality,info:IdentifyImageQuality,info:SecurityLevel
it works fine! thanks antonio
i declared the structure in fwh in this away:
struct info
MEMBER StructureType AS DWORD
MEMBER MaxFingersForEnroll AS DWORD
MEMBER SamplesPerFinger AS DWORD
MEMBER DefaultTimeout AS DWORD
MEMBER EnrollImageQuality AS DWORD
MEMBER VerifyImageQuality AS DWORD
MEMBER IdentifyImageQuality AS DWORD
MEMBER SecurityLevel AS DWORD
endstruct
also i declared the dll
DLL32 FUNCTION NBioAPI_GetInitInfo(hHandle as DWORD, nStructureType as INT, pInitInfo as LPSTR) AS 12 PASCAL LIB "NBioBSP.dll"
calling the function
NBioAPI_GetInitInfo(teste, 0, @info:cbuffer)
and after i could get all information that i need
? info:StructureType,info:MaxFingersForEnroll,info:SamplesPerFinger,info:DefaultTimeout,info:EnrollImageQuality,info:VerifyImageQuality,info:IdentifyImageQuality,info:SecurityLevel
it works fine! thanks antonio
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact: