Jump to content

how can i use dllcall with this dll?


zerozha
 Share

Recommended Posts

dllcall is not really hard. Do a search for dllCall and you'll get heaps of examples.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

How can I get the functions in this DLL, and the parameters ?

They should be defined in the .h file.

//Edit: I made some examples:

; PPDB_TYPE __stdcall PdbOpen(TCHAR *  szFilePath,const Char *nameP, UInt32 creator, UInt32 type,BOOL bWrite);

$pdblib_dll = DllOpen("pdblib.dll")

$result = DllCall($pdblib_dll, "ptr", "PdbOpen", "str", $szFilePath, "str", $nameP, "uint", $creator, "uint", $bWrite)
; The return value is stored in result[0]:
$PPDB_TYPE = $result[0] ; it is a pointer to a PDB_TYPE structure

; the structure definition: 
#cs
typedef struct _51pda_PDB_type
{
    DatabaseHdrType dbHeader; //Êý¾Ý¿âÍ·
    LocalID         curOffSet; //µ±Ç°ÎļþÆ«ÒÆ
    LocalID         RecOffSet; //¼Ç¼ƫÒÆÁ¿
    AppInfoType     AppInfo;  //Ó¦ÓóÌÐòÐÅÏ¢
    BOOL            bWrite;     //¶Á»¹ÊÇд
    FILE *          fp;     //ÎļþÖ¸Õë
    FILE *          fpTemp; //ÁÙʱÎļþÖ¸Õë
    UInt32          ulFileSize; //
    UInt32          ulUniqID;  //Ψһ¼Ç¼ºÅ
    TCHAR szTempFileName[MAX_PATH]; //ÁÙʱÎļþÃû
    BOOL            bHaveAppInfo;
}PDB_TYPE,* PPDB_TYPE;
#ce

Func _PDB_SIZEOF($StructureTag)
    Return DllStructGetSize(DllStructCreate($StructureTag,1))
EndFunc

; This structure needs two other structures. You have to create their Tags first. 
;   $tagDatabaseHdrType -> the definition for DatabaseHdrType
;   $tagAppInfoType     -> the definition for AppInfoType
Global Const $tagPDB_TYPE = "byte   dbHeader[" & _PDB_SIZEOF($tagDatabaseHdrType) & "];" &  _ ; this is a struct in the struct. reserve the space for it
                            "DWORD  curOffSet;" & _ ; LocalID is defined as DWORD
                            "DWORD  RecOffSet;" & _ ; LocalID is defined as DWORD
                            "byte   AppInfo[" & _PDB_SIZEOF($tagAppInfoType) & "]; " & _ ; this is a struct, too. reserve space
                            "int    bWrite;" _ ; a BOOl is in fact an int
                            "ptr    fp;" & _ ; a pointer to a file structure == a file handle
                            "ptr    fpTemp;" & _ ; again a file handle
                            "UINT   ulFileSize;" & _ ; unsigned integer
                            "UINT   ulUniqID;" & _ ; unsigned integer
                            "CHAR   szTempFileName[260];" & _ ; a string with MAX_PATH = 260 characters
                            "int    bHaveAppInfo;" ; a BOOL, in fact an int

; create the struct on the returned pointer if you want to get some information out of it:
$ReturnedStructure = DllStructCreate($tagPDB_TYPE, $PPDB_TYPE)

MsgBox(0,"Tmep file Name:", DllStructGetData($ReturnedStructure, "szTempFileName")

; Get information from AppInfo:
$AppInfoStructure = DllStructCreate($tagAppInfoType, DllStructGetPtr($ReturnedStructure, "AppInfo"))
MsgBox(0,"last unique ID", DllStructGetData($AppInfoStructure,"lastUniqID"))
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

  • Moderators

There is a dll file named pdblib.dll

how can I use dllcall with it ?

I don't know the function,parameter, variables in this dll file.

can somebody tell me about this?

You don't.

P.S. Do not start multiple threads on the same topic matter. Merging with original post.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...