com

COM & Late binding in Excel/VBA: ActiveX component can't create object

拥有回忆 提交于 2020-03-05 04:04:46
问题 I have built a .NET COM wrapper which I use in VBA to run a .NET assembly in Excel. For some reason I can't use late-binding to create objects from the .NET COM dll. Set obj = CreateObject("COMwrapper.MyClass") This throws Error 429: ActiveX component can't create object It works however if I: Use early-binding and reference the COMwrapper.tlb Run Excel with admin rights The COMwrapper .NET project and it's dependencies .NET DLLs are built with Visual Studio 2019 elevated to admin mode, so

COM & Late binding in Excel/VBA: ActiveX component can't create object

二次信任 提交于 2020-03-05 04:04:31
问题 I have built a .NET COM wrapper which I use in VBA to run a .NET assembly in Excel. For some reason I can't use late-binding to create objects from the .NET COM dll. Set obj = CreateObject("COMwrapper.MyClass") This throws Error 429: ActiveX component can't create object It works however if I: Use early-binding and reference the COMwrapper.tlb Run Excel with admin rights The COMwrapper .NET project and it's dependencies .NET DLLs are built with Visual Studio 2019 elevated to admin mode, so

Powershell Remote: Microsoft.Update.Session, Access Denied: 0x80070005

99封情书 提交于 2020-02-27 02:18:08
问题 I've written a script to search/download/install Windows Updates on a machine using the Microsoft.Update.Session COM Object. When run locally it works just fine, however when running through a remote session or through Invoke-Command I receive an access denied (0x80070005) error on Microsoft.Update.Session.CreateUpdateDownloader() I receive the same error if I attempt to create a Downloader object directly, code to reproduce the issue: $oUpdateDownloader = new-object -com "Microsoft.Update

MFC app Assert fail at CRecentFileList::Add on Command line FileOpen

老子叫甜甜 提交于 2020-02-25 01:04:47
问题 I'm using VS2010 and Windows 7, and my app is SDI shared DLL, upgraded from VC6. After installing my application, if the user double-clicks the registered file type, the application crashes at the MFC function: void CRecentFileList::Add(LPCTSTR lpszPathName, LPCTSTR lpszAppID) { // ... #if (WINVER >= 0x0601) // ... #ifdef UNICODE // ... #endif ENSURE(SUCCEEDED(hr)); // Crash here: "hr = 0x800401f0 CoInitialize has not been called." This is called from the InitInstance() function: // Parse

IRunningObjectTable.Register always sets pdwRegister to 65536, an invalid value

北城余情 提交于 2020-02-24 10:35:49
问题 I'm using IRunningObjectTable.Register and IRunningObjectTable.Revoke as shown in this tutorial. My VBScript client initially calls methods no problem, but when the C# COM server disposes, I always receive a "Value does not fall within the expected range" exception. This is due to the commented line below: private const int ACTIVEOBJECT_STRONG = 0x0; [DllImport("ole32.dll")] private static extern int CreateBindCtx(int reserved, out IBindCtx bindCtx); [DllImport("oleaut32.dll")] private static

Events do not fire when displaying a VB6 modal form from a C# modal form?

戏子无情 提交于 2020-02-23 10:13:00
问题 EDIT - I discovered that when the VB6 program runs compiled, the events work normally and there is no problem. It is only when the code is running in the VB6 IDE that the events are broken! This does not entirely solve the problem because it would be very inefficient development if we can't debug in the IDE; but maybe it provides more insight into the root cause. I guess the fix that is needed (if possible) is to get the events to work normally / correctly in the IDE. I am loading a modal VB6

C# property exposed to VBA (COM) : Run-time error '424': Object required

爷,独闯天下 提交于 2020-02-14 18:37:57
问题 This C# code is in a .NET 4.5 ComVisible assembly: C# Code [InterfaceType(ComInterfaceType.InterfaceIsDual)] [Guid("22341123-9264-12AB-C1A4-B4F112014C31")] public interface IComExposed { double[] DoubleArray { get; set; } object[] ObjectArray { get; set; } object PlainObject { get; set; } double ScalarDouble { get; set; } } [ClassInterface(ClassInterfaceType.None)] [Guid("E4F27EA4-1932-2186-1234-111CF2722C42")] [ProgId("ComExposed")] public class ComExposed : IComExposed { public double[]

C# property exposed to VBA (COM) : Run-time error '424': Object required

扶醉桌前 提交于 2020-02-14 18:36:33
问题 This C# code is in a .NET 4.5 ComVisible assembly: C# Code [InterfaceType(ComInterfaceType.InterfaceIsDual)] [Guid("22341123-9264-12AB-C1A4-B4F112014C31")] public interface IComExposed { double[] DoubleArray { get; set; } object[] ObjectArray { get; set; } object PlainObject { get; set; } double ScalarDouble { get; set; } } [ClassInterface(ClassInterfaceType.None)] [Guid("E4F27EA4-1932-2186-1234-111CF2722C42")] [ProgId("ComExposed")] public class ComExposed : IComExposed { public double[]

How to wait on WaitHandle without message pumping?

允我心安 提交于 2020-02-14 03:13:26
问题 I want to call WaitHandle.WaitOne(TimeSpan) in .NET, but I'm on the STA thread and it pumps messages while waiting. For reasons that are beyond the scope of this question, I need to wait without pumping. How can I wait for a WaitHandle to be signaled without pumping messages? It seems in some scenarios that WaitHandle.WaitOne does not pump messages. But it does sometimes for some messages. See these links for more information on that: Managed and Unmanaged Threading in Microsoft Windows

Overlapped WSARecv() Callback Not Being Called in MFC App

那年仲夏 提交于 2020-02-05 06:35:46
问题 I have a COM component, implemented in C++ with ATL, that uses overlapped socket I/O. Right after the connection is made to the server, it starts an overlapped read on the socket, with code like this: // Pass pointer to this instance as hEvent parameter, for use by callback m_recvOverlapped.hEvent = reinterpret_cast<HANDLE>(this); int rc = ::WSARecv(m_s, &wsabuf, 1, &m_recvNumberOfBytes, &m_recvFlags, &m_recvOverlapped, RecvCallback); if (rc == SOCKET_ERROR) { // If error is WSA_IO_PENDING,