Jump to content

Windows dll type mismatch


doctorfish

Recommended Posts

Hi.

I'm trying to access a dll on a Windows XP system. (PHP 4.3,4.4, and 5.05) The com object is created fine but the when I call a function in the object I get the following error.

Fatal error: Uncaught exception 'com_exception' with message 'Parameter 1: Type mismatch. ' in W:\www\comtests\whoareyou.php:12 Stack trace: #0 W:\www\comtests\whoareyou.php(12): com->Load(Object(variant), Object(variant)) #1 W:\www\comtests\whoareyou.php(24): LoadClient('') #2 {main} thrown in W:\www\comtests\whoareyou.php on line 12

Here's the code:
[code]
function LoadClient($uid){
  $UserID = new VARIANT($uid);
  $d=0;
  $ID = new VARIANT($d);
  
  $objClient = new COM("ClientMTS.ProfileHdr") or die("Cannot create ClientMTS object.");

  $objClient->Load($ID,$UserID); // this is line 12

  $profID=trim($objClient->ProfID);
  $fname=trim($objClient->FirstName);
  $lname=trim($objClient->LastName);
  unset($objClient);
  
  return array($profID,$fname,$lname);
}
[/code]

If I set the variables within the function call I get this error:

Fatal error: Cannot pass parameter 1 by reference in W:\www\comtests\com_return.php on line 12


And changing to PHP 5.1.1 with an xampp install gave me this:

PHP Uncaught exception 'com_exception' with message 'Error [0x80020003] Member not found

This is the first time I've tried to access a dll with COM and I don't know VB (it's a visual basic dll). The VB developer doesn't know PHP but the dll in question does work when called from other VB programs. The dll is registered with the system but this is not the issue as the object is created but craps out when I call the Load function on line 12.

I've been searching onlione for about 4 hours all to no avail so I'm open to any and all suggestions. I don't have access to the VB code at this moment but can probably post it here later if need be.

Thanks.

Dave

Link to comment
Share on other sites

I'm still running in circles in this one.

Anyone using PHP on Windows and having any kind of similar issues?

Anyone know of any sites where I can get more info on using COM objects with PHP. Many sites I've found give a brief description of how to do it but don't offer any advice for what to do when things don't work.

Any help or a point in the right direction is appreciated.

Thanks.

Dave
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.