com

Late binding of COM->NET call with enum value argument(s)

时光怂恿深爱的人放手 提交于 2019-12-13 23:47:03
问题 First, note that this is just a learning exercise for me. The intent is to produce a .NET messagebox using nothing but pure C++ (not C++/CLI) and late binding as necessary. This works fine with just a title and text in the messagebox. However, when I try to specify buttons I get back 2147942487 "The parameter is incorrect". On the .NET side MessageBox.Show has this as an enum type argument. I am guessing that somehow the integer supplied as argument from C++, isn't automatically converted

Setting up my ATL COM callback functions

寵の児 提交于 2019-12-13 23:23:45
问题 A follow-up to this question, I have the following CerberusNative.idl file (this is an ATL project written in Visual C++ which exposes a COM object): [ object, uuid(AECE8D0C-F902-4311-A374-ED3A0EBB6B49), nonextensible, pointer_default(unique) ] interface ICallbacks : IUnknown { [id(1)] HRESULT UserExit([in] int errorCode, [in] BSTR errorMessage); [id(2)] HRESULT UserAttemptingReconnection(); [id(3)] HRESULT UserReconnected(); }; [ object, uuid(B98A7D3F-651A-49BE-9744-2B1D8C896E9E), dual,

Create COM object using plain C

感情迁移 提交于 2019-12-13 22:15:44
问题 According to MSDN documentation, you can create a COM object to access internet explorer like this in VB; Dim IE As SHDocVw.InternetExplorer Set IE = CreateObject("InternetExplorer.Application") As far as I know, COM object supposed to be language independent. Therefore, I think it should be possible to do this in plain C (Not C++). How can I create any COM object using plain C on Windows operating system? 回答1: After some research, I solved my problem like this; #include <windows.h> #define

C++ Visual Studio 2015 “non-standard syntax; use '&' to create a pointer to member”

时光毁灭记忆、已成空白 提交于 2019-12-13 21:24:22
问题 I work with TaskScheduler COM, this is my code: typedef HRESULT(*FuncOfBoll)(_Out_ VARIANT_BOOL* b); static bool GetBool(FuncOfBoll func) { VARIANT_BOOL b = VARIANT_FALSE; HRESULT hr = func(&b); if (FAILED(hr)) return FALSE; return b == VARIANT_TRUE; } void test(ITaskSettings* settings) { bool b = GetBool(settings->get_StopIfGoingOnBatteries); // <= The error here // ... } and I get the following error: Error C3867 'ITaskSettings::get_StopIfGoingOnBatteries': non-standard syntax; use '&' to

Fatal error: Class 'COM' not found in MAMP

旧巷老猫 提交于 2019-12-13 21:17:32
问题 I am facing this issue Fatal error: Class 'COM' not found in /Applications/MAMP/htdocs/ctor/abc.php on line 10 the abc.php is as follows <?php ini_set ( 'max_execution_time', 300); $filename = "abc.xlsx"; $sheet1 = 4; $arr=array(1=>'a','b','c','d'); $excel_app = new COM("Excel.application") or Die ("Did not connect"); ?> please suggest some solution. 回答1: COM is available on Windows only. Deducting from the "MAMP" in your path, you seem to be on an Apple Machine. Mac OS is Unix based. 来源:

How to render and save captured Video/Audio into a custom file/filter format in DirectShow?

我的梦境 提交于 2019-12-13 20:29:26
问题 Basiclly, I want to capture audio/video. Run it through a mp4 muxer and save it to a file on disk. Before I used ICaptureGraphBuilder2, but it seems unusuable when saving to custom formats. My code so far, I enumerate video/audio devices. In this sample I only try to capture audio. I get the correct device and use GetPin to enumerate the filters pins to get its output pin. hr = pMoniker2->BindToObject(0, 0, IID_IBaseFilter, (void**)&pSrc2); hr = pGraph->AddFilter(pSrc2, L"AudioCap"); hr =

Exception calling Excel.Interop

半世苍凉 提交于 2019-12-13 20:27:11
问题 I'm experiencing a production issue when opening an Excel Workbook's. The exception thrown is: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005. The event viewer error log detail is: Log Name: Application Source: ASP.NET 2.0.50727.0 Date: 01/11/2018 11:50:32 a.m. Event ID: 1309 Task Category: Web Event Level: Warning Keywords: Classic User: N/A Computer: XXXXX Description: Event code: 3005 Event

How to trace COM objects exceptions?

南笙酒味 提交于 2019-12-13 20:15:31
问题 I have a DLL with some COM objects . Sometimes, this objects crashes and register an error event in the Windows Event Log with lots of hexadecimal informations. I have no clue why this crashes happens. So, How can I trace those COM objects exceptions? 回答1: The first step is to lookup the Fail code's hex value (E.G. E_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means. Then, I just use trial and error to try to isolate the

Tracking down COM interface/SysAlloc leaks

为君一笑 提交于 2019-12-13 19:54:25
问题 I've inherited some terrible MSXML parsing code (which sadly I don't have time to rewrite). This code is full of COM interface/BSTR leaks where the original authors have either misused manual COM reference counting (which always seems to end in tears) or where they've used COM smart pointers but used them wrongly such that leaks have occurred. I've now fixed many of the leaks in the code but I'm still finding that msxml3.dll isn't unloaded when I call CoUninitialize() (which it should be if

Create exchange Mailbox from python

匆匆过客 提交于 2019-12-13 19:31:41
问题 I need to create a mailbox on an exchange 2003 server using python. The stunt conditions are that our machines have either office 2007 and office 2010 installed and thus the cdoexm.dll is not installed on the system. Also as it is 2007/10 you cant install the ExchangeCdo as it requires certain versions of outlook. Also mapi is not enabled on the server. Is this a case where I will have to call an external program to do this? I've spent the last couple of days trawling sites but all the