Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with VFP dll in Excel
Message
 
À
14/01/2001 11:13:14
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00463519
Message ID:
00463630
Vues:
29
I've never done this, but i have had fun looking up 80004005 . So I suggest from ignorance, but:
You might be able to trap a 'provider; error by implementing COMRETURNEORROR() in your DLL's error method. It loads up AERROR(). It may trigger an excel error handler (if excel has one). You do have it hitting the first time! When you get it done, please be sure to share:)

Is oTest being instanced and released each cycle? After Set oTest=Nothing, is there a way to assure that oTest is really 'Nothing'. What happens if oTest instances once and is left open until all the "cName$/oTest.getref()" have completed. Curious if it crashes or allows multiple cName$ cycles when oTest is NOT set to 'Nothing'. Does the task window look any different (Excel vs VFP)?

Someone that knows this stuff may drop by and make it really simple! I'd be interested in seeing how it turns out.

>I have written a DLL using VFP 6.0 SP4. The DLL operates fine in VFP, but I'd like to also use it in, for example, Excel 97.
>
>
>The code I use in VFP to use the DLL is:
>
>oTest = CreateObject("refgen.ref_finder")
>cName = oTest.getref("substanc", "numb", "AZZZD", 1)
>Release oTest
>MessageBox(cName)
>
>The above code runs with no problems, and can be run multiple times without problems.
>
>The code for my macro in Excel is as follows:
>
>Dim oTest As Object
>Set oTest = CreateObject("refgen.ref_finder")
>cName$ = oTest.getref("substanc", "numb", "AZZZD", 1)
>Set oTest = Nothing
>MsgBox (cName)
>
>This works fine when I run it once. However, if I run the same macro a second time I get the following error.
>
>Run-time error '-2147467259 (80004005)':
>
>Automation error
>Unspecified error
>
>The error occurs at the CreateObject line. To get the dll to work again, I have to shutdown and restart Excel.
>
>Does anyone have any idea what this means ? I thought that maybe the object wasn't being destroyed properly, but it seems OK in VFP, and the debugger in Excel shows the value of oTest as being "Nothing".
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform