'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Ian Oldham-3
When executing the following code in a workspace the Word document is
correctly opened:

word := IDispatch createObject: 'Word.Application'.
word setProperty: 'Visible' value: true.
docs := word getProperty: 'Documents'.
doc:= docs invoke: 'Open' with:'e:\projects\snap\misc\school invoice.doc'

After generating the Word object using the Active X Control Wizard and
executing the the following code in a workspace:

word:= Word_Application new.
word visible: true
docs:= word documents
doc:= docs open: 'e:\projects\snap\misc\school invoice.doc'

 I get the following walkback, anybody any ideas what I need to do to not
get the walkback?

20:52:32, 07 November 2002: 'HRESULT Error: Type mismatch.
(FACILITY_DISPATCH)'
WordDocuments(IDispatch)>>hresultError:
WordDocuments(ExternalStructure)>>invalidCall
WordDocuments>>Open:ConfirmConversions:ReadOnly:AddToRecentFiles:PasswordDoc
ument:PasswordTemplate:Revert:WritePasswordDocument:WritePasswordTemplate:Fo
rmat:Encoding:Visible:prop:
WordDocuments>>open:confirmConversions:readOnly:addToRecentFiles:passwordDoc
ument:passwordTemplate:revert:writePasswordDocument:writePasswordTemplate:fo
rmat:encoding:visible:
WordDocuments>>open:
UndefinedObject>>{unbound}doIt
CompiledExpression>>value:
SSWSmalltalkWorkspace(SmalltalkWorkspace)>>evaluateRange:ifFail:debug:
SSWSmalltalkWorkspace(SmalltalkWorkspace)>>evaluateRange:ifFail:
SSWSmalltalkWorkspace(SmalltalkWorkspace)>>displayIt
Symbol>>forwardTo:
CommandDescription>>performAgainst:
[] in Command>>value
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Command>>value
ShellView>>performCommand:
SmalltalkWorkspaceDocument(Shell)>>performCommand:
CommandQuery>>perform
DelegatingCommandPolicy(CommandPolicy)>>route:
[] in ShellView(View)>>onCommand:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Cursor>>showWhile:
ShellView(View)>>onCommand:
ShellView(View)>>wmCommand:wParam:lParam:
ShellView(View)>>dispatchMessage:wParam:lParam:
[] in InputState>>wndProc:message:wParam:lParam:cookie:
BlockClosure>>ifCurtailed:
ProcessorScheduler>>callback:evaluate:
InputState>>wndProc:message:wParam:lParam:cookie:
ShellView>>translateAccelerator:
ShellView>>preTranslateKeyboardInput:
ShellView(View)>>preTranslateMessage:
InputState>>preTranslateMessage:
InputState>>pumpMessage:
InputState>>loopWhile:
InputState>>mainLoop
[] in InputState>>forkMain
ExceptionHandler(ExceptionHandlerAbstract)>>markAndTry
[] in ExceptionHandler(ExceptionHandlerAbstract)>>try:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
ExceptionHandler(ExceptionHandlerAbstract)>>try:
BlockClosure>>on:do:
[] in BlockClosure>>newProcess


TIA, Ian.


Reply | Threaded
Open this post in threaded view
|

Re: 'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Blair McGlashan
Ian

Firstly, sorry your posting got overlooked until now....

You wrote in message news:DE4z9.92$[hidden email]...

> When executing the following code in a workspace the Word document is
> correctly opened:
>
> word := IDispatch createObject: 'Word.Application'.
> word setProperty: 'Visible' value: true.
> docs := word getProperty: 'Documents'.
> doc:= docs invoke: 'Open' with:'e:\projects\snap\misc\school invoice.doc'
>
> After generating the Word object using the Active X Control Wizard and
> executing the the following code in a workspace:
>
> word:= Word_Application new.
> word visible: true
> docs:= word documents
> doc:= docs open: 'e:\projects\snap\misc\school invoice.doc'
>
>  I get the following walkback, anybody any ideas what I need to do to not
> get the walkback?
>
> 20:52:32, 07 November 2002: 'HRESULT Error: Type mismatch.
> (FACILITY_DISPATCH)'
>...etc...

The problem is that the code generated by the typelibrary analyzer for the
'default' version of the method (that defaults all the optional parameters)
is not correct for 'VARIANT*' inputs. Usually 'in' parameters are just plain
VARIANTs, and in that case the TLA does correctly pass a special format of
VARIANT (constructed using VARIANT unspecified), however for any pointer
parameter it always passes nil. Word is unusual in using VARIANT* for
optional input parameters, and it expects the unspecified form.

If you file in the attached patch and regenerate the interfaces, all should
be well.

Regards

Blair
Object Arts Ltd

------------
!AXInterfaceTypeAnalyzer methodsFor!

printArgument: anELEMDESC named: aString on: aPuttableStream
 anELEMDESC isOptional
  ifTrue:
   [anELEMDESC defaultValue
    ifNil:
     [| type |
     type := anELEMDESC typeName.
     (type == #variant or: [type = 'variant*' and: [anELEMDESC isIn]])
      ifTrue:
       [aPuttableStream
        print: VARIANT;
        space;
        display: #unspecified]
      ifFalse: [aPuttableStream print: nil]]
    ifNotNil: [:default | aPuttableStream print: default]]
  ifFalse: [aPuttableStream nextPutAll: aString]! !
!AXInterfaceTypeAnalyzer categoriesFor:
#printArgument:named:on:!development!helpers!private! !


Reply | Threaded
Open this post in threaded view
|

Re: 'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Ian Oldham-3
Blair,

"Blair McGlashan" <[hidden email]> wrote in message
news:ats8ui$28j0s$[hidden email]...
> Ian
>
> Firstly, sorry your posting got overlooked until now....
>
> You wrote in message
news:DE4z9.92$[hidden email]...

[SNIP]

> If you file in the attached patch and regenerate the interfaces, all
should

> be well.
>
> Regards
>
> Blair
> Object Arts Ltd
>
> ------------
> !AXInterfaceTypeAnalyzer methodsFor!
>
> printArgument: anELEMDESC named: aString on: aPuttableStream
>  anELEMDESC isOptional
>   ifTrue:
>    [anELEMDESC defaultValue
>     ifNil:
>      [| type |
>      type := anELEMDESC typeName.
>      (type == #variant or: [type = 'variant*' and: [anELEMDESC isIn]])
>       ifTrue:
>        [aPuttableStream
>         print: VARIANT;
>         space;
>         display: #unspecified]
>       ifFalse: [aPuttableStream print: nil]]
>     ifNotNil: [:default | aPuttableStream print: default]]
>   ifFalse: [aPuttableStream nextPutAll: aString]! !
> !AXInterfaceTypeAnalyzer categoriesFor:
> #printArgument:named:on:!development!helpers!private! !
>
>
>

Unfortunately all wasn't well...there was no change, I still got the same
walkback after regenerating the interfaces. I put a halt in the
AXInterfaceTypeAnalyzer >>printArgument:named:on: method but it didn't hit
whilst Word was regenerating, and there were no references to this method
from the rest of Dolphin.

I'm using DST Pro 5.01 with no other file ins, maybe the fix is dependent on
some previous fix you've posted that I haven't spotted/installed.

    regards, Ian.


Reply | Threaded
Open this post in threaded view
|

Re: 'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Bill Schwab
Ian,

> Unfortunately all wasn't well...there was no change, I still got the same
> walkback after regenerating the interfaces. I put a halt in the
> AXInterfaceTypeAnalyzer >>printArgument:named:on: method but it didn't hit
> whilst Word was regenerating, and there were no references to this method
> from the rest of Dolphin.
>
> I'm using DST Pro 5.01 with no other file ins, maybe the fix is dependent
on
> some previous fix you've posted that I haven't spotted/installed.

Are you certain the interfaces actually were regenerated?  Could there be
even an intermediate interface that was generated before the patch, and so
was not regenerated?

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: 'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Ian Oldham-3
"Bill Schwab" <[hidden email]> wrote in message
news:au4orp$ot1$[hidden email]...
> Ian,
>
> > Unfortunately all wasn't well...there was no change, I still got the
same
> > walkback after regenerating the interfaces. I put a halt in the
> > AXInterfaceTypeAnalyzer >>printArgument:named:on: method but it didn't
hit
> > whilst Word was regenerating, and there were no references to this
method
> > from the rest of Dolphin.
> >
> > I'm using DST Pro 5.01 with no other file ins, maybe the fix is
dependent
> on
> > some previous fix you've posted that I haven't spotted/installed.
>
> Are you certain the interfaces actually were regenerated?  Could there be
> even an intermediate interface that was generated before the patch, and so
> was not regenerated?
>

I'm never 'certain' about anything :-) but I uninstalled the Word package
and then regenerated the interfaces so I assume that should have been good
enough.

The thing that struck me as odd was that the method didn't appear to be
referenced from any other Dolphin method, not conclusive I realise, but a
halt in the method didn't fire either, which did seem pretty conclusive.

> Have a good one,
>
> Bill
>
> --
> Wilhelm K. Schwab, Ph.D.
> [hidden email]
>
>
>

regards, Ian.


Reply | Threaded
Open this post in threaded view
|

Re: 'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Blair McGlashan
In reply to this post by Ian Oldham-3
"Ian Oldham" <[hidden email]> wrote in message
news:6ngN9.98$[hidden email]...
>
> Unfortunately all wasn't well...there was no change, I still got the same
> walkback after regenerating the interfaces. I put a halt in the
> AXInterfaceTypeAnalyzer >>printArgument:named:on: method but it didn't hit
> whilst Word was regenerating, and there were no references to this method
> from the rest of Dolphin.
>
> I'm using DST Pro 5.01 with no other file ins, maybe the fix is dependent
on
> some previous fix you've posted that I haven't spotted/installed.

Sorry, I hadn't noticed that the change was dependent on an earlier PL2
patch:

    http://www.object-arts.com/Lib/Downloads/5.0/1075.st

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: 'HRESULT Error: Type mismatch. (FACILITY_DISPATCH)' adding/opening Word document

Ian Oldham-3
"Blair McGlashan" <[hidden email]> wrote in message
news:avcab5$ec9ef$[hidden email]...
> "Ian Oldham" <[hidden email]> wrote in message
> news:6ngN9.98$[hidden email]...
> >
> > Unfortunately all wasn't well...there was no change, I still got the
same
> > walkback after regenerating the interfaces. I put a halt in the
> > AXInterfaceTypeAnalyzer >>printArgument:named:on: method but it didn't
hit
> > whilst Word was regenerating, and there were no references to this
method
> > from the rest of Dolphin.
> >
> > I'm using DST Pro 5.01 with no other file ins, maybe the fix is
dependent

> on
> > some previous fix you've posted that I haven't spotted/installed.
>
> Sorry, I hadn't noticed that the change was dependent on an earlier PL2
> patch:
>
>     http://www.object-arts.com/Lib/Downloads/5.0/1075.st
>
> Regards
>
> Blair
>
>

Thanks Blair, that's certainly done the trick

    regards, Ian