StooJ Posted August 23, 2007 Share Posted August 23, 2007 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 ) Link to comment Share on other sites More sharing options...
Zedna Posted August 27, 2007 Share Posted August 27, 2007 - 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() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
martin Posted August 28, 2007 Share Posted August 28, 2007 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. Link to comment Share on other sites More sharing options...
piccaso Posted August 28, 2007 Share Posted August 28, 2007 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 Link to comment Share on other sites More sharing options...
StooJ Posted September 11, 2007 Author Share Posted September 11, 2007 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 againHISTORY_DLL.pdf 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