sage-portugal / 50c-API

Sage 50c API e eXtensibilidade
11 stars 4 forks source link

Class not registered on running sample #32

Closed Acacia-Jeff closed 1 year ago

Acacia-Jeff commented 1 year ago

Hello, First of all, thanks a lot for your project!

We are trying to run your application in order to understand how the SageAPI works. After downloading the projects, compiling it and running the Sage50c.API.Sample solution, on a click on the “Iniciar API” button, we have this error :

image

After a little debug, it occur on that line, which is the first call to the class of the DLL “S50cAPI22.dll” :

image

To solve this problem, we have tried to register the DLL with %systemroot%\system32\regsvr32.exe, but we have this error, meaning this can’t be registered because the lack of the “DllRegisterServer” entry point :

image

We have also tried to import the dll (both the S50cAPI18.dll and the S50cAPI22.dll) in a blank project, and got the same error “REGDB_E_CLASSNOTREG”. We can see in the next picture that Visual Studio can have access to the class definition in the DLL, but during the running, the class factory can’t be found.

image

Did you had this problem during the development of this solution, or do you know what to do to run it ?

ajteixeira commented 1 year ago

If you have followed all the instruction provided, it seems you don't have Sage 50 Application installed or you have to update it. If this is the case, reach to your partner to get an updated or full version. As a reminder, you need to remove and re-add the references to the interops (located in C:\Program Files (x86)\Common Files\sage\2070\50c2022\Interops) as described in the instructions. Don't forget also to compile in x86.

Acacia-Jeff commented 1 year ago

Thanks for the answer.

I have followed all the steps during the test, but for the step of removing and re-adding the references of the interops, wa haven't found them, probably because we have the Demo version of sage 50 installed. So we used the DLL in the project.

If we have to removing and re-adding the interops, does that means the app can only work on the computer where it's developped on ? Or can it work on another computer with the same version of sage 50 ?

ajteixeira commented 1 year ago

The interops are installed with the application are in the program files folder: C:\Program Files (x86)\Common Files\sage\2070\50c2022\Interops (or C:\Program Files\Common Files\sage\2070\50c2022\Interops, on x86). The Demo version installs the interops.

Which Sage 50 are you using and version? Are you using Sage 50 fromPortugal?

Acacia-Jeff commented 1 year ago

I am using this Demo version : image

In the C:\Program Files (x86)\Common Files\sage\ folder, there is no 2070 folder (and no dll in the other folders) In the C:\Program Files\Common Files\, there is no sage folder

ajteixeira commented 1 year ago

That is the French version. This repository is only related with the Portuguese version. As far as I know, the French version doesn't have a public API you can use. You can however access the database for import/export but you need to contact our colleagues in France to help you.