com

MIDL (Constant) References

坚强是说给别人听的谎言 提交于 2019-12-12 19:31:54
问题 Are there no constant references in MIDL method declarations???? eg. [id(1), helpstring("My Method")] HRESULT MyMethod( [in] IID & const rclsid ); for HRESULT MyMethod( IID const &rclsid ); 回答1: MIDL doesn't really support reference parameters, it only supports "in" and "out" parameters. So if you DO pass in a reference, it's just syntactic sugar for a pointer to the value (the issue is observability - if you have a callback function or interface in our method signature, changes to a

What is the easiest way to create a simple COM object in VS2010 using native/C++ code?

泪湿孤枕 提交于 2019-12-12 19:19:18
问题 This is a followon to a prior question I posted (see here). I'm trying to call my native/C++ code from Javascript running in an HTML page. The answer in the referenced question was to create a COM object. The Javascript can then create an instance of the COM object and invoke methods on it getting to the native/C++ code. So now I'm left with trying to create a simple COM object to accept the call from the Javascript. It looks like the way to go is to create a DLL and put the COM object in

When getting Document object from Word.Application object, its members are not filled from gencache cache while VBSEdit is able to get them

余生长醉 提交于 2019-12-12 19:17:58
问题 https://mail.python.org/pipermail/python-win32/2004-October/002582.html summarizes my problem perfectly (with slight edits to update it for my case): I would like to have a Word Document instance with all methods and properties visible during interactive session. This is my currnet apporach: >>> from win32com.client import gencache, Dispatch >>> gencache.EnsureModule('{00020905-0000-0000-C000-000000000046}', 0, 8, 1, bForDemand=True) <module 'win32com.gen_py.00020905-0000-0000-C000

Accessing the raw code in an MS Access application

会有一股神秘感。 提交于 2019-12-12 19:06:02
问题 I've been trying to find some information about getting access to the raw code in MS Access (I use v2007 but should probably apply to all versions). Say for instance that I'd like to list all functions in every code-behind form and module in the application and list their parameters. How would you achieve this? Note: I'm of course assuming that the application is not compiled. 回答1: You can output all the code to text and run it though another program or load it into a database, or you can

COM: Getting GUID of coclass object using pointer to interface it implements

守給你的承諾、 提交于 2019-12-12 18:34:25
问题 Having pointer to COM interface that are implemented by some concrete component class object is it possible to get a GUID of the underlying object that implements this interface (CLSID)? Update 1 More generally, I have a function like SetFont(ICanvasFont* font) and I need a way to determine if the underlying object that implements the ICanvasFont interface is of a certain class (say MCanvasFont ). 回答1: IUnknown::QueryInterface on this interface pointer to obtain one of the following: IPersist

Convert early-binding code to late-binding

限于喜欢 提交于 2019-12-12 18:15:13
问题 I've often written early-binding code in VBA and VB6 to automate office applications (Word, Excel, etc) then switched it to late-binding to handle multiple versions of those applications. I'm trying to do the same thing but I am automating an ESRI ArcMap GIS application and the concepts I've used in the past do not seem to be translating. The following code runs correctly: Sub EarlyBinding() Dim ArcMap As esriArcMapUI.MxDocument Set ArcMap = GetObject("C:\Users\Mike\Downloads\Assessment

C# COM objects with VB6/asp error

雨燕双飞 提交于 2019-12-12 18:07:51
问题 I'm trying to expose a C# class library via COM so that I can use it in a classic asp web site. I've used sn - k, regasm and gacutil. About all I can do now though is echo back strings. Methods which take Class variables as input are not working for me. ie my test method EchoPerson(Person p) which returns a string of the first and last name doesn't work. I get a runtime error 5 - Invalid procedure call or argument. Please let me know what I am missing. Also I have no intellisence in VB. What

Do I need to marshal IStream returned by CreateStreamOnHGlobal, for use across threads?

ぃ、小莉子 提交于 2019-12-12 16:20:32
问题 I have a COM stream object (IStream), created with CreateStreamOnHGlobal. I want to use it across different threads within the same process. Do I need to marshal the stream object itself (with CoMarshalInterface etc)? Or is it thread-safe already? EDITED , reads/writes/seeks are properly synchronized with locks in my codes. 回答1: COM treats IStream as a special type of interface, which can be safely used across threads. This is necessary so that other interfaces can be marshaled across thread

Is it possible to debug a COM dll in VS2008?

谁说胖子不能爱 提交于 2019-12-12 16:16:09
问题 This may be a very stupid question. Is it possible to debug a COM dll in VS2008 for which I do not have the source code? The reason I want to do this is I am passing an Array to a COM method and I expect this Array to be populated by the method. However the Array is not being populated. So I want to step into the COM method to see whats happening. is this possible? Below is an example of the code I am using: Array binaryArray = Array.CreateInstance(typeof(sbyte), 896); bool success = photo

How to check if OleInitialize has already been called?

試著忘記壹切 提交于 2019-12-12 16:16:00
问题 I want to write a Delphi function to register a dll. I want the function to check if OleInitialize has already been called before it does so. I guess I'm trying to avoid the consequences of initializing twice because I'm not sure what they might be. I'm worried that my function won't handle as wide a variety of dlls as regsvr32.exe. 回答1: Take a look at the documentation: Return Value [...] S_FALSE - The COM library is already initialized on this apartment. ... and also: Typically, the COM