com

How to convert _bstr_t to CString

本小妞迷上赌 提交于 2019-12-01 14:13:42
问题 I have a _bstr_t variable bstrErr and I am having a CString variable csError . How do I set the value which come in bstrErr to csError ? 回答1: Is it not possible just to cast it: _bstr_t b("Steve"); CString cs; cs = (LPCTSTR) b; I think this should work when the project is Unicode. 回答2: CString has contructors and assignment operators for both LPCSTR and LPCWSTR, so there is never a need to call WideCharToMultiByte, and you can't get the casting wrong in unicode or non-unicode mode. You can

How do I use a 32 Bit COM object from a 64 bit process?

北慕城南 提交于 2019-12-01 14:06:45
I Use Jacob (JAVA COM Bridge) on a 64 Bit Machine and want to load COM Objects from a 32 bit DLL. How can I do that? You will need to host the 32 bit COM object in a 32bit process. So either your entire app will have to run 32bit or youll need to place the COM object in something like COM+ and use cross process calls. I solved the problem as follows: Created a small 32 bit out-of-process COM server (.exe) that serves as a factory COM object to create the needed 32 bit objects. So now my app is running 64bit and using 32 bit COM objects. My64bitApp<-->32BitOutOfProcFactory<-->32bitCOMServerDLL

Redemption + Clickonce = :-(

风流意气都作罢 提交于 2019-12-01 14:03:32
I have a normal windows forms program (Not VSTO) which deploys using click once. The issue is that loads of user are having problems with random errors generally stating (from the IClassFactory failed due to the following error: 80004005). Im deploying Redemption by changing the mode to "Isolated" which appears to work for some users but not others. The users that arn't working can be fixed by manually installing the Redemption DLL. Can anyone explain how to automate the process (I really want it to be reg free so users don't need admin permission to install). Thanks Ross Got this resolved.

Issue passing .NET object from VB6 to .NET

风流意气都作罢 提交于 2019-12-01 13:28:15
We have a .NET dll "A" that is created by a third party. It exposes classes through a tlb to our VB6 exe application. We also have our own .NET dll "B" that references .NET dll "A". "B" also exposes classes to our VB6 exe application through a tlb. Now, the VB6 application has no problem using classes from either library in the VB6 code until we try to call a function in "B" that has a parameter type from "A". In that case, we get an error 430 or an error saying "unable to cast com object of type 'system.__comobject' to type 'Type.From.Dll.A'" What could be causing this? Is this normal? froque

How to hide COM object Dispatched from Python

北战南征 提交于 2019-12-01 12:57:24
I'm using COM in Python and I want the object to run in background - hidden. With Excel I do: Import win32com.client Excel=win32com.client.Dispatch("Excel.Application") Excel.Visible=1 but my application do not have property .Visible - is there any other way to hide it? Maybe some special parameter to Dispatch? Thanks in advance R If you know your application title or class, you can hide it via ShowWindow: import win32com.client import win32con import win32gui import time print "Start" excel = win32com.client.Dispatch("Excel.Application") excel.Visible = 1 # Visible via automation time.sleep(2

How to hide COM object Dispatched from Python

不问归期 提交于 2019-12-01 11:58:42
问题 I'm using COM in Python and I want the object to run in background - hidden. With Excel I do: Import win32com.client Excel=win32com.client.Dispatch("Excel.Application") Excel.Visible=1 but my application do not have property .Visible - is there any other way to hide it? Maybe some special parameter to Dispatch? Thanks in advance R 回答1: If you know your application title or class, you can hide it via ShowWindow: import win32com.client import win32con import win32gui import time print "Start"

What may be the causes of the error 0x80010108 (The object invoked has disconnected from its clients)?

送分小仙女□ 提交于 2019-12-01 11:24:15
In C++ program the call to method of coclass returns the error 0x80010108 (The object invoked has disconnected from its clients). What may be the causes of that? It is an RPC error, you'll see it when you use out-of-process COM. It tells you that the server .exe stopped running. It probably bombed. Or decided to exit even though there were still active interface references. That could be a reference count problem. Or improper use of CAtlModule::Lock(). Etcetera, I can only guess. Debug the server with Tools + Attach to Process and find out why it decided to quit. This error is raised from a

C++ Interop: embedding an array in a UDT

孤街醉人 提交于 2019-12-01 11:19:36
I have an application that involves a lot of communication between managed (C#) and unmanaged (C++) code. We are using Visual Studio 2005 (!), and we use the interop assembly generated automatically by tlbimp. We have fairly good luck passing simple structs back and forth as function arguments. And because our objects are fairly simple, we can pack them into SAFEARRAYs using the IRecordInfo interface. Passing these arrays as arguments to COM methods seems to work properly. We would like to be able to embed variable-length arrays in our UDTs, but this fails badly. I don't think I have been able

Is there any way to draw Webbrowser content to a specific DC?

依然范特西╮ 提交于 2019-12-01 11:18:29
These days, I tries to create a hiden WebBrowser control in my program, and Using the IViewObject interface draw to my custom DC. The result is fine, I got All the content I want, but the Draw speed is unacceptable, especially some complex web pages which contains Flash objects, Each Draw to DC cost more than 100 ms . So the flash object I drew is not smooth. Is there a fast way to draw the control to my a specific DC? my code sinpet is like this: //hCompDc is a CompatibleDC which select a CompatibleBitmap. RECTL imageRect = {0, 0, nWidth, nHeight}; pHtmlDocument2->QueryInterface(IID

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

一个人想着一个人 提交于 2019-12-01 11:14:38
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[] DoubleArray { get; set; } public object[] ObjectArray { get; set; } public object PlainObject { get; set;