com

What's the difference in these ways of creating the static instance for a singleton?

扶醉桌前 提交于 2019-12-02 19:48:49
I have had a bug recently that only manifested itself when the library was built as a release build rather than a debug build. The library is a .NET dll with a COM wrapper and I am using CoCreateInstance to create a class from the dll in an unmanaged c++ app. When I finally tracked the bug down it was caused by accessing a singleton object. I had the singleton instance declared like so: private static readonly MyObjectType s_instance = new MyObjectType; and then accessed it with: public static MyObjectType Instance { get { return s_instance; } } this was failing. Changing it to: private static

Cannot pass arguments to ActiveX COM object using PyQt4

百般思念 提交于 2019-12-02 19:42:55
问题 I'm trying to write some Python code to talk to the Thorlabs APT ActiveX control. I'm basing my code on the code found on this page, but trying to use PyQt4 ActiveX container instead of the wxPython ActiveX container. It works for a very simple ActiveX methods, however, I get an error when trying to call a method that takes arguments. This code works and shows the about box for Thorlabs APT: import sys from ctypes import * from PyQt4 import QtGui from PyQt4 import QAxContainer class APTSystem

Pass byte array within struct to a com object

自闭症网瘾萝莉.ら 提交于 2019-12-02 17:38:49
问题 I wrote a C++ COM server (out-of-proc) and client so: idl (interface is IDispatch ): typedef[uuid(0952A366-20CC-4342-B590-2D8920D61613)] struct MyStruct{ LONG id; BYTE* data; } MyStruct; [helpstring("")] HRESULT foo([out] MyStruct* pStreamInfo); server: STDMETHODIMP foo(MyStruct* myStruct) { myStruct.id = 7; myStruct.data = pData; // pData is a pointer to some data of variable length return S_OK; } client: MyStruct ms; hr = comObj->foo(&ms); The code will work fine except when adding the

Media Foundation using C instead of C++

风流意气都作罢 提交于 2019-12-02 17:28:51
问题 I am learning to use the Media Foundation API from sample code shown in Microsoft website using C instead of C++. The sample code is shown below. HRESULT CreateVideoCaptureDevice(IMFMediaSource **ppSource) { *ppSource = NULL; UINT32 count = 0; IMFAttributes *pConfig = NULL; IMFActivate **ppDevices = NULL; // Create an attribute store to hold the search criteria. HRESULT hr = MFCreateAttributes(&pConfig, 1); // Request video capture devices. if (SUCCEEDED(hr)) { hr = pConfig->SetGUID( MF

Fatal Error: “Class not registered” creating COM Object

自闭症网瘾萝莉.ら 提交于 2019-12-02 16:22:42
问题 I have an app that makes use of third party software using PHP(32 bit PHP) COM object, everything is working fine on my local machine (Windows 7, 64bit). When I deployed my app to a live server (Windows Server 2012, 64bit) and I try to create my COM object I'm getting the Fatal Error: Cannot create object "Class not registered" After finding these other SO questions: Class not registered error from PHP Failed to create COM object 'X': Class not registered in another WAMP I have ran regsvr32

Problem rendering a PowerPoint to png in C# using COM under an IIS service

瘦欲@ 提交于 2019-12-02 15:21:43
问题 first of all, my program CAN render a pptx to png, the quality is just greatly reduced when rendering on Windows Server 2008 R2 and I'm wondering why. I tested my program on windows 7 x64 using Cassini and the rendering to png of the pptx is perfect. But when I deploy my program on IIS and try to render the pptx, the quality of its rendering is reduced. This is the link the same image, one rendered under windows 7 cassini and the other under windows server 2008. The perfect quality one: http:

What is the Difference between .NET components and COM Components

限于喜欢 提交于 2019-12-02 14:56:32
What is the Difference between .NET components and COM Components, sometimes we use .NET Components to include in our projects and sometimes we include COM reference. What is the idea behind? .NET components are managed code (memory disposal is done for you) COM is an interface standard for software components. COM components are unmanaged code (memory disposal is performed using reference counting). From here : How are COM and .NET related? COM and .NET are complementary development technologies. The .NET Common Language Runtime provides bi-directional, transparent integration with COM. This

Interop COM(-isch) interface marshaling results in AccessViotlationException on simple call

断了今生、忘了曾经 提交于 2019-12-02 13:59:32
问题 I am trying to write a managed interop library for a native C++ plugin standard. This native C++ library uses a COM-compatible interface design. It does NOT however, do any of the class registration stuff. As with COM, all interfaces derive from IUnknown (called FUnknown but same 3 methods anyway). I have written a simple C++ console app that loads my managed test plugin and retrieves the initial (root) interface (an object factory pattern - much like com) through an exported method. I use a

Problem in releasing memory from an Outlook pst file

自作多情 提交于 2019-12-02 13:51:44
问题 I am working on a win app which accesses the Outlook personal folders. Internally, it mounts the personal folder on the Outlook instance and processes the mails and then unmounts the pst. After unmounting the pst, I delete that file. Now the problem is that even after un mounting the pst and releasing memory, when I try to delete the pst, I get an exception that some process is using this file so it can not be deleted. And that process is outlook. I am using following code to un mount and

Retrieve output parameters from an AutoCAD API method in python

只愿长相守 提交于 2019-12-02 13:33:12
I'm trying to retrieve 2 output Arrays from an XRecord in AutoCAD 2016 using python 2.7, with comtypes imported, the first array is an array of integers (DXF Group Codes) and the second array is an array of variants (the values of XRecord). The opposite way of what this question seeks to The method of interest is GetXRecordData , which (according to AutoCAD's documentation) if successful returns None , and only accepts 2 output arguments . when I try to retrieve it with code like DxfGrCd = [] vals = [] an_XRecord.GetXRecordData(DxfGrCd, vals) and see the values of DxfGrCd and vals I found no