atl

WaitForInputIdle doesn't work for starting mspaint programmatically

只谈情不闲聊 提交于 2019-12-17 05:14:42
问题 I'm trying to open "mspaint" and find handle of it right after it has been initialized. But FindWindow returns NULL if I call WaitForInputIdle . If I try to use the function Sleep(1000) it works. But I don't think it's a right way to wait for the program to be ready. Is there a solution for this code? CString strWindowDirectory; GetSystemDirectory(strWindowDirectory.GetBuffer(MAX_PATH), MAX_PATH); SHELLEXECUTEINFO sei = { 0 }; sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.fMask = SEE_MASK

Compile Errors upgrading ATL project from vs2010 to vs2013 [duplicate]

喜夏-厌秋 提交于 2019-12-14 03:45:31
问题 This question already has answers here : Compiler Errors in atlwin.h (2 answers) Closed 5 years ago . When including atlwin.h from the Microsoft ATL libraries in Visual Studio 2013 building may result in numerous complier errors about undefined elements. HMONITOR is not defined This does not occur when building using VS2010. As this is a standard MS header file the missing class errors do not seems to make sense. 回答1: As this is a very old legacy project the problem is with the targeted

How to extend CAxHostWindow?

霸气de小男生 提交于 2019-12-14 01:28:48
问题 Standard class CAxHostWindow that used by ATL for COM ActiveX hosting does not support interface IDocHostUIHandler2. How can i to extend CAxHostWindow class for IDocHostUIHandler2 supporting? 回答1: Actually, there's a way to customize CAxHostWindow without modifying it. E.g, I wanted to implement IOleCommandTarget on the client site object. The tricky part was to override the creation of the host window. Here's how it can be done: class ATL_NO_VTABLE CWebBrowserHost : public CAxHostWindow,

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,

usage differences between _variant_t, COleVariant, CComVariant, and VARIANT and using SAFEARRAY variations

旧巷老猫 提交于 2019-12-13 17:08:34
问题 I am investigating several Visual Studio 2015 C++ project types which use ADO to access an SQL Server database. The simple example performs a select against a table, reads in the rows, updates each row, and updates the table. The MFC version works fine. The Windows console version is where I am having a problem updating the rows in the recordset. The update() method of the recordset is throwing a COM exception with the error text of: L"Item cannot be found in the collection corresponding to

Do I have to call Release() method on CComPtr objects?

女生的网名这么多〃 提交于 2019-12-13 15:15:40
问题 I'm working with SAPI5 API for processing text to speech. If I simplify my code looks like this (I removed error checking to simplify it as much as possible): int main() { CoInitialize(NULL); CComPtr<ISpVoice> spVoice; spVoice.CoCreateInstance(CLSID_SpVoice); ... CoUninitialize(); return 0; } For some weird reason my code crashes if I don't call spVoice.Release(). So the code above crashes, but this code works nicely: int main() { CoInitialize(NULL); CComPtr<ISpVoice> spVoice; spVoice

Connecting to a COM interface in an aspx code-behind running on IIS?

a 夏天 提交于 2019-12-13 13:13:49
问题 I've created a Windows service (an exe based on the Visual Studio ATL wizard) which exposes a COM interface. No problems running as an in-proc server or a Windows service. I need a Windows service since I need some processes to be available outside of IIS access. I've been creating some web pages (aspx/C#) calling my service and everything has worked fine testing within the Visual Studio .NET Development Server. Now, I'm trying to push the web pages to IIS 7 (running on windows 7) for further

VC2010-SP1 Win7 32-bit - error C2338: CVarTypeInfo< char > cannot be compiled with /J or _CHAR_UNSIGNED flag enabled

给你一囗甜甜゛ 提交于 2019-12-13 08:59:42
问题 I am getting following error on VC2010-SP1 Win7 32-bit. I tried for HotFix but it is no longer available here https://support.microsoft.com/en-us/kb/982517. Can anyone help? Thanks ClCompile: stdafx.cpp C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcomcli.h(1751): error C2338: CVarTypeInfo< char > cannot be compiled with /J or _CHAR_UNSIGNED flag enabled C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcomcli.h(1774): error C2338: CVarTypeInfo< char* >

Chaining methods of ATL/COM objects

本小妞迷上赌 提交于 2019-12-13 04:30:29
问题 In c++ we can easily set up method chaining in a class by designing methods returning *this. Would this be possible in an ATL/COM setting ? Let's say I have a simple ATL class MyOBj. I would like to know if chaining is possible in this context, and if so, what would be the idl signature of the method that would support chaining ? Simple examples would be appreciated ! (In fact, my methods are called from VBA for excel, and I would like to have chaining in that VBA context, as we have chaining

In ICollectionOnSTLImpl implementation, can't access m_T or item object's members

寵の児 提交于 2019-12-13 03:58:34
问题 I'm trying to implement a collections of objects via VC6 that can be accessed by a VB6 programs. I haven't been able to make it come together. I have defined _CopyVariantFromAdaptItf and _CopyItfFromAdaptItf (from "ATL internals"). Here are my defines to be used in my collections definitions: #define CComEnumVariantOnListOfItemInterface(ItemInterface) \ CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT,_CopyVariantFromAdaptItf<ItemInterface>,vector< CAdapt< CComPtr<ItemInterface> > > >