com

What's the use of _ATL_PACKING constant when computing distance from the start of object?

旧巷老猫 提交于 2019-12-20 04:16:50
问题 ATL features a set of macros for so-called COM maps. COM map is a table that associates an interface GUID with an offset that is to be added to this pointer to get to the corresponding subobject - the whole stuff works as replacement to explicit static_cast for the upcast inside IUnknown::QueryInterface(). The map entries are built by using offsetofclass macro: #define _ATL_PACKING 8 #define offsetofclass(base, derived)\ ((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING)

Connect to running IE instance C++

我的梦境 提交于 2019-12-20 03:55:06
问题 I'm currently writing a program in AutoIt but I want to outsource some functions to C++ because its more secure. I managed it to create an IE and navigate to a site. But thats not what I need. I'm creating an instance of the IE in AutoIt and the part written in C++ has to connect to this IE and navigate to a specific page. Right now its an C++ Application but later on, when everything runs fine, I will create a .Dll out of it and call it with AutoIt. So I can pass values like hWnd and so on.

Controlling the volume of other applications

谁都会走 提交于 2019-12-20 02:38:11
问题 I am trying to make an app that controls the volume of another process using the Windows 7 Audio API. What I'm looking for is the ISimpleAudioVolume for the session used by the other process. I have tried using the IAudioSessionEnumerator but it will only give me the IAudioSessionControl2 of the session. Using the IAudioSessionControl I have managed to receive notifications when I change the volume through sndvol but not change it myself. I have also tried using GetSimpleAudioVolume() from

How to solve Link Error on call to ::UuidToString()?

倖福魔咒の 提交于 2019-12-20 02:16:52
问题 I have included file "rpcdce.h" for ::UuidToString() function. Still i am getting link error . Can anyone help me ? 回答1: Header files don't solve linker errors, they create them. You'll have to add rpcrt4.lib to the linker's Input + Additional Dependencies setting. Or paste this in your source code file: #pragma comment(lib, "rpcrt4.lib") 回答2: See http://msdn.microsoft.com/en-us/library/aa379352%28VS.85%29.aspx - this seems to indicate that you need to link with Rpcrt4.lib. 来源: https:/

How to check if a class implements an interface, with respecting supersets?

核能气质少年 提交于 2019-12-20 01:05:59
问题 I am learning about COM and Interfaces and have following experimental code: type IA = interface(IInterface) ['{C9C5C992-3F67-48C5-B215-7DCE6A61F0E8}'] end; IB = interface(IA) ['{F1799437-AD12-471B-8716-F1D93D1692FC}'] end; IC = interface(IB) ['{01780E8C-C47D-468E-8E42-4BFF3F495D51}'] end; TBO = class(TInterfacedObject, IB) end; procedure TForm1.FormCreate(Sender: TObject); var x: TBO; a: IInterface; begin x := TBO.Create; IInterface(x)._AddRef; if Assigned(TBO.GetInterfaceEntry(IA)) then

Handling CoCreateInstance return value

五迷三道 提交于 2019-12-19 23:26:28
问题 Here's a code sample creating a COM object: CComPtr<IBaseFilter> pFilter; auto hr = CoCreateInstance(CLSID_DMOWrapperFilter, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast<void**>(&pFilter)); I've seen somewhere that checking if CoCreateInstance() succeeded should look like this: if (SUCCEEDED(hr) && pFilter != nullptr) { // code goes here } What if I would check only hr ? Wouldn't it be enough? Should I also check that filter != nullptr ? //would this be enough? if (SUCCEEDED

Calling an x64 assembly via COM from a 32 bit App

被刻印的时光 ゝ 提交于 2019-12-19 19:04:21
问题 Short question : is it possible (on an x64 OS of course) ? If not, why exactly ? I have developed a c# plugin dll for excel 32. When compiled in x86 it works fine. When compiled in x64 the COM call fails. Do I need a 64 bit version of excel ? I thought COM was agnostic of compiling architecture and made communication possible between dlls developed in different technologies and having different architectures, but I guess the latter is wrong. I guess an x64 bit dll can obviously not be called

Calling an x64 assembly via COM from a 32 bit App

六月ゝ 毕业季﹏ 提交于 2019-12-19 19:03:12
问题 Short question : is it possible (on an x64 OS of course) ? If not, why exactly ? I have developed a c# plugin dll for excel 32. When compiled in x86 it works fine. When compiled in x64 the COM call fails. Do I need a 64 bit version of excel ? I thought COM was agnostic of compiling architecture and made communication possible between dlls developed in different technologies and having different architectures, but I guess the latter is wrong. I guess an x64 bit dll can obviously not be called

Trace not working in a .NET DLL loaded from VB6 EXE

吃可爱长大的小学妹 提交于 2019-12-19 18:57:48
问题 I have a .NET DLL that writes to the Trace. But it seems that when I call my DLL from a VB6 EXE the trace is not working. I have created an myApp.config file in the EXE folder with the trace configuration, but this does not solve the issue. I've also tried creating the Trace objects in code, but doesn't work: Dim _traceSrc As TraceSource = New TraceSource("myTraceSorce") Dim flListener As FileLogTraceListener = New FileLogTraceListener("myFileLogTraceListener") Dim tSwitch As SourceSwitch =

Why exactly does regasm warn me about signing with a strong name?

陌路散爱 提交于 2019-12-19 17:41:06
问题 If I want to make a .NET assembly usable as a COM server I have to add a set of attributes and then use regasm to register it as a COM server. If the assembly is not signed with a strong name regasm when run with /codebase key shows a RA0000 warning saying that the assembly could interfere with other assemblies on the same computer and I should sign it with a strong name, but registration succeeds and it even works just fine. AFAIK strong names are intended to prevent so-called DLL hell. But