Rizzet Posted October 12, 2008 Posted October 12, 2008 Hi, ive tried creating this dll structure to CDBFAPI.DLL but failed, Could you help me? struct DBF { [...] char *filename; // the name of DBF-file char *filename_memo; // the name of a memo-file (DBT or FPT) char *filename_hdr; // the name of header-file (HDR) struct Header hdr; // the first 32 bytes of header struct Field fld[2048]; // the description of fields char als[2048][32]; // headers of fields int Fieldorder[2048]; // the order of fields struct Options opt; // options unsigned short num_fld; // the number of fields [...] int memo_field; // the current memo-field or -1, // if a memo-fields is not present [...] char *record_block; // pointer to area of reading/writing char *str; // pointer to area of the return of lines char *memo_block; // pointer to memo-fields [...] char *copy_of_record; // copy of record [...] };
monoceres Posted October 12, 2008 Posted October 12, 2008 It's not possible do translate that struct just by looking at it (you need to now how the other structs looks like), but here's some tricks that will be needed: - A struct in a struct means you insert the other struct in the first, so if the declaration say: Struct structa{ int test; int test2; }; Struct structb{ char x; structa info; int age; }; The AutoIt equal is: $structb=DllStructCreate("char x;int test;int test2;int age;") - You cannot declare 2D arrays i a AutoIt DllStruct, however array[32][8] is the same as array[8*32] - char *string means a pointer to a char array that holds the string, therefore to store a string when the declaration says char *string you do it like this: $struct=DllStructCreate("ptr ptrtostring;"); Create the struct that has the pointer $string=DllStructCreate("char name[255];"); Creates the string that actually holds the string DllStructSetData($string,"name","Andreas!"); Save Andreas! in the string DllStructSetData($struct,"ptrtostring",DllStructGetPtr($string)); Save the pointer to the string in the first struct Good luck Broken link? PM me and I'll send you the file!
Rizzet Posted October 12, 2008 Author Posted October 12, 2008 Hi, that helped alot.. i will try that and hopefully be more succesfull. If not then i probably have a more clear example Code
Rizzet Posted October 13, 2008 Author Posted October 13, 2008 (edited) I have a new problem, if the return of a dllcall is a "ptr"/pointer of the same struct. How to use it/read it?? Edited October 13, 2008 by Rizzet
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now