Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Mon, 27 Aug 2007 22:46:45 -0400,    group: microsoft.public.platformsdk.com_ole        back       


IDispatch and word CheckSpelling problem   
Hi,
I'm trying to use CheckSpelling method and have some problems.
I use code below:
CLSID clsid;
    CLSIDFromProgID(L"Word.Application", &clsid);

    IUnknown* pUnk;
    HRESULT hr = ::CoCreateInstance( clsid, NULL, CLSCTX_SERVER,
                                     IID_IUnknown, (void**) &pUnk);
    IDispatch* pDispApp;
    hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp);

    // Get IDispatch* for the Documents collection object
    szFunction = OLESTR("Documents");
    hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1,
                                  LOCALE_USER_DEFAULT, &dispid_Docs);
    hr = pDispApp->Invoke (dispid_Docs, IID_NULL,
                           LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
                           &dpNoArgs, &vResult, NULL, NULL);
    pDispDocs = vResult.pdispVal;That way I can open word, write text to it,
save it, but have no idea how to call CheckSpelling, when I do this
GetIDsOFNames return some ID but when I callinvoke I'm geting error:
IDispatch* pDispSpell;
    szFunction = OLESTR("CheckSpelling");    hr =
pDispDocs->GetIDsOfNames(IID_NULL, &szFunction, 1,
                                  LOCALE_USER_DEFAULT,
                                  &dispSpell);    hr = pDispApp->Invoke
(dispSpell, IID_NULL,
                           LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
                           &dpNoArgs, &vResult, NULL, NULL);All examples on
the net are with VB, very little with C++, any tip how to use that spell
check object?thanks
date: Mon, 27 Aug 2007 22:46:45 -0400   author:   Arnold

Re: IDispatch and word CheckSpelling problem   
"Arnold"  wrote in message
news:OZZau2R6HHA.1184@TK2MSFTNGP04.phx.gbl
> That way I can open word, write text
> to it, save it, but have no idea how to call CheckSpelling, when I do
> this GetIDsOFNames return some ID but when I callinvoke I'm geting
> error: IDispatch* pDispSpell;
>    szFunction = OLESTR("CheckSpelling");    hr =
> pDispDocs->GetIDsOfNames(IID_NULL, &szFunction, 1,
>                                  LOCALE_USER_DEFAULT,
>                                  &dispSpell);    hr = pDispApp->Invoke
> (dispSpell, IID_NULL,
>                           LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
>                           &dpNoArgs, &vResult, NULL, NULL);

CheckSpelling is not a property, it's a method. Try with DISPATCH_INVOKE 
in place of DISPATCH_PROPERTYGET.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Tue, 28 Aug 2007 08:17:51 -0400   author:   Igor Tandetnik

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us