???? ID: 238975 - ????? ???????: 02 ?????? 2010 - ??????: 2.0

??????? ???? ?? ??? ???? Office ????????? ?? ??? ????? ?????? ???? ????

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
??? ?? ??????? ???? | ??? ?? ??????? ????

??????

???? ?? ?? ??? ?? ?? ???? Office ????????? ?? ???????? ???? ?? ??? ?? ?? ????? ?? ???? ???GetActiveObject()API ?????? ?? ??? ???????? ?? ??? IDispatch ???? ??????? ???? ?? ??? ??? ???? ?? IDispatch ???? ?? ?? ??? ???????? ?? ???, ?? ??? ????? ?? ???? ??? ??????? ?? ?? ??? ???????? ?? ????

???? ???????

??????? ????? ????? ????? ??? ??????? ???????? ?????? (ROT) ?? ?????? ??RegisterActiveObject()API. ??????? ??????? ?? ??? ???????? ?? ???? ?? ????? ??? ?? ??? ??????? ?? ???? ???:
      ::CoInitialize(NULL);

      // Translate server ProgID into a CLSID. ClsidFromProgID
      // gets this information from the registry.
      CLSID clsid;
      CLSIDFromProgID(L"Excel.Application", &clsid);  

      // Get an interface to the running instance, if any..
      IUnknown *pUnk;
      HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pUnk);
      ASSERT(!FAILED(hr));

      // Get IDispatch interface for Automation...
      IDispatch *pDisp;
      hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pDisp);
      ASSERT(!FAILED(hr));

      // Release the no-longer-needed IUnknown...
      pUnk->Release();

     // ----------------------------------------------------
     // Your automation code here-
     // ----------------------------------------------------

     ::CoUnintialize();
				
???:: ??? ??? ??????? ????? ?? ?? ?? ??? ?? ???? ?? ?? ?? ???? ???????? ???GetActiveObject()API ?????? IDispatch ???? ???????? ?? ???? ???? ???? ???

Theoretically, ???????? ???-??? ???????? ?? ??? ROT iterate ?? ???? ???, ????? Office ????????? ??????? ???? ????? ??? ???? ??????? ???? ?? ?? ROT ??? ?????? ????? ?? ??? ????? ?? ??????? ????, ??????? ???? ???? ?? ????? ???? ???? ?? ?? ?? ?? ?? ???? ?? ?????? ???? ?? ?????? ?? ??? ??????? ???? ???? ?? ????? ???????, Office ??????????? ??? ROT ?? ???? ???????? ???????, ??????? ?? ?? ???? ??? ??????????? ??????? ?? ???? ?????????? ROT ???? ??????? ???????? ?? ??? ??? ?? ??? ??, ?? ???????? ?? ??? attaching, ?? ???? ??? ?? ???????? ?? ????????? ???????? ??????? ??????????? ??????? ??? ??? ?? ?????? ROT ??????????? ?? ??? ????????? ?? ??? ??? ?? ??? ??, ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
190985  (http://support.microsoft.com/kb/190985/ ) ???? Word ????????? ?? Excel ?? IDispatch ?? ?? OCX ?? ??????? ???? ????
????? ??? ?? ?? ?????? ???? ?? ????????? ?? ???-?????? ?? ??? ?????? ?? ??????? ?? ??????????? ??? ???? ?? ?????? ??? ?? ?? ??? ??? ?? ??? ?? ???? ???? PowerPoint ?? ?? ???-??????? ????????? ?? ?? ?????? ???

???? ???? ???? ??:
  • Microsoft Office XP Developer Edition
  • Microsoft Office 2000 Developer Edition
  • Microsoft Outlook 98 Standard Edition
  • Microsoft Office 97 Standard Edition
  • Microsoft Office 95 Standard Edition
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
??????: 
kbhowto kbmt KB238975 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:238975  (http://support.microsoft.com/kb/238975/en-us/ )