Click here to Skip to main content
15,886,052 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Greetings. It's me again.

Been trying to solve this thing since almost a month ago. Hope you could give me a hand: I installed Delphi 7, because I need to work in a project for a client. The program is already made by someone else, just gonna need to add new features. It uses third party dlls and works with a SQL Database (of course, that one is also installed in my PC).

My main problem is, when I call one of the dll's, it keeps getting me the "ActiveX can't create component" error. I been searching for a solution, but unfortunately can't find.

Code is long, but I'll put the segment where error ocurrs:

Delphi
procedure TFrm_Ent.Parameters();
var
   cEMP, dEMP, cBAS, dBAS : PSafeArray;

   i : longint;
   s : WideString;
   c : Currency;
   caEMP, caBAS : Smallint;
begin
   SafeArrayAllocDescriptor(1,cEMP);
   cEMP.rgsabound[0].lLbound   := 0;
   cEMP.rgsabound[0].cElements := 15;
   cEMP.cbElements := sizeof(c);
   cEMP.fFeatures  := $0006;
   SafeArrayAllocData(cEMP);

   SafeArrayAllocDescriptor(1,dEMP);
   dEMP.rgsabound[0].lLbound   := 0;
   dEMP.rgsabound[0].cElements := 15;
   dEMP.cbElements := 4;
   dEMP.fFeatures  := $000C;
   SafeArrayAllocData(dEMP);

   SafeArrayAllocDescriptor(1,cBAS);
   cBAS.rgsabound[0].lLbound   := 0;
   cBAS.rgsabound[0].cElements := 15;
   cBAS.cbElements := sizeof(c);
   cBAS.fFeatures  := $0006;
   SafeArrayAllocData(cBAS);

   SafeArrayAllocDescriptor(1,dBAS);
   dBAS.rgsabound[0].lLbound   := 0;
   dBAS.rgsabound[0].cElements := 15;
   dBAS.cbElements := 4;
   dBAS.fFeatures  := $000C;
   SafeArrayAllocData(dBAS);

   Frm_P.Params.GetData(bNum,cEMP,dEMP,caEMP,cBAS,dBAS,caBAS); {error}

   {other sentences}
end;


The error ocurrs when I call GetData (bNum comes from another dll)

When I trace, after error ocurrs it targets to the following segment in System.pas:

Delphi
asm
     TEST   EAX,EAX
     JNS    @@2
     MOV    ECX,SafeCallErrorProc
     TEST   ECX,ECX
     JE     @@1
     MOV    EDX,[ESP]
     CALL   ECX
@@1: MOV    AL,reSafeCallError {here}
     JMP    Error
@@2:
end;


The thing is.... at my boss PC it works perfectly.

What I have tried:

1) Registering/Unregistering dlls
2) Uninstalling/reinstalling SQL Server (using 2008 R2)
3) Changing SQL settings
4) Changing the delphi version (my installer, then my boss')
5) Pasting Delphi's folder from boss' PC to mine to get his setting up
6) Registering/Unregistering MSRDO20.DLL (got version 6.... something). Also tried with the 40 one.
7) Target the ODBC to my boss PC in case it's my data base. Result is worse (cant even open it because user seems to be set as local in the third party dll)
8) Using VirtualBox with Win XP (real OS is Win 10 64)
9) Checking SysWOW64 folder to do propper registrations.
10) Check Windows event log (nothing is shown there....)
11) Checked registry issues with CCleaner...

Nothing of that works. And I dont know what else to do. I only can suspect my problem is either the SafeArray (perhaps a missing DLL aside of the ActiveX one?), or a huge problem in my DB (although it works fine, accesable even in network).

Any help?
Posted
Updated 20-Jun-19 10:19am
v4
Comments
F-ES Sitecore 17-Jun-19 11:38am    
If it works on one PC but not another then chances are your code relies on a COM object that isn't registered on the machine where it doesn't work, just like the message says. Unfortunately there's no real way of knowing what one, it could even be a secondary one so ClassA but call ClassB internally but ClassB isn't registered but ClassA is fine. Does this app have an installer of some kind? If the COM objects used by the app have their own prefix or naming scheme you can use the registry to compare what is installed on both machines (under HKEY_CLASSES_ROOT) to see if anything obvious is missing.
Member 14150748 17-Jun-19 11:51am    
"If it works on one PC but not another then chances are your code relies on a COM object that isn't registered on the machine where it doesn't work, just like the message says." Always though that. A registry missing or something.

"it could even be a secondary one so ClassA but call ClassB internally but ClassB isn't registered but ClassA is fine." Could be. Don't have source code of the dlls, but I know the troublesome one calls another one (gxdata81.dll). Tried to register that one but gave me error because is not a valid COM (regasm neither work)

"Does this app have an installer of some kind?" Nope.

"If the COM objects used by the app have their own prefix or naming scheme you can use the registry to compare what is installed on both machines (under HKEY_CLASSES_ROOT) to see if anything obvious is missing." Not sure about that. How can I check it without the sorce code? I dont have experience with it. And someone suggested me to check registry too, but only found several folderts with weird alphanumerics names.
F-ES Sitecore 18-Jun-19 3:42am    
The classes root contains a child for every COM object installed. So you'll see things like ADODB.Recordset and ADODB.Command in there. There are also tools that you can download that will show you all registered COM objects on the system (VS can actually do this if you add a reference, there is a COM tab that shows that info). It's traditional to give your objects the same prefix (like ADODB above) so if you can find the prefix this app gives to its COM objects you can see if there are any installed on one machine but not the other.

Have a look at the SysInternals suite of tools Sysinternals Suite - Windows Sysinternals | Microsoft Docs[^]. I think the one you want is ProcMon - you will be able to tell what the COM object is trying to access and work out exactly what is missing.

Also ensure that you are using the right version of regsvr32 for the version of Delphi (32 bit is in SysWOW64 which is not usually on the path)
 
Share this answer
 
Comments
Member 14150748 17-Jun-19 12:28pm    
OK gonna try it. About the regsvr I been using both in my win 10, and of course the xp on the VM only has 1 version.

Been checking the DLL's with the dependency walker. It says some dll's are missing but they're related with Win_CORE and such (and they sugest to not try to get them individually). It's weird.

I'll let yuou know how it goes with the ProcMon
Member 14150748 17-Jun-19 12:53pm    
Used the ProcMon. I got a bunch of "NAME NOT FOUND" or "FAST IO DISALLOWED" and "FILE LOCKED WITH ONLY READERS"


Noticed some of the files are related with the registry (InprocServer32, InprocHandler, AppID, etc.) A couple within an OLE folder and even the troublesome dll name, but with a .ini extension.
F-ES Sitecore 18-Jun-19 3:40am    
You probably want something that lets you monitor registry access. To create an ActiveX object it will query the registry to find out where the dlls live etc, and one of those reg looks will be failing as the component you need won't be there.
CHill60 18-Jun-19 4:55am    
Good shout! I've suggested RegMon (which I should have done in the first place :doh:)
CHill60 18-Jun-19 4:55am    
Good call from @f-ES-Sitecore … I should have pointed you at the RegMon tool in the same suite.
I made a small project in C# to test the dll

C#
using System;
using AETK_LIB; // <-- This one

namespace dllTest
{
    class Program
    {
        static void Main(string[] args)
        {
            AUTPARENT params = new AUTPARENT();
            short AV9 = 0, AV17 = 0, AV16 = 0;
            System.Array AV14, AV15, AV12, AV13;
            AV12 = AV14 = AV13 = AV15 = null;
            try
            {
                params.GetData(AV9, AV14, AV15, AV17, AV12, AV13, AV16);
                Console.WriteLine("Done");
            }
            catch (Exception Ex) { Console.WriteLine(Ex.Message); }
            finally { Console.WriteLine("Terminated"); }
            Console.ReadKey();
        }
    }
}


Pasted the gx dlls in SysWow64 folder (they can't be registered because they're not COM), and take a guess....

ActiveX component can't create object

So... for any reason this dll is having troubles at my PC, but not at my boss...
 
Share this answer
 
Comments
Member 14150748 19-Jun-19 15:22pm    
Installed all in my personal PC, to check if was a permission issue, and yet I got same problem (there I have Win 7)

This is getting odd.... Running out of ideas.
Finally solved.

A dll was missing. That one is installed by another application made by the same people who did the one I'm working on. Not sure which one is, I'll try to find out later.


We found out about that error because when my boss was working over an empty virtual machine (XP) he encountered the same problem. Then he remembered that other application.

Thanks for your help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900