com

Office Interop Issue on Windows Server

偶尔善良 提交于 2019-12-12 02:41:38
问题 I am trying to access the Word Office Interop on a server from my aplication using the following line: Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); This however causes an exception to be throw: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). Does anyone know what I can do to

C++ Application That Uses MSI Automation API 32 and 64bit

人走茶凉 提交于 2019-12-12 02:37:06
问题 I am trying to create simple c++ win32 console app(in vs2010) that calls windows installer automation api. But I am failing so far. This approach causes the "Microsoft C++ exception: _com_error at memory location" error. How to correctly use this api? How to make it work correctly on 32 and 64 bit system with only one .exe file? Many thanks, Marek #include "stdafx.h" #include <windows.h> #include <atlstr.h> #import "msi.dll" using namespace WindowsInstaller; _bstr_t GetInstalledProduct

'Interface not Registered' error on ATL out-of-process callback interface

我与影子孤独终老i 提交于 2019-12-12 02:29:46
问题 I have an ATL in-process server that implements a callback interface like so: .idl interface IClientEvents : IUnknown{ [] HRESULT TestEvent(void); }; interface IATLSimpleObject : IDispatch{ [id(1)] HRESULT Advise([in] IClientEvents* clientEvents); [id(2)] HRESULT Unadvise(void); }; .h private: IClientEvents* m_ClientEvents; public: STDMETHOD(Advise)(IClientEvents* clientEvents); STDMETHOD(Unadvise)(void); .cpp STDMETHODIMP CATLSimpleObject::Advise(IClientEvents* clientEvents) { m_ClientEvents

COM server as windows service, cannot pass array as function argument

橙三吉。 提交于 2019-12-12 02:24:52
问题 I'm implementing COM server (using ATL) as Windows service. I have the following method defined in service header: STDMETHOD(SetBytes)(long lenSource, const BYTE* pSource, VARIANT_BOOL *pResult); This method is declared in the IDL file: [ object, uuid(351C5A5F-3EB8-4CC5-AB79-6DCD27C2F7E0), dual, pointer_default(unique) ] interface ISampleInterface: IUnknown { HRESULT SetBytes([in] long lenSource, [in,ref,size_is(lenSource)] const BYTE* pSource, [out,retval] VARIANT_BOOL *pResult); }; I'm

Non-default constructors for COM objects

大憨熊 提交于 2019-12-12 02:18:39
问题 How do you define a non-default constructor for a COM object in Visual C++? Is such a thing even possible? Or do you have to construct a default object and use an init(params) method to configure it? 回答1: COM coclasses implemented in C++ cannot have a constructor that takes an argument. The CoCreateObject() function, the primary way to create an instance of a coclass, doesn't have any way to pass arguments. Same with IClassFactory::CreateInstance(), the underlying method. So yes, not possible

0x800a03ec {SaveAs method of Workbook class failed} error in TCOM/TCL

为君一笑 提交于 2019-12-12 02:18:25
问题 I'm trying to write some data from TCL to a CSV file, but i get the 0x800a03ec {SaveAs method of Workbook class failed} when executing it. Any idea why this is happening? set application [::tcom::ref createobject "Excel.Application"] $application Visible 1 set workbooks [$application Workbooks] set workbook [$workbooks Add] set worksheets [$workbook Worksheets] set worksheet [$worksheets Item [expr 1]] #set worksheet [$worksheets Item "Sheet1"] set cells [$worksheet Cells] set rows [array

Creating multiple MFC dialogs through COM, strange behaviour

痴心易碎 提交于 2019-12-12 01:57:28
问题 Updated: please see this other thread instead, all this COM stuff is not part of the problem. One of our apps has a COM interface which will launch a dialog, e.g: STDMETHODIMP CSomeClass::LaunchDialog(BSTR TextToDisplay) { CDialog *pDlg = new CSomeDialog(TextToDisplay); pDlg->BringWindowToTop(); } For some reason when the COM method is called several times at once by the server, we get odd behaviour: We get multiple dialogs, but only one entry in the taskbar Dialog Z-order is based on order

How can i add a button to all windows explorer instances?

久未见 提交于 2019-12-12 01:56:03
问题 I am trying to add a button to one of the existing tool bars in any windows explorer instance. After much research i figured out that BHO (browser helper objects) are the best way to hook to windows explorer. My question is : Is that the correct way to go about it ? In the SetSite of the BHO i get the comObject that is the explorer window. What now ? If i can get the hWnd of the explorer window can i use win API to add my button ? Note i am developing in C# for XP. Thanks. 回答1: 1 In pre-XP

WPD MTP stream hangs on commit

我的梦境 提交于 2019-12-12 01:54:17
问题 I am using the following code to copy a file wrapped by a FileInfo object to an MTP device using the Windows Portable Device API: public static void CopyFileToDevice(PortableDeviceFolder parent, string name, FileInfo file) { IPortableDeviceValues values = GetRequiredPropertiesForContentType(parent.Id, name, file.Length); PortableDeviceApiLib.IStream tempStream; uint blockSize = 0; parent.Device.Content.CreateObjectWithPropertiesAndData( values, out tempStream, ref blockSize, null); System

How to integrate Excel =RTD() function in python

三世轮回 提交于 2019-12-12 01:53:36
问题 I am using a real-time-data from a proprietary application which provides real time weather data. All I know know from the data is, it provides a link to import to excel as: =RTD("4cast.wetter",,"city","parameter") This parameter includes Temperature, Humidity, Wind speed, Rain fall etc. I tried reading the support link provided at excel documentation but couldn't get if it could be used with Python. http://support.microsoft.com/kb/289150 So now my real purpose is to use this Data received by