Board index » delphi » Out-of-process Servers and Windows 2000 - Access violation in vcl50.bpl

Out-of-process Servers and Windows 2000 - Access violation in vcl50.bpl

I hope someone can help me with this.

I'm running Windows2000 Professional. I've applied the latest update to
Delphi 5.

Any out-of-process server creation seems to fail with the error message:

Access Violation at address 40003470 in module vcl50.bpl.

To make this happen simply drop one of the Office2000 automation components
onto a form and set the autoconnect property to true, press F9. Voila.

Alternatively you can make a call to CreateOleObject( 'Word.Application')
then any manipulation of the returned object through the IUnknown interface
causes the same access violation.

It's not an office 2000 issue as the same happens with own my delphi
out-of-process servers and things like the MSAgent control.

It can't be a generic problem with my windows2000 setup as I can happily
manipulate Office2000 applications using the scripting host.

The exact same code compiled under NT4 works fine.

Most perplexing.

 

Re:Out-of-process Servers and Windows 2000 - Access violation in vcl50.bpl


Really - Even if someone could just say:

"Dunno what you're on about - they work fine for me" it would be a help.

Re:Out-of-process Servers and Windows 2000 - Access violation in vcl50.bpl


<<Craig Arnold:
To make this happen simply drop one of the Office2000
automation components onto a form and set the autoconnect
property to true, press F9. Voila

Quote

Are you sure about that 'any'? Some of the components won't
autoconnect properly on some setups, but you shouldn't
have any problem with, say, the TExcelApplication component.

<<Craig Arnold:
Alternatively you can make a call to
CreateOleObject( 'Word.Application') then any manipulation of
the returned object through the IUnknown interface causes the
same access violation.

Quote

CreateOleObject returns an IDispatch. How are you trying to
manipulate it?

--
Deborah Pate (no emails please!)

Re:Out-of-process Servers and Windows 2000 - Access violation in vcl50.bpl


Thanks for the response Deborah.

Quote
> Are you sure about that 'any'?

Pretty much, though I admit I haven't tried them all.
It certainly happens with both TWordApplication and TExcelApplication, and
both of these work just fine under NT4.

Quote
> CreateOleObject returns an IDispatch. How are you trying to
> manipulate it?

Yes, of course, quite right IDispatch, not IUnknown.

Here's some code that works just fine under NT4 and causes the
aforementioned access violation under w2k. I have office2000 installed under
both operating systems, and the latest delphi patch applied to both delphi
installations.

procedure TForm1.Button1Click(Sender: TObject);
var
   oWord : variant;
begin

   oWord := CreateOleObject( 'word.basic');
   oWord.appshow;
   oWord.filenew;
   oWord.insert('Hello world');
end;

The equivalent vbscript code using the scripting host works fine under w2k.

Something I have noticed:

The cpu process de{*word*81} always kicks in on the line:

ntdll.DbgBreakPoint
77F9F9EO C3 ret

this happens on trying to automate both word and excel, the relevant dll
seems to be ntdll.dll in the system 32 directory and is called from both
winword.exe and excel.exe, the reported access violation is always "Access
Violation at address 40003470 in module vcl50.bpl."

Re:Out-of-process Servers and Windows 2000 - Access violation in vcl50.bpl


<<Craig Arnold:
Here's some code that works just fine under NT4 and
causes the aforementioned access violation under w2k.
I have office2000

Quote

Grim. I have only Office97 and Win9x, so I can't
suggest much, I'm afraid. I don't even know if
anyone is using D5, Win2k and Office2000
successfully, though I'd have expected more
howls of pain by now if it couldn't be done.
CreateOleObject just calls ProgIDtoClassID
and then CoCreateInstance, so there isn't
much scope for error, really. Is there anything
else on your machine that could be causing a
problem (like Norton Antivirus does with
Word2000, for instance)?

I don't know VBScript - do you use GetObject
with it? Here's a Delphi equivalent you might
try:

function GetObject (const Name : string): IDispatch;
var
  Moniker : IMoniker;
  Eaten : integer;
  BindContext : IBindCtx;
  Dispatch : IDispatch;
begin
  OleCheck(CreateBindCtx(0, BindContext));
  OleCheck(MkParseDisplayName(BindContext,
                   PWideChar(WideString(Name)), Eaten, Moniker));
  OleCheck(Moniker.BindToObject(BindContext, NIL, IDispatch,
Dispatch));
  Result := Dispatch;
end;

But I'm afraid I really can't contribute any
more to this thread. Please let us know
if you find an answer!

--
Deborah Pate

Other Threads