com

How to pass an array (Range.Value) to a native .NET type without looping?

梦想的初衷 提交于 2019-12-18 03:41:36
问题 What I am trying to do is populate an ArrayList using .AddRange() method in VBA using late binding on native C# ArrayList , but I can't figure out how to pass an object other than another ArrayList to it as argument... anything else I have tried so far fails... So basically what I am doing now (Note: list is C#'s ArrayList via mscorlib.dll) Dim list as Object Set list = CreateObject("System.Collections.ArrayList") Dim i As Long For i = 1 To 5 list.Add Range("A" & i).Value2 Next But this is

Use PowerShell to wrap an existing COM object

会有一股神秘感。 提交于 2019-12-18 03:40:33
问题 Using PowerShell and System.DirectoryServices , I've been given an object that looks like this: TypeName: System.__ComObject Name MemberType Definition ---- ---------- ---------- CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType) Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetLifetimeService Method System.Object GetLifetimeService() GetType Method type GetType() InitializeLifetimeService Method System.Object

Using a COM dll from C# without a type library

烂漫一生 提交于 2019-12-17 23:49:09
问题 I need to use a COM component (a dll) developed in Delphi ages ago. The problem is: the dll does not contain a type library... and every interop feature (eg. TlbImp) in .NET seem to rely on TLBs. The component has been used in Delphi programs here for many years without problems because "It's not much of a problem using COM objects from Delphi, because we know the interfaces" (quote Delphi developer). Is there any way I can use this DLL from c# without a TLB? I've tried using the DLL as

Which tags are required in the manifest for registration free COM?

你离开我真会死。 提交于 2019-12-17 23:28:06
问题 TL;DR Do all registry entries produced by regsvr32 need to be present in a SxS reg-free-COM manifest and vice versa? I'm trying to get registration free COM going for a third party component. Reading up on the subject, I find that there are several elements mentioned, that can be put into a manifest: From the docs, we can add the following tags to a manifest to describe a COM component: assemblyIdentity - which really just describes the "abstract assembly" as far as I can tell comClass -

Is it possible to test a COM-exposed assembly from .NET?

谁说我不能喝 提交于 2019-12-17 22:44:05
问题 I have a .NET assembly which I have exposed to COM via a tlb file, and an installer which registers the tlb. I have manually checked that the installer works correctly and that COM clients can access the library. So far, so good... However, I am trying to put together some automated system tests which check that the installer is working correctly. As part of that I have automated the installation on a VM, and I now want to make some calls to the installed COM library to verify that it is

Sinking Events of DWebBrowserEvent2 hangs the navigation

坚强是说给别人听的谎言 提交于 2019-12-17 22:01:36
问题 I have a problem just like JimEvans in Sinking DWebBrowserEvents2 events appears to hang programmatic navigation but I can't understand the anwser, can somebody tell me more about it?? I'm manipulating the IE Explorer by plaint C++. Some codes are copied from the Codeproject. But my IE got hung when I'm handling the Events, and I can't get the DISPID_NAVIGETCOMPLETE event before my main function finishes. My code below: #include <afxwin.h> #include <afxdisp.h> #include <iostream> #include

DirectShow code crashes after exit (PushSourceDesktop sample)

百般思念 提交于 2019-12-17 21:33:27
问题 I'm trying to use the Desktop capture filter that comes with the SDK (PushSourceDesktop). I compiled it and seem to use it successfully as it actually captures my desktop and saves it to a file. But the application crashes when its done/exits. When I break on the error it only says no source available and the call stack location is KernelBase.dll!7560280C(). I thought I give it a shot here to see if anyone can recognize some issue or if I am doing something blatantly wrong that might cause

COM object that has been separated from its underlying RCW can not be used - why does it happen?

[亡魂溺海] 提交于 2019-12-17 21:28:58
问题 I sometimes get the following exception: COM object that has been separated from its underlying RCW can not be used Sample code: using (AdOrganizationalUnit organizationalUnit = new AdOrganizationalUnit(ADHelper.GetDirectoryEntry(ouAdDn))) { using (AdUser user = organizationalUnit.AddUser(commonName)) { //set some properties user.Properties[key].Add(value); user.CommitChanges(); user.SetPassword(password); //it is set using Invoke //must be set after creating user user.Properties[

What is COM (Component Object Model) in a nutshell? [closed]

雨燕双飞 提交于 2019-12-17 21:26:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . It seems COM objects are general use objects which are governed by the OS. The objects follow a strict interface and allow you to query the objects to determine information. Is this what COM objects are? 回答1: COM is a mechanism that allows the re-use of objects (or rather

Is STA Message Loop Required in This Case?

爷,独闯天下 提交于 2019-12-17 20:56:05
问题 I've got some COM objects I'm creating and running on threads in a .NET application. The threads are marked as Single Threaded Apartments, and everything seems to be working. My understanding is that if these threads try to access COM objects from the main thread then those objects will automatically be marshaled and serialized for me in .NET, so even in that case things will be handled for me, all safe and neat, though maybe a bit slowly. My question is, while things appear to be working