com

Can managed and unmanaged C++/MFC be mixed in one dll?

风格不统一 提交于 2019-12-24 02:18:05
问题 Previously we had software in MFC (VC6), VB6 and C# applications that needed to call the same engine written in C++ (and MFC). The engine required C++ for speed. At the time we decided to use COM as the interface because all three could use it with the least issues in marshalling, etc. Our MFC application is now deprecated and we have recently decided to dump VB6, so what we've got left is C#. We can just leave the COM engine as-is, but it would be nice to get away from COM registration, etc.

Receiving complex javascript values through external interface

一世执手 提交于 2019-12-24 02:07:41
问题 I'm trying to receive and potentially send complex values through TWebBrowser (using TEmbeddedWB) with the provided external object. For example; in javascript I would try to use the exposed method with an array as a parameter: var test = [123, 'abc']; external.someFunction(test); //Or something more complex var complexObject = { someMethod : function(){ return 1; }, someProperty : 123, someArray : ['xyz', 3.14] } external.someFunction(complexObject); Checking the VarType of both of these

How can I get the user name who invoked the method of COM server?

雨燕双飞 提交于 2019-12-24 02:04:58
问题 I have a COM server written in C++ running on some computer in a network. Clients may perform remote calls to it from the other computers. Can I determine the name of the user which make the call to the COM-methods from the methods itself? 回答1: You can accomplish this by calling CoImpersonateClient() from within a COM method. One you're impersonating, you can then call GetUserNameEx() to fetch the user name. 来源: https://stackoverflow.com/questions/9486348/how-can-i-get-the-user-name-who

CoInitializeEx for a boost::test::unit_test

老子叫甜甜 提交于 2019-12-24 01:41:06
问题 The other day, I decided that I needed to know about test driven development for C++ on the Windows platform (using Visual Studio 2010 Premium). I had a look around before settling on trying out boost's unit test framework. I should say that I opted for boostpro.com's release (current is 1.44 if I recall correctly). This has a build of the static library, so I don't use the DLL in my tests. Boost's unit test documentation talks about seperating your code from your test suite, which seems

On Windows, with a C# authored COM server, can one return a SAFEARRAY both for early bound and late bound code?

被刻印的时光 ゝ 提交于 2019-12-24 01:07:40
问题 The question is quite long, so I'll format with bullet points for easier discussion Introduction I'm writing a C# COM Server. the COM server is for use in Excel VBA both in early binding and late binding modes. My stumbling block is how to return a SAFEARRAY of instantiated classes that works both in early and late binding mode; I get errors. I have done plenty of work on this (all day): I have done some diagnostics and setup the debugger to shed light on the errors I get. I have done some

what is CLSID of COM object I just ran in Visual Basic

好久不见. 提交于 2019-12-24 00:57:39
问题 I need to know CLSID of COM object which I just ran via CreateObject("xxx.xxx") how can I get it? TIA! Rafal 回答1: I don't think you can get that information directly from VB itself (e.g., as a side-effect or secondary result of calling CreateObject ), but you can read the registry entry at HKEY_LOCAL_MACHINE\SOFTWARE\Classes\xxx.xxx and then look at its CLSID key. 来源: https://stackoverflow.com/questions/13825388/what-is-clsid-of-com-object-i-just-ran-in-visual-basic

How to specify user defined type parameters in COM interface definition?

给你一囗甜甜゛ 提交于 2019-12-24 00:47:11
问题 One of my COM interface methods needs a parameter of user defined type as below: [uuid(58ADDA77-274B-4B2D-B8A6-CAB5A3907AE7), object] //Interface interface IRadio : IUnknown { ... HRESULT test_method2(someUDT* p2p_UDT); ... }; How could fit the definition of the someUDT in the *.idl file? The someUDT type is a user defined struct. Thanks. 回答1: Perhaps this helps you - it's german but the most interesting part is the code. This is how a Struct is defined there: [ uuid(62D33614-1860-11d3-9954

Multi instances COM object

。_饼干妹妹 提交于 2019-12-24 00:44:40
问题 I use a C++ written COM object in C#. I just create instance through "new". I need numerous of such objects. But every other "new" doesn't create new instance, but only gives reference on first object. Thats why I have a mess with data. Is it possible to get new instance every time? Or I should realize IClassFactory in my COM to instantiate not singleton? I've made COM with master in VC 2010 with ATL support. And I have a trouble where and how to realize IClassFactory. 回答1: You need to

C# COM Component Fails To Read Config When Loaded Into An Unmanaged C++ App

两盒软妹~` 提交于 2019-12-24 00:44:06
问题 I have a COM component written in C# that makes calls to ConfigurationManager.AppSettings.Get(...). This component is instantiated inside an unmanaged C++ application. Every time, ConfigurationManager.AppSettings is unable to read the configuration file. There might be two problems. 1) What should the app.config be called when the app is running (i.e. the name of the C++ exe with .config on the end, or the name of my C# class library with .config on the end). 2) Where should the config file

Calling COMVisible VB.Net dll from C++ using CoCreateInstance

好久不见. 提交于 2019-12-24 00:37:50
问题 In some measure of progress since my last question I have got the following project to compile. It is based on https://stackoverflow.com/a/10949784/846550 However at runtime the call to CoCreateInstance fails. The HRESULT is 0x80131522 - google for this and most hits seem to relate to SQL server which I am not using. C++ code, unmanaged #include <iostream> #include <atlbase.h> #import "..\ClassLibrary1\bin\debug\ClassLibrary1.tlb" no_namespace using namespace std; int _tmain(int argc, _TCHAR*