> -----Original Message----- > From: Andrew Ballard [mailto:aballard@xxxxxxxxx] > Sent: Monday, February 09, 2009 10:30 AM > To: Dan Shirah > Cc: Phpster; PHP-General list > Subject: Re: Using DLL with PHP > > On Mon, Feb 9, 2009 at 11:10 AM, Dan Shirah <mrsquash2@xxxxxxxxx> > wrote: > >> > >> Check out the com [www.php.net/com] functionality > >> > >> Bastien > >> > > Alrighty, I'm trying to use the COM function, but not getting much of > > anywhere. > > > > This is what I have: > > > > <?php > > // The VB function for reference > > /*function DTM_CONVDMSToMultiTIFF Lib "D32_CONV.DLL" _ > > (ByVal FullPathFrom As String, ByVal FullPathTo As String) As > Integer*/ > > > > //Create a function in PHP to call the DLL > > function DMStoTIFF() { > > $my_com = new COM('D32_CONV.DLL'); > > $output = $my_com->DTM_CONVDMSToMultiTIFF("C:\TEST\04186177.dms", > > "C:\TEST\04186177.tiff"); > > } > > DMStoTIFF(); > > ?> > > > > But I am getting the error below: > > > > *Fatal error*: Uncaught exception 'com_exception' with message > 'Failed to > > create COM object `D32_CONV.DLL': Invalid syntax > > > > Any ideas? > > > > I can't help much, but this might get you started. > > 1) Does the DLL you are trying to use actually supports COM. I know > some don't. > > 2) I'm pretty sure that the string you pass to new COM('...') should > be the name the class as registered with Windows, not the actual file > name. They are usually something like 'Scripting.FileSystemObject', > 'word.application', 'ADODB.Recordset', etc. I believe you can also call it by its Public Key Token (a GUID), though that may be a new convention introduced with the .NET framework that is not backwards-compatible with "plain" COM objects... // Todd