06302257.txt 30-Jun-00


Subject: help - automation server problem
From: correo2000@mailcity.com

Hello,

Are there a problem with automation server excel VO2b4?
when the program quit, excell stay at memory,
The code:
METHOD Start() CLASS App
  LOCAL oExcelApp  AS _APPLICATION
  LOCAL oWorkBooks AS _Workbooks
  oExcelApp := _Application{"Excel.Application"}
  oWorkbooks := oExcelApp:Workbooks
  oWorkbooks:Open("c:\myfile.xls")
  oWorkBooks:close()
  oWorkBooks:= NULL_OBJECT
  oExcelApp:quit()
  oExcelApp:= NULL_OBJECT
  IF !InCollect()
    CollectForced()
  endif
Quit
If I call Ctrl-Alt-Del I can see the excel at memory
How can I solve this?
Thanks for help
Sorry for my english

Nicolasc


Subject: Re: help - automation server problem
From: "Stephen Quinn" <squinn@brutecom.com.au>

Nicolasc

http://www.dejanews.com - comp.lang.clipper.visual-objects
  ng and do a power search for last year or so.
You should find an answer there as it's been covered several
  times over the years.

HTH
Steve Quinn


Subject: Re: help - automation server problem
From: correo2000@mailcity.com

I search at deja news and i found some messages not a real
  solution the best opinion  is a  BARNEY SURATT message
  but, i think is very drastic method the excel dont stay at
  memory with this method but my VOOLE functions go out too,
  how can I reload VO OLE functions after "OleUninitialize"
  function at runtime.
Thanks for new and previous helps.
my code:
  LOCAL oExcelApp  AS _APPLICATION
  LOCAL oWorkBooks AS _Workbooks
  LOCAL LoadHandle AS PTR
  LOCAL oleun AS PTR // OleUnInitialize()

  LOCAL olein AS PTR // OleInitialize()
  Loadhandle := LoadLibrary(;
    String2Psz("C:\windows\system\ole32.DLL"))
  IF (Loadhandle == NULL_PTR)
    ErrorBox{,"Dll no se cargo apropiadamente"}:show()
    quit
  ENDIF
  oExcelApp := _Application{"Excel.Application"}
  oexcelapp:displayalerts:=FALSE
  oWorkbooks := oExcelApp:Workbooks
  oWorkbooks:Open("c:\eje.xls") //,,TRUE,4)
  oWorkBooks:close(FALSE)
  oworkbooks:destroy()
  oWorkBooks:= NULL_OBJECT
  oexcelapp:destroy()
  oExcelApp:= NULL_OBJECT
  oleun := GetProcAddress(loadHandle,
  PSZ("OleUninitialize"))
  olein := GetProcAddress(loadHandle, PSZ("OleInitialize"))
  IF oleun != NULL_PTR
    PCALL(oleun)
  ENDIF
  IF olein != NULL_PTR
    PCALL(olein)
  ENDIF
  FreeLibrary(loadhandle)
  * no more OLE functions, how can I reload here?
  SELF:quit()
quit

nicolasc


Subject: Re: help - automation server problem
From: DEarl@NewYorker.DE (David Earl)

I'm not sure that this will solve your problem, but if
  you're using AutoServer, have a close look at the
  generated code, specifically:
Method XYZ(;
     riid,;         // AS PTR
     ppvObj,;       // AS PTR
     ) Class Foo
  //
  LOCAL a AS ARRAY
  LOCAL pParamDesc AS VOOLEARGDESC
  LOCAL pRetDesc IS VOOLEARGDESC
  LOCAL uRetValue AS USUAL
  pParamDesc := oAuto:__AllocArgDescs(2)
...
  pParamDesc += 1
...
  pParamDesc += 1
...
  MemFree(pParamDesc)
Watch the bouncing pointer.  What is MemFree freeing?
  Nothing.  The pointer doesn't (hopefully) point to any
  memory block, which your application owns.  Development is
  aware of this, and will be fixing it shortly, I'm told.

David


Subject: Re: help - automation server problem
From: anegrone@biella.alpcom.it (Antonello Negrone)

DEarl@NewYorker.DE (David Earl),

Memfree as is, doesn't free the allocated memory, to succeed
  edit the code as below:
  pParamDesc -= 1
  memfree( pParamDesc )
  <repeat the 2 lines for each allocated args (2 in this
  case)>

Greetings,
Antonello.