Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB EXE calling DLL with CR repeatedly-Invalid Procedure Call

Status
Not open for further replies.

ClarkJeff

Programmer
Feb 28, 2002
46
0
0
US
Help! On Winows 2000 Advanced server, I have a VB6 EXE that can repeatedly call a DLL (which calls CR RDC). The DLL is in COM+ and I can see the object working. If the EXE is repeatedly calling the DLL AND I have another process call that same DLL, I can see the Objects counter increment/decrement, but the EXE yields an error "5-Invallid procedure call or argument" on the (next?) CreateObject. It seems to run ok if the second call isn't made while it's processing.

The EXE is a task that wakes up every minute looking for batch-type work to do. When it finds something to do, it calls the DLL. The DLL is also call from a Web ASP.

I've tried using ObjectContext, thinking maybe it wasn't creating/deleting objects properly, but it doesn't seem to help.

The call to the DLL is currently using a Long and Strings. I think I read to use Variants instead, but the COM+ object count never goes back to 0 when doing that for some reason. The Call Time resets back to 0, but the Object Count doesn't.

After receiving a number of the errors, the process seems to hang and won't work anymore. I currently get around the problem by manually Shutting Down the COM+ Application occassionally during the day. I've also thoroughly checked for memory leaks (missing set x=nothing, etc.)

Below are some snippets of code. Any help is greatly appreciated.

The DLL is set to 5-MultiUse, 1-NoTransactions, 0-NotPersistable.


DLL Code (TestDLL.clsTestDLL)
-----------------------------------------------------------
...
Private objContext As ObjectContext
...
Public Function Submit(strFirmID As String, lngReportHistoryID As Long, Optional strChildAccountNo As String) As String
...
working code here calls CR to generate PDF report
...
set objContext=GetObjectContext()
if lngErrorNumber=0 Then
objContext.SetComplete
else
objContext.SetAbort
end if
...


EXE Code (TestEXE.EXE)
-----------------------------------------------------------
...
Private objProcessReport As TestDLL.clsTestDLL
...
Set objProcessReport=CreateObject("TestDLL.clsTestDLL")
...
strFile=objProcessReport.Submit(rstSites.Fields("FirmID"), rstReportHistory.Fields("cntID"), rstGroupAccount.Fields("AccountNo"))
Set objProcessReport=Nothing
...




The DLL makes a call to Crystal Reports RDC and the error only appears to happen when I use the .Export method (which is always :).

...
crxExportOptions.FormatType = crEFTPortableDocFormat
crxExportOptions.PDFExportAllPages = True
...
crxReport.Export False 'comment out and no errors
...



Any clues?

Thanks.

Jeff Clark
 
Which runtime components version of the RDC: 8.5 or 9?

From the EXE why can't you simply invoke functions in the dll (why do you need to externally instantiate objects)?

Cheers,
- Ido





CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
IdoMillet,
Thanks for the response. I'm using CR9 Developer. The DLL is called directly from Active Server Pages AND from an EXE. The AS pages are on-demand, when the customer chooses to print, the EXE is scheduled to wake up every minute to see if there is work to do, then calls the DLL if there is (batch mode).

I have opened a support issue with Crystal, so will try to post the results here.

Thanks.
Jeff Clark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top