com

Out of Process COM Server - One server process per calling process?

五迷三道 提交于 2019-12-23 01:45:37
问题 I have an out of process com server, specifying CLSCTX_LOCAL_SERVER as the context, and REGCLS_MULTIPLEUSE for the connection type. This results in a single server process being reused by multiple calls from multiple clients. I’m now wanting to make some changes to the server, which unfortunately can not work with a single process shared amongst clients (there are reasons for this, but they're long winded). I know you can set the server to use REGCLS_SINGLEUSE as the connection type, and this

Python COM server with VBA late biding + skip win register (no admin rights)

瘦欲@ 提交于 2019-12-23 01:18:09
问题 I'm trying to import Python code into in VBA. The code below works but requires admin rights . Is there a way to go around the win register need (assume I just don't have admin rights) but keep the 'late biding' behavior (dont want to Tools>>Reference every time I compile something new) class ProofOfConcept(object): def __init__(self): self.output = [] def GetData(self): with open('C:\Users\MyPath\Documents\COMs\SourceData.txt') as FileObj: for line in FileObj: self.output.append(line) return

How do I register a proxy/stub for a COM interface defined by a third party?

喜欢而已 提交于 2019-12-23 01:12:40
问题 There's Another Company that ships the product that consumes IAnotherCompanyInterface. We want to ship a COM object that implements IAnotherCompanyInterface. That interface is not Automation-compatible, so the next easiest option to enable marshalling is using a proxy/stub. Another Company doesn't ship the proxy/stub and doesn't want to. Compiling and registering the proxy/stub is not a problem by itself but consider the following situation. There's our company shipping a COM object

Call C++ function in C# from DLL - strange parameters

落花浮王杯 提交于 2019-12-22 18:31:49
问题 I have a function writen in C++ with the next header: void EncodeFromBufferIN(void* bufferIN,int bufferINSize, unsigned char* &bufferOUT, int &bufferOUTSize); I've edited the .h and .cpp files like this, to be able calling the function by importing the DLL in C#: **EncodeFromBufferIN.h** extern "C" { __declspec(dllexport) void EncodeFromBufferIN(void* bufferIN, int bufferINSize, unsigned char* &bufferOUT, int &bufferOUTSize); } **EncodeFromBufferIN.cpp** extern void EncodeFromBufferIN(void*

Is the IShellItemImageFactory interface, used for getting Vista/7 shell thumbnails, broken?

廉价感情. 提交于 2019-12-22 18:14:55
问题 I want to use IShellItemImageFactory to retrieve the shell thumbnail of files. According to the MSDN docs, if I pass in a SIZE struct of 256x256, it should populate the HBITMAP parameter with a 256x256 bitmap, and if I use the SIIGBF_RESIZETOFIT flag, it should resize smaller thumbnails to 256x256. It doesn't. Instead, the result is a 256x256 bitmap with a small icon drawn in the middle. Okay, maybe that's just not what SIIGBF_RESIZETOFIT is supposed to do. But then, as I understand it, I

python pyautocad,how to contruct an objectlist for COM

只愿长相守 提交于 2019-12-22 18:05:12
问题 This is an real project write by VBA before. I want change it to python for data processing is heavely. And, use 'ActiveX Automation scripts for AutoCAD with Python' method. code is below.My question is, how to contruct an object list for AddRegion? Maybe comtypes have some topic about VARINT. I really have no experience about COM and so on... # -*- coding: utf-8 -*- from pyautocad import Autocad, APoint, aDouble acad = Autocad(False, True) acad.prompt("Hello, Autocad from Python\n") print

Lotus Notes Automation: Notes.NotesSession doesn't implement Domino::ISession?

我的未来我决定 提交于 2019-12-22 17:48:30
问题 I'm trying to improve my Lotus Notes client code: Working: #import "...\IBM\Lotus\Notes\notes32.tlb" no_dual_interfaces raw_native_types CComPtr<IDispatch> session_dispatch; if(FAILED(session_dispatch.CoCreateInstance(_T("Notes.NotesSession")))) ... NOTESSESSION *session = static_cast<NOTESSESSION *>(*&session_dispatch); This gives me a valid NOTESSESSION object that is aware that it needs to go through IDispatch to actually invoke methods. I found some example code on the net, which looks a

Winforms: One COM object needs an STAThread, the other needs an MTAThread. How can I use them?

让人想犯罪 __ 提交于 2019-12-22 17:39:40
问题 I'm trying to build a Winforms application with two COM components. However, one of the components only works when using [MTAThread] and the other only works with [STAThread] . What would the recommended solution be? 回答1: Windows forms requires [STAThread] to be present on it's main entry point. It will only work in Single threaded apartment state. You can use your STA COM object on the UI thread in Windows Forms, with no issues. The typical approach for this is to create your own thread, and

How to cast a control to IOleObject

一个人想着一个人 提交于 2019-12-22 17:36:14
问题 I want to invoke GetClientSite on a .net control. For this purpose I am trying to cast a control (in example Windows.Forms.Form) to IOleObject which returns null. What should I do to get IOleObject? using System; using System.Runtime.InteropServices; using System.Security; using System.Windows.Forms; namespace Test001 { public class Form001 : Form { public Form001() { InitializeComponent(); } private void InitializeComponent() { this.SuspendLayout(); this.Name = "Form001"; this.Text =

COM interface created by ATL inherits IDispatch but late binding does not work

无人久伴 提交于 2019-12-22 14:14:38
问题 This my IDL file. IFrame is a dual interface and inherits both IDispatch and IUnknown. [ object, uuid(C5AD0517-37FC-479C-9C7A-A063B17E4A2E), dual, nonextensible, pointer_default(unique) ] interface IFrame : IDispatch{ }; [ uuid(F7D50952-4AF1-491B-B0AA-35083AEFA998), version(1.0), ] library bdsCOMLib { importlib("stdole2.tlb"); [ uuid(9C2E7E2D-A39C-4FE7-BEEB-3BF65F9D4C05) ] coclass Frame { [default] interface IFrame; }; }; And this is the CFrame class declaration which is suppose to implement