Sign in to follow this  
Followers 0
Bench

Autoit And Cdbase

3 posts in this topic

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):

;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]

Share this post


Link to post
Share on other sites



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. :think:


My Programs:Dissolve (Updated 5-30-06)Credit Card Validator (Not created as of yet)Master Lock Combination Cracker (Updated 7-08-07)Go Siteseeing:My Website: - Click HereCyberZeroCool's Website - Click Here

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0