com

How to compare two BSTRs or CComBSTRs?

十年热恋 提交于 2019-12-02 07:40:53
问题 What is the right way to compare two CComBSTRs? I tried to use bool operator ==( const CComBSTR& bstrSrc ) const throw( ); However it always return false even two ComBSTRs are the same. It did not work correctly. Do I have to convert CComBSTRs to ANSI string first and then use strcmp? Thanks! -bc 回答1: You should probably use VarBstrCmp. EDIT: this is actually what CComBSTR::operator== does, so without further context, your code may be incorrect. 回答2: BSTRs (and therefore CComBSTRs) are

COM Interop fails when moving to new server

前提是你 提交于 2019-12-02 07:12:13
I've run into a problem I just can't seem to solve. The background: Years ago, I developed a web site for one of my customers using ASP 2.0 and Ajax. One function of the web site is to produce customer invoices, on demand. Their in-house production system is written in Visual Foxpro 8 with SQL Server 2005 on the back end. Since I already had an invoice generation object that would produce a PDF file, I rolled up a COM EXE and created a COM wrapper for use in my ASP page. It works great for years, but now we're trying to move the page to a different location and things aren't working so great.

How do I get an error reason from InstallProductKey (SoftwareLicensingService) in PowerShell?

青春壹個敷衍的年華 提交于 2019-12-02 07:11:55
I'm using some PowerShell functions to configure Windows product keys and activation. I get an instance of the SoftwareLicensingService and call InstallProductKey , like this. The trap block with super formatting is extra to help debugging. trap [Exception] { "==================================================" "Trapped: $($Error[0])" "==================================================" "Exception: $($_.Exception)" "--------------------------------------------------" "" break } $service = Get-WmiObject -Query "SELECT * FROM SoftwareLicensingService" $service.InstallProductKey("12345-12345

Registration-free COM-like interop and threading

天大地大妈咪最大 提交于 2019-12-02 06:56:34
问题 I’m working on a desktop app that has WPF GUI and unmanaged C++ backend. I’ve defined API the following way (C# version, truncated): [Guid( "###" ), InterfaceType( ComInterfaceType.InterfaceIsIUnknown )] interface iMyApp { void aMethod(); } [DllImport( "my.dll", PreserveSig = true )] public extern static int create( string configPath, out iMyApp a ); In the backend I have __interface __declspec( uuid( "###" ) ) iMyApp: public IUnknown { HRESULT __stdcall aMethod(); } And classic ATL-based

win32com.client.Dispatch Class Label

杀马特。学长 韩版系。学妹 提交于 2019-12-02 06:46:17
I am trying to connect to a COM object using python. More specifically, I am using ASCOM standard drivers to connect to a MaxDome II, and do not know how to reference this driver. In this link the author uses "Celestron.Telescope" as their parameter for the win32com.client.Dispatch instantiation. My question is how to find this string. I understand that it is related to the installed drivers, which are installed on the computer, but I don't how to locate the specific string. Is there a way to use win32com.client to list COM objects? By the way, operating on Windows 7 pro, 64 bit. Thanks I do

COM class factory error

倖福魔咒の 提交于 2019-12-02 06:45:18
问题 I've been testing an application using my machine as a server, and everything's going fine with it, but when I try to set it up to run on the test server, I get this error: Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154. Any ideas? Thanks 回答1: First: Please check on your test server the registration of your com objects. HKEY_CLASSES_ROOT\CLSID\{xxxx} Check, if your dll or exe file is on the correct location on the hard drive.

Including Microsoft Office Spell Checker in own application

时光总嘲笑我的痴心妄想 提交于 2019-12-02 06:42:36
问题 I heard a while ago that the Microsoft Office Spell Checker could be included in own application by using the COM interface of it. Someone remembers the details? Which dll, or which ActiveX Object was it? 回答1: I have been investigating this just a month ago. It seems that it was possible, but if I remember well since Office 2003 the embeddable COM component has been removed. You will have to look for older versions if you want to do so. Unfortunately I don't have any link, but it took me few

Why would QueryInterface() fail when the interface is surely implemented and has built-in marshaller in Windows?

a 夏天 提交于 2019-12-02 06:22:22
问题 I have the following setup. There's a COM server that is installed into COM+ (to run in a separate process) and has this interface definition: [object, uuid("InterfaceIdHere"), nonextensible, oleautomation, hidden] interface IMyInterface : IUnknown { HRESULT MyMethod( [in] IUnknown* param ); }; The caller calls it like this: HRESULT callComObject(IStream* stream) { return comObject->MyMethod(stream); } Note that here IStream* is implicitly upcasted to IUnknown* . This is done because

.NET mshtml: How to pass a BSTR SAFEARRAY?

北慕城南 提交于 2019-12-02 06:20:33
问题 The class mshtml.HTMLDocumentClass in Microsoft.mshtml.dll assembly has a method: public virtual void write(params object[] psarray); Avoiding the real question for a moment, what code would you use to call write() ? Would you use: String html = "<html><body>Hello, world!</body></html>"; mshtml.HTMLDocumentClass doc; ... doc.write(html); or would you use: String html = "<html><body>Hello, world!</body></html>"; mshtml.HTMLDocumentClass doc; ... object[] params = new Object[1]; params[0] =

Converting a vb.net dictionary to a vba dictionary

六眼飞鱼酱① 提交于 2019-12-02 06:18:17
I was pleased to find that I could call structs that I had set up in vb.net straight into excel vba - using COM visible and registering using regasm.exe. I am struggling to do the same with a dictionary created in vb.net. I found this link which suggested that the dictionary in vb.net was not the same as the runtime.scripting dictionary found in vba. I was unable to have much luck with the links suggested in the comments though. Here is the vb.net code: Public Function ReturnDict() As Dictionary(Of String, Integer) Dim dict As New Dictionary(Of String, Integer) dict.Add("a", 10) dict.Add("b",