Bench Posted April 27, 2006 Share Posted April 27, 2006 I'd like to user cdbase.dll, but I am doing something wrong and have no clue what goes wrong. Here's my souce code (comments are C source code from CDBase Help): expandcollapse popup;DBHANDLE dbh; ;CDB_TABLE table; ;CDB_COLUMN columns[2]; ;dbh = cdbCreateDatabase("myDatabase.cdb"); // Create the database ;cdbStartTransaction(CDB_WRITING,dbh); // Start a transaction ;columns[0].datatype = CDB_DT_SHORT; // Define the columns ;columns[0].size = 1; ;columns[0].indexed = FALSE; ;columns[1].datatype = CDB_DT_CHAR; ;columns[1].size = 64; ;columns[1].indexed = TRUE; ;table.szName = "MYTABLE"; // Define the table ;table.columns = columns; ;table.nColumns = 2; ;cdbAddTable(&table,dbh); // Add the table to the database ;cdbEndTransaction(TRUE,dbh); // End the transaction and commit changes ;cdbCloseDatabase(dbh); // Close the database $lib = DllOpen("resources\cdbase.dll") If $lib = -1 Then MsgBox(16, "DLL Error", "Cannot open 'cdbase.dll'") Exit(1) EndIf $dbh = DllCall($lib, "ptr", "cdbCreateDatabase", "str", "Books.cdb") TestError(@error, "cdbCreateDatabase") DllCall($lib, "none", "cdbStartTransaction", "int", 0xc0000000, "ptr", $dbh) TestError(@error, "cdbStartTransaction") Func TestError($err, $fce) Local $str If $err = 0 Then Return EndIf Switch $err Case 1 $str = "Unable to use DLL" Case 2 $str = "Unknown return type" Case 3 $str = "Function not fount in the DLL file" EndSwitch MsgBox(16, "DLL Error", $str&@CRLF&"at "&$fce) EndFunc I got 'Unable to use DLL file at cdbCreateDatabase' message. Why? What am I doing wrong? Thx for your help. BTW: If you want to try this database, it's attached. [right]Software is like sex - it's better when it's free. (Linus Torvalds)[/right] Link to comment Share on other sites More sharing options...
techguy86 Posted April 27, 2006 Share Posted April 27, 2006 I have no idea what you're talking about but perhaps you could type the full path to the dll and not just that short bit. My Programs:Dissolve (Updated 5-30-06)Credit Card Validator (Not created as of yet)Master Lock Combination Cracker (Updated 7-08-07)Go Site-Seeing:My Website: - Click Here Link to comment Share on other sites More sharing options...
Bench Posted April 27, 2006 Author Share Posted April 27, 2006 It's not a problem. If the path is wrong, DllOpen would return an error. [right]Software is like sex - it's better when it's free. (Linus Torvalds)[/right] Link to comment Share on other sites More sharing options...
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