com

Heat.exe Cannot Harvest TypeLib Info from a 64-bit COM DLL

末鹿安然 提交于 2019-12-08 17:24:45
问题 I have a 64-bit-only COM DLL that I want to harvest typelib info from, using heat.exe. But when I attempt to do that, I get the error 193 (bad executable format). Is heat.exe 32-bit only, and cannot work with 64-bit executables? I found only one version of heat.exe on my machine. Thanks. 回答1: Unfortunately heat.exe is indeed 32-bit and can therefore only harvest 32-bit COM registrations: http://wixtoolset.org/issues/1661/ However 64-bit heat.exe extensions are discussed here: http:/

_bstr_t to UTF-8 possible?

爷,独闯天下 提交于 2019-12-08 16:24:41
问题 I have a _bstr_t string which contains Japanese text. I want to convert this string to a UTF-8 string which is defined as a char * . Can I convert the _bstr_t string to char * (UTF-8) string without losing the Japanese characters? 回答1: Use WideCharToMultiByte() – pass CP_UTF8 as the first parameter. Beware that BSTR can be a null pointer and that corresponds to an empty string – treat this as a special case. 回答2: Here is some code that should do the conversion. void PrintUtf8(const TCHAR*

How do Powershell query interface on a COM object

大城市里の小女人 提交于 2019-12-08 16:03:36
问题 I created a COM object using Powershell: $obj = new-object -com MyLib.MyObj Then I need to query the interface "MyLib.MyInterface" on that object, but I have no idea how to do it with PowerShell. In order word suppose I have the below C++ code CComPtr<IInterface1> pInterface1; CComPtr<IInterface2> pInterface2; pInterface1->CoCreateInstance(CLSID_XXXX); //in PowerShell: $obj = new-object -com MyLib.MyObj pInterface1->QueryInterface(IID_YYYY, &pInterface2); //how to do this in PowerShell? How

Does .NET interop copy array data back and forth, or does it pin the array?

纵饮孤独 提交于 2019-12-08 15:53:22
问题 I have this COM method signature, declared in C#: void Next(ref int pcch, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] char[] pchText); I call it like this: int cch = 100; var buff = new char[cch]; com.Next(ref cch, buff); Does the .NET interop layer first copy the whole array to a temporary unmanaged memory buffer, then copy it back? Or does the array get automatically pinned and passed by reference? For the sake of trying, I did this in the COM object (C++): *pcch = 1; pchText[0]

IDocHostUIHandler crashing MSHTML.dll with error 0xc0000409

送分小仙女□ 提交于 2019-12-08 13:43:25
问题 I am using slightly modified IDocHostUIHandler from https://stackoverflow.com/a/21699086/592212 in simple one main window test application with only WPF WebBrowser component in that Window. The initialization code is as follows: public MainWindow() { InitializeComponent(); _wbHostHandler = new WebBrowserHostUIHandler(PART_WebBrowser); _wbHostHandler.Flags |= HostUIFlags.DpiAware; PART_WebBrowser.Navigate("SOME_URL"); } There is really nothing else going on in the Application. Still, after

Getting url and HTMl through a BHO, SetSite throws an exception

馋奶兔 提交于 2019-12-08 12:45:19
问题 I have followed the tutorial at: http://www.15seconds.com/issue/040331.htm for making a BHO, however i doesnt seem to work for me, i have the Observer code from the examble, where she creates the actual BHO, but when i try to typecast in my SetSite it stops, i suspect i get an exception. This is my sample code, just stripped it all bare, so i get a messagebox instead. [ClassInterfaceAttribute(ClassInterfaceType.None)] [GuidAttribute("0CD00297-9A19-4698-AEF1-682FBE9FE88D")] [ProgIdAttribute(

How to disable windows firewall settings

﹥>﹥吖頭↗ 提交于 2019-12-08 12:16:00
问题 I am doing firewall related work. I can turn ON/OFF windows firewall programatically using COM interface but I want to disable turn ON/OFF options. Is there any COM interface, Windows API present for that? 回答1: This behavior is triggered by the presence of Group Policy for the firewall, specifically the Windows Firewall: Protect all Network connections setting. As per How to disable Windows Firewall using python, you need to enable this setting in any of the available ways outlined there. 回答2

C# not connecting to R using RDotNet

只愿长相守 提交于 2019-12-08 12:14:25
I am trying to interface C# to R using RDotNet . The following code is wants R to calculate the sum of two numbers and C# to get the result back and display it in the command window. using System; using RDotNet; namespace rcon { class Program { static void Main(string[] args) { string dllPath = @"C:\Program Files\R\R-3.1.0\bin\i386"; REngine.SetDllDirectory(dllPath); REngine.CreateInstance("RDotNet"); //REngine engine = REngine.GetInstanceFromID("RDotNet"); using (REngine engine = REngine.GetInstanceFromID("RDotNet")) { var x = engine.Evaluate("x <- 1 + 2"); Console.WriteLine(x); } } } } but

Notes Sessions Vs Lotus Session COM API Issues

ぃ、小莉子 提交于 2019-12-08 11:52:59
问题 I maintain a fairly large application which does a lot of talking with Lotus Notes. Recently in the last couple of months, some users have been having problem connecting to the Lotus Notes Session, I use the following code to get the session Set Session = CreateObject("Notes.NotesSession") This error seems to be popping up only for a certain number of users. I created a sample app with the following line Set Session = CreateObject("Lotus.NotesSession") And the above line works for some reason

using classes inside a COM exe from .Net

本小妞迷上赌 提交于 2019-12-08 11:12:24
问题 I have a .exe file I've been given which has COM classes inside it -- these are from C++, not .net ComVisible types I'd like to use those classes inside my .net project, but I can't add a reference to the exe; when I try I get DIALOG BOX: --------------------------- Microsoft Visual Studio --------------------------- A reference to 'C:\Program Files\blah\blah.exe' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component. --------------