com

DEP preventing my COM DLL from working

▼魔方 西西 提交于 2020-01-25 03:14:28
问题 I'm trying to use a COM DLL (written in Delphi 7) within my Delphi 7 IntraWeb application but it's failing due to DEP. I'm pretty much certain it's DEP that is preventing me from using the DLL because if I compile and run my IntraWeb app as a StandAlone Server, everything works fine. But, compiling and runnning it as an ISAPI DLL, it fails. On WinXP (using IIS 6) I can add DllHost.exe to DEP and everything works. Of course, I really don't want to do that. On Win7/2008 (IIS 7) this isn't an

IsAssignableFrom with COM

别说谁变了你拦得住时间么 提交于 2020-01-25 01:52:15
问题 I'm working with a COM-API, Autodesk Inventor. This test passes: [Test] public void CastTest() { Inventor.Document document = _application.ActiveDocument; var assemblyDocument = (Inventor.AssemblyDocument)document; Assert.NotNull(assemblyDocument); } This test fails: [Test] public void IsAssignableFromTest() { Assert.IsTrue(typeof(Inventor.Document).IsAssignableFrom(typeof(Inventor.AssemblyDocument))); } I don't know much about COM at all, is there a way to check if one COM type "inherits"

C++ calling managed COM object can't find dependent assemblies

淺唱寂寞╮ 提交于 2020-01-24 20:40:06
问题 I've created and registered a managed COM library in C# on my development machine. I've successfully registered it and created a .tlb file with regasm, and successfully imported the tlb into a c++ console app used for testing. My COM assembly is called "efcAPI.dll" and it references another assembly that has not been set up for COM or registered in anyway called "efcServerDiscovery.dll". This second dll contains some code used by my COM dll and exists in the same folder as efcAPI.dll.

When to use SafeArrayAccessData to lock a SAFEARRAY

旧街凉风 提交于 2020-01-24 18:58:39
问题 I'm having a question about when it is necessary to use SafeArrayAccessData to lock a SAFEARRAY, which is passed by managed code. Here is our code. The VARIANT is passed by managed code, with a string array. During code review, somebody suggest to use SafeArrayAccessData/SafeArrayUnAccessData. But he is not sure about why and what's the benefit. Can you share some of your experiences? Thanks! STDMETHODIMP Base::Method1(VARIANT values, VARIANT_BOOL result) { CComSafeArray<BSTR> ids; ids.Attach

Exporting a subset of a out-of-proc COM server by using an in-proc-server

允我心安 提交于 2020-01-24 17:33:07
问题 I implemented an out-of-proc COM server (implemented in a Service). I don't want other applications to access all the functionality in the COM server, so I developed an in-proc server (DLL) which would talk to the out-of-proc server. Because I don't want the interfaces in the out-of-proc COM server to be accessed directly, I don't embed the type library with the Service so I thought I could use #import and have access to the COM server through the TLB. However, when I try in my in-proc-server

C# System.AccessViolationException and System.Runtime.InteropServices.SEHException

牧云@^-^@ 提交于 2020-01-24 16:48:07
问题 We are creating a comic book application using C# and are having a mainForm created on startup as usual and then when pressing the '1' key a new form called detailForm pops up showing the details of the selected comic book. There is a also a third form that is created if you press '1' again on the detailForm that will bring up another form called comicForm that shows the actual comic book. Our problem begins when you press '1' to go to the detailForm from the mainForm and then immediately

How to invoke a 32bit COM interop dll from VS 2010 Solution which is targetting 64 bit machines

允我心安 提交于 2020-01-24 15:02:08
问题 I am working on Windows client application using c#, have two projects in my VS 2010 solution, the start-up project and a class library which uses third party COM interop DLL.My desktop is 64 bit and all the client machines are 64 bit as well. If I keep the start-up project as any cpu in (build settings) and x86 for the second project which invokes the COM DLL, I am getting the following error: Could not load file or assembly ... or one of its dependencies. An attempt was made load a program

What is the “Shell Namespace” way to create a new folder?

南笙酒味 提交于 2020-01-24 13:05:52
问题 Obviously this is trivial to do with win32 api - CreateDirectory(). But I'm trying to host an IShellView, and would like to do this the most shell-oriented way. I would have thought that there would be a createobject or createfolder or some such from an IShellFolder. But neither IShellView nor IShellFolder nor even IFolderView seem to have anything quite like this. Is there a Shell-programming way to create a new folder? Or do I need to create a folder using a pathname, the old-fashioned way?

Getting a char* from a _variant_t in optimal time

旧巷老猫 提交于 2020-01-24 06:27:27
问题 Here's the code I want to speed up. It's getting a value from an ADO recordset and converting it to a char*. But this is slow. Can I skip the creation of the _bstr_t? _variant_t var = pRs->Fields->GetItem(i)->GetValue(); if (V_VT(&var) == VT_BSTR) { char* p = (const char*) (_bstr_t) var; 回答1: The first 4 bytes of the BSTR contain the length. You can loop through and get every other character if unicode or every character if multibyte. Some sort of memcpy or other method would work too. IIRC,

Getting a char* from a _variant_t in optimal time

a 夏天 提交于 2020-01-24 06:26:09
问题 Here's the code I want to speed up. It's getting a value from an ADO recordset and converting it to a char*. But this is slow. Can I skip the creation of the _bstr_t? _variant_t var = pRs->Fields->GetItem(i)->GetValue(); if (V_VT(&var) == VT_BSTR) { char* p = (const char*) (_bstr_t) var; 回答1: The first 4 bytes of the BSTR contain the length. You can loop through and get every other character if unicode or every character if multibyte. Some sort of memcpy or other method would work too. IIRC,