com

What is the best practise for making a COM server with a GUI?

本秂侑毒 提交于 2020-01-07 05:52:26
问题 Context : I'm working with some old robotics software which is able to get information from a COM object if it implements some predefined interfaces. Since this old software runs on Windows 2000, I want to use DCOM to (try to) avoid having to compile something for Windows 2000. (I am aware that the program that has to be called probably needs to work, or at least exist, on the Windows 2000 computer as well) The other computer will be called through DCOM and will process an image using a

Com error 800a03ec when i call PrintPreview() method of workbook

本秂侑毒 提交于 2020-01-07 04:49:08
问题 Show message of Com error 800a03ec when i can PrintPreview() of workbook m_spWorkbook->PrintPreview(); i get m_spWorkbook in the following code: hr = spOleObject->QueryInterface(__uuidof(_Workbook), (void**)&m_spWorkbook); what's the problem? 回答1: Exception 800a03ec often means problem with locale. For example, language in Excel differs from regional settings. Have a look at these links: http://blogs.msdn.com/b/eric_carter/archive/2005/06/15/429515.aspx http://support.microsoft.com/kb/320369

Integrating C# & C++ application using secured COM via referenced C++ .TLB

大城市里の小女人 提交于 2020-01-06 20:24:04
问题 I'm trying to get my C#4.0 (VS2010) app to interact with a C++ app using COM and a referenced type library. All the examples I've seen using third-party libraries mostly include ActiveX controls or dll's where you can simply add a reference and create objects. I'm unable to create any objects directly (I get an error saying to use the interface instead) and I'm unable to find anything that will return the interface. This is a secure COM library for accessing an encrypted database and requires

DShow Sample Code for playing video does not play the video

那年仲夏 提交于 2020-01-06 20:07:33
问题 The example program provided here to run a video file. I am using "avi" format file for playing with DShow APIs in Visual Studio 2015. Refer to the complete code: #include<dshow.h> #include<iostream> using namespace std; int CALLBACK WinMain( _In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow ) { IGraphBuilder *pGraph = NULL; IMediaControl *pControl = NULL; IMediaEvent *pEvent = NULL; HRESULT hr = CoInitialize(NULL); if (FAILED(hr)) { cout <<

How do I always get COMException instead of OutOfMemoryException?

十年热恋 提交于 2020-01-06 08:00:11
问题 My C# code consumes a COM object. Sometimes that COM object methods will return E_OUTOFMEMORY but it will get translated into System.OutOfMemoryException instead of System.Runtime.InteropServices.COMException with appropriate ErrorCode . This is a problem for me because it complicates my error handling - I'd prefer to have all error indications that arise from COM object methods being thrown as System.Runtime.InteropServices.COMException only. Is it possible to always have System.Runtime

How do I grant access to my COM+ application?

纵饮孤独 提交于 2020-01-06 07:15:37
问题 I've created a COM+ server application and the caller can't access it - when it tries to instantiate a COM object ( CoCreateInstance() ) from that application the following appears in system log: The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {class id of COM object here} and APPID {app id of the COM+ application here} to the user MACHINENAME\administrator SID (SID here) from address LocalHost (Using LRPC). This

How to set MS Word page size via the automation API?

安稳与你 提交于 2020-01-06 06:42:08
问题 I need to change MS Word document's page size from Letter to A4 and found this automation class: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document_members.aspx. Which property (possibly a nested one) do I need to set? I can't find anything related to page size. 回答1: Based on the documentation you reference it is seen that a Document exposes a PageSetup property. The PageSetup property has a PaperSize property which allow you to define the paper size of the

How to set MS Word page size via the automation API?

亡梦爱人 提交于 2020-01-06 06:42:04
问题 I need to change MS Word document's page size from Letter to A4 and found this automation class: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document_members.aspx. Which property (possibly a nested one) do I need to set? I can't find anything related to page size. 回答1: Based on the documentation you reference it is seen that a Document exposes a PageSetup property. The PageSetup property has a PaperSize property which allow you to define the paper size of the

How to register a class in the registry?

对着背影说爱祢 提交于 2020-01-06 06:01:14
问题 Hi what's wrong with my code I am trying to register the class in registry in the following way but while I am debugging it shows that class is not registered and application crashes. What is wrong in this code please Help me. Test::IDiscover *pICalc = NULL; HRESULT hRes=CoCreateInstance(Test::CLSID_SqlClass, NULL, CLSCTX_INPROC_SERVER,Test::IID_IDiscover, reinterpret_cast<void**> (&pICalc)); if(hres<0) cout<<"register failure"<<endl; else cout<<"register success"<<endl; // and i am not free

Quick Access and Namespace Extensions: Unpin object

谁说胖子不能爱 提交于 2020-01-06 05:58:11
问题 When I right click on an lnk file - link on a virtual folder in a namespace extension -, then the functions CreateViewObject and/or GetUiObjectOf of my IShellFolder/IShellFolder2 implementations are called. These functions are called with the IID_IContextMenu as parameter (riid) . Also when QueryContextMenu is called the flag CMF_VERBSONLY (0x00000002) is set. It means that 1) I know that a menu should be shown and 2) that because of the flag CMF_VERBSONLY that this menu was queried by a .lnk