Jump to content
Sign in to follow this  
StooJ

Using dllcall on a xray system

Recommended Posts

StooJ

I'm trying to give an AutoIt script some control over digital imaging software. When I construct a dllcall (which I've never done before, so I may be getting it horribly wrong) I get an @error of 1, which is "unable to use the DLL file"

Can AutoIt use any DLL files, or is it restricted to microsoft-only ones, or ones written a certain way?

If it can handle any dlls, could someone tell me where I'm going wrong or point me in the direction of a beginners guide to DLLs?

There is an example program included with the software, but no hint as to how it works. There is also a pdf detailing the functions contained in a dll file.

This is the section in the pdf associated with the function I'm trying to call:

int nAfficheHistorique(     char *pszPathDir,
                            char * pszImagingSoftwarePath,
                            char *pszPatientName,
                            char *pszFirstName,
                            HWND hWnd,
                            char *pszNumDent,
                            int nPage,
                            int nMaxSel,
                            bool bOpenTW,
                            COLORREF color,
                            bool bListeNomFic,
                            Path *ppListeNomFichier)

                            where Path is defined as:
                    typedef char Path[MAX_PATH] (MAX_PATH is a standard Windows constant).

The code I have put together (it may well be horribly wrong):

DllCall ( "Historique.dll" , "hwnd" , "HistoMultiImgType" , "str" , "F:\Images\1" , "str" , "D:\Program Files\Imaging\Imaging Software" , "str" , "Cooper" , "str" , "Gary" , "hwnd" , 0 , "int" , 5 , "int" , 5 , "long" , 0x0001 , "int" , 5 , "int" , 5 , "str" , "0" , "int" , 0 , "int" , 1 )

Share this post


Link to post
Share on other sites
Zedna

- function name is nAfficheHistorique and not Historique

- you can use "DLL Export Viewer" to view functions inside DLL

- you have wrong parameters at second half of param list

- last parameter is probably pointer to some structure - look at DllSctructCreate() DllStructGetPtr()

Share this post


Link to post
Share on other sites
martin

I'm trying to give an AutoIt script some control over digital imaging software. When I construct a dllcall (which I've never done before, so I may be getting it horribly wrong) I get an @error of 1, which is "unable to use the DLL file"

Can AutoIt use any DLL files, or is it restricted to microsoft-only ones, or ones written a certain way?

If it can handle any dlls, could someone tell me where I'm going wrong or point me in the direction of a beginners guide to DLLs?

There is an example program included with the software, but no hint as to how it works. There is also a pdf detailing the functions contained in a dll file.

This is the section in the pdf associated with the function I'm trying to call:

int nAfficheHistorique(     char *pszPathDir,
                            char * pszImagingSoftwarePath,
                            char *pszPatientName,
                            char *pszFirstName,
                            HWND hWnd,
                            char *pszNumDent,
                            int nPage,
                            int nMaxSel,
                            bool bOpenTW,
                            COLORREF color,
                            bool bListeNomFic,
                            Path *ppListeNomFichier)

                            where Path is defined as:
                    typedef char Path[MAX_PATH] (MAX_PATH is a standard Windows constant).

The code I have put together (it may well be horribly wrong):

DllCall ( "Historique.dll" , "hwnd" , "HistoMultiImgType" , "str" , "F:\Images\1" , "str" , "D:\Program Files\Imaging\Imaging Software" , "str" , "Cooper" , "str" , "Gary" , "hwnd" , 0 , "int" , 5 , "int" , 5 , "long" , 0x0001 , "int" , 5 , "int" , 5 , "str" , "0" , "int" , 0 , "int" , 1 )
Adding to Zedna's comments, the second parameter in your dllcall is "hwnd". This parameter is the return type which is int so you should have "int".

The last parameter looks to me like it is just the complete path to a file. So (if I'm right) you need to pass a string.

$ListPath = "C:\Folder1\QuelQueChose"

$Result = DllCall ( "Historique.dll" , "int" , "nAfficheHistorique",... ......"str",$ListPath)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
piccaso

i think the last parameter is a c-string array.

here is a quick transation

$ListeNomFichier = DllStructCreate("char[250];" & _ ; element 1 (iirc MAX_PATH = 250)
                                   "char[250];" & _ ; element 2
                                   "char[250];" & _ ; element n ...
                                   "ptr;") ; a NULL pointer terminates the list
DllStructSetData($ListeNomFichier,1,"Element 1")

;~ int nAfficheHistorique(     char *pszPathDir,
;~                             char * pszImagingSoftwarePath,
;~                             char *pszPatientName,
;~                             char *pszFirstName,
;~                             HWND hWnd,
;~                             char *pszNumDent,
;~                             int nPage,
;~                             int nMaxSel,
;~                             bool bOpenTW,
;~                             COLORREF color,
;~                             bool bListeNomFic,
;~                             Path *ppListeNomFichier)

DllCall ("Historique.dll","int","nAfficheHistorique", "str", "PathDir", _
                                                      "str", "ImagingSoftwarePath", _
                                                      "str", "PatientName", _
                                                      "str", "FirstName", _
                                                      "hwnd", 0, _ ;hWnd
                                                      "str", "NumDent", _
                                                      "int", 0, _ ;nPage
                                                      "int", 0, _ ;nMaxSel
                                                      "int", 0, _ ;bOpenTW
                                                      "dword", _RGB(0,0,0), _ ;color
                                                      "int", 0, _ ;bListeNomFic
                                                      "ptr", DllStructGetPtr($ListeNomFichier)) ;ppListeNomFichier


Func _RGB($r,$g,$B)
   Return BitOR($r,BitShift($g,-8),BitShift($b,-16))
EndFunc

if you have some example or documentation for the last parameter you could post it.

Maybe it clears it out a bit.


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites
StooJ

Thank you very much for your help, everyone!

I've not got there yet, but you've certainly put me in the right direction.

I've included a pdf about the DLL in question, hopefully it might explain things better than I can.

Many thanks again

HISTORY_DLL.pdf

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.