Questions tagged [atl]

1

votes
2

answer
1.9k

Views

global scope enum and namespace conflict

I have an ATL COM service and in the .IDL file, I've declared an enum like so: In Gourmet.idl typedef enum Food { Chocolate = 0, Doughnut, HotDog } Food; A header file is automatically generated, creating Gourmet_i.h. In another .CPP file (let's just call it Decadence.cpp) of the same ATL COM projec...
ykay
1

votes
1

answer
1.3k

Views

Ole drag & drop troubleshooting

I have created a Dialog using WTL, inheriting from CDialogImpl class, inside the main dialog I have created another dialog and inside this second child dialog a list control. I wanted to add drag& drop functionality to the list control, I have read on the web about the WM_DROPFILES method and about...
fire xzanderr
1

votes
1

answer
1.4k

Views

Error while including atltime header into WTL project

After I created a plain dialog using the Dialog wizard in WTL - Visual studio 9 I have included the header and I get this: Error 2 error C2039: 'CString' : is not a member of 'WTL' ...\wtl\include\atlctrls.h 5060 TASKSCHEDULER Error 3 error C2039: 'CString' : is not a member of 'WTL'...
fire xzanderr
1

votes
2

answer
893

Views

Can not register DLL

I'm working on an ATL project. When I build my solution under a x64 system it doesn't work on x86 architecture and vice versa. (I can't register the dll I generated in a different architecture). Where could be the problem? any help would be appreciated.
Kira
1

votes
1

answer
353

Views

_com_ptr_t::CreateInstance success without regsvr32

I'm studying a program that create the COM object using _com_ptr_t::CreateInstance. What I'm not getting is that, the code is working without having to regsvr32 the referenced COM dll. The only requirement is that the COM has to reside within the same directory of the executable. Could someone kind...
Wilson
1

votes
2

answer
448

Views

How to create your own control[Win32 - C++]

I created control-derived classes using MFC ,like FolderLister derived from CListCtrl or colored rich edit control.So I want to keep them in a file because project gets very messy with this way.Can i create my own control-derived from a control then use it in toolbox ? or can i keep my class in a fi...
h3x0r
1

votes
2

answer
80

Views

Use a function of an ATL library in a vbasic macro in Excel

I succeed to create a ATL library in c++ which does some operation and gives back solutions. So I have all the functions in excel by using automation. Now I would like to create a macro which could do all the functions in the right order and after that maybe associating a button to it. So I've writt...
Tommaso Ferrari
1

votes
1

answer
612

Views

Run a ATL COM DLL from a Browser (call a method)

I have a COM Object created using ATL (without MFC Support) The Object has 1 method that opens a Dialog (that does all the rest) Currently I call it from another EXE: hr = CoCreateInstance( CLSID_MyControl, NULL, CLSCTX_INPROC_SERVER, IID_IMyControl, (void**) &pMyControl ); and then: hr = pMyControl...
Dani
1

votes
1

answer
466

Views

How to do return types on methods in COM?

I know COM is old now, but every now and then we have to do some work on it. I was working on an ATL COM application in Visual Studio, I tried to add a method to an Interface, but it won't let me change the return type from HRESULT to something else like long or BSTR. I can't recall exactly how it w...
fahadash
1

votes
1

answer
571

Views

icon overlay handlers for namespace extension

I am developing namespace extension which gives a virtual view of files on a server. In this view, I need to provide different states(in use, offline, out of sync, etc) of a file using overlay icons. I was read through article implementing overlay handler, and thought I will try to handle this in on...
Madhusudan Narayan
1

votes
1

answer
616

Views

ATL/COM: Why does CComSafeArray::GetCount() throw an exception for an empty array?

I'm using the ATL CComSafeArray class, but it seems that GetCount() will throw an exception if the array is empty, for example this code throws an exception: CComSafeArray array; // array.Add(item); // There won't be an exception if I uncomment this line. array.GetCount(); This is the code of the co...
sashoalm
1

votes
2

answer
4.4k

Views

Visual Studio 2012 using platform toolset v100. Cannot open source file “atlbase.h”

I am using Visual Studio Ultimate 2012. I have a project that works when i use the default v110 platform toolset. Now I would like to add the Point Cloud Library (PCL) to this project to further work on it. Unfortunately there are only binaries available for Visual Studio 2010. I first tried to comp...
Laurens Vergote
1

votes
2

answer
101

Views

COM reference counting - codependent objects

I have two COM objects (let's call them Control and Job). Control is CoCreatable, Job objects are created by Control.NewJob(). Control has a method Control.Start(job) that makes the specified job the current job. It remains the current job as long as no other job is set. Now for the client the foll...
peterchen
1

votes
1

answer
172

Views

Redirect a WM_PAINT to default handler, replacing the DC?

Given a class deriving from, say, CEdit, is it possible to intercept the WM_PAINT message, calling the base class message with a different CDC? class CEditNew : public CWindowImpl { public: BEGIN_MSG_MAP(CEditNew) MESSAGE_HANDLER(WM_PAINT, OnPaint) END_MSG_MAP() LRESULT OnPaint(UINT, WPARAM,...
Robinson
1

votes
1

answer
149

Views

Intellisense error with _com_ptr_t since Visual Studio 2017 15.5.1

I have a _com_ptr_t instantiation generated from importing a .tlb file which is used in the following... #import "object.tlb" void demo() { IObjectPtr p; p.CreateInstance(__uuidof(Object)); p->DoSomething(); } Prior to VS2017 15.5.1 this code was parsed by Intellisense correctly and built fine. Now,...
2

votes
1

answer
489

Views

COM object lifetime management in an ATL service

I'm trying to get my head around the concept of writing a Windows Service using ATL. I've created a project and understand that I can override CAtlServiceModuleT functions to achieve my needs for the service. What I'd like to do is have the service create a COM object (called Manager) that deals wit...
2

votes
2

answer
2.6k

Views

How to write simple background thread in CWorkerThread

I'm trying to asynchronously run function in my add-on for Internet Explorer (I'm writing BHO in VC++). As suggested here I'm trying to use CWorkerThread. I've been trying to figure it out for hours but still have no idea how to do it. I don't have much experience in ATL. The lack of a good document...
Mariusz Pawelski
9

votes
2

answer
5.4k

Views

How to make an ATL COM class derived from a base class?

The "ATL simple object" wizard doesn't provide a way to specify that a new class is derived from an existing coclass and its interface. In Visual Studio 2008, how do I make a new ATL COM class derived from an existing one (i.e. Base implements IBase, and I want to make a new Derived class derived fr...
Qwertie
1

votes
1

answer
651

Views

Do vectors of CComPtr still need CAdapt?

STL has std::addressof which gets the true address of an object even if it overloads operator &. ATL::CAdapt was required to workaround this problem when storing CComPtrs in std::vectors. Anyway, I'm wondering, with C++11, should std::vector be able to cope with containing CComPtr's directly witho...
Scott Langham
1

votes
1

answer
1.3k

Views

When will _ATL_ALLOW_UNSIGNED_CHAR work?

I'm migrating a Visual C++ project which uses ATL/MFC from VS2010 to VS2013. The project compiles with /J ("assume char is unsigned"), and there is too much code that may or may not rely on that fact to easily remove the compiler flag. Under VS2013, /J causes a compiler error in atldef.h: ATL doesn'...
Chowlett
2

votes
1

answer
485

Views

How to delete a method in ATL COM C++

I am working on visual studio c++ 6 , developing a COM/dll. I created a STDMethod and deleted it through the interface(Right click and deleted). Now everytime I build the code it pops a window with a message " This file has been modified outside of the source editor.do you want to reload it?" Please...
Nichole Grace
2

votes
2

answer
2.3k

Views

Single instance of ATL COM class

I have a COM class. It can be accessed by processes outside my own. Each process creates it's own instance of the class. Is there a way to have a COM object that is shared amongst all processes that CreateInstance() it? COM Singleton is the only thing that comes to mind. However, I don't have any ex...
MarkP
2

votes
1

answer
2.1k

Views

Limiting an ATL exe server to one process (instance) only

I have an ATL exe server written with C++ (Visual Studio 2010, with merging the proxy-stud dll). The executable is compiled for Windows 7 x86 & x64. The following happens on both architectures: The ATL exe server should function as a "server process", that is - one process (MyATLServer.exe, ONLY one...
OmriSela
2

votes
1

answer
733

Views

ATL sample of calling (marshalling) Apartment-threaded COM interfaces from a worker thread

I'm looking for a code sample which illustrates making cross-threaded COM calls in an ATL COM Server DLL. Know one? More details: My component is an IE Browser Helper Object which needs to do work on a background thread. In one of my object's methods called from IE's main thread, IE gives me a poin...
Justin Grant
2

votes
2

answer
4.1k

Views

CoCreateInstance does not start or connect to ATL COM service

I have a ATL COM service exe (MyService.exe), which compiles and runs fine. If I install this service (via MyService.exe /Service), it is successfully installed into the SCM. I can start the service through the SCM and it runs fine, under the LOCALSYSTEM account. My problem arises when I attempt to...
Jack Smith
1

votes
3

answer
711

Views

CComPtr and reference count

I am using objects of type CComPtr. But I am having some memory leak problems. In particular, I have the following code: CComPtr bitmap = create_bitmap(bitmapSize); auto n = count_ref((ID2D1Bitmap*)bitmap); Where: template ULONG count_ref(Interface* pInterface) noexcept { if (pInterface) { pInterfac...
Nick
2

votes
1

answer
288

Views

Get a COM object from another COM object

I have to get the Command Interface and Status interface as given below from VBScript in an ASP Page. The COM will be deployed in a Windows CE device Set polyColdObj=CreateObject("PolyCold.Main") Set statusObj = polyColdObj.StatusInterface() Set commandObj = polyColdObj.CommandInterface() I am going...
Maanu
2

votes
2

answer
1.9k

Views

how to test if CComBSTR is empty

How to test if a CComBSTR is an empty string? (with no 'text' value, can be "" or can be null) my ideas: test if CComBSTR::ByteLength() returns 0 test if CComBSTR::GetStreamSize() returns 0 test if CComBSTR::m_str is NULL test if CComBSTR::Length() returns 0 which one is correct approach? if none of...
2

votes
1

answer
397

Views

CComSafeArray change no of elements

I have created CComSafeArray object having 32 elements using the following statements. But after some operations I came to know that I need only 3 elements in the safe array. Is it possible to change the number of elements in the safe array after creating it? CComSafeArray x(32);
Maanu
2

votes
1

answer
626

Views

WinApi, ATL creating context menu function handler

The code below creates a window, implements a CListViewCtrl and tries to make a context menu with 3 options: new, edit & delete. class CGuiView : public CWindowImpl { HMENU hPopupMenu; MENUINFO m_ContextMenuInfo; public: DECLARE_WND_CLASS(NULL) BOOL PreTranslateMessage(MSG* pMsg) { pMsg; return FALS...
fire xzanderr
2

votes
0

answer
84

Views

How to Retrieve JavaScript Window.PostMessage data inside ATL BHO C++

I am able to get JavaScript listener for window.postMessage working inside ATL BHO by following this article. Javascript post message event handler in ATL C++ BHO But How to i retrieve message data out of it ? JavaScript Code: window.postMessage({ type: 'data_received', Cross : { data: data_Id } },...
User123456
2

votes
1

answer
32

Views

Regular Expression in CAtlRegExp format not working?

I created a regular expression to capture Microsoft Office executables like so: .*(\\Microsoft Office\\Office)(\d){1,2}(\\)(WINWORD.EXE|EXCEL.EXE|POWERPNT.EXE|MSACCESS.EXE|OUTLOOK.EXE|VISIO.EXE|WINPROJ.EXE)$ Anyway it turns out that the software I'm using only supports the CAtlRegExp flavour of regu...
Captain_Planet
17

votes
1

answer
1.4k

Views

Hosting Silverlight in C++

I'm a bit over my head here and would like some advice on how to go about. Basicly what I want to do is to be able to render and control silverlight inside my C++ application. I would like something as: class silverlight_host { public: // Prio 1 silverlight_host(const std::string& filename); //...
3

votes
2

answer
1.5k

Views

ATL COM to add a function to excel

I'm trying to build an ATL COM with a c++ class and add it to excel by automation. I found some guides but I have many problems, one is that my dll donesn't compare in automation and if I try to add it excel says there's a problem about not contain a server or there aren't permissions. Could someone...
Tommaso Ferrari
17

votes
4

answer
7.6k

Views

CComVariant vs. _variant_t, CComBSTR vs. _bstr_t

I am using ATL (VS2008, so ATL9 IIRC) to create COM objects and have been using the CComVariant class (defined in atlcomcli.h) to manage VARIANT types. However, there is also another VARIANT wrapper called _variant_t. Is there any difference between CComVariant and _variant_t and which one should...
Rob
17

votes
1

answer
4.8k

Views

How to write a shell extension in C++?

This seemed like a common question but after doing some searching, I wasn't really able to find my answers. There is an article on this here: http://www.codeproject.com/KB/shell/shellextguide1.aspx But it's for a very old version of Visual Studio. I'm using VS 2008, so the instructions and interface...
void.pointer
17

votes
5

answer
7.4k

Views

What is the use of CComPtr over CComQIPtr in COM?

Can any one explain, What is the use of CComPtr over CComQIPtr in COM? CComPtr Sample1; CComQIPtr Sample2;
Ramesh
2

votes
2

answer
208

Views

Does it require to marshal the com object supporting threading model “Both”

We are given in-proc-server (.dll) with threading model "Both".i noticed the threading model in registry editor.as we know com object created with "Both" will take the threading model of the thread in which the object is created. i instantiated the object in a STA thread to make sure call to com obj...
Sukumar
6

votes
2

answer
334

Views

How to return positive error code from ATL to VB6?

I have checked out the answer at: How can I return both an error string and error code to VB6 from an ATL activex control? I am able to return custom negative error codes, ie with the severity bit set, and a custom error message. But, I would like to be able to generate a code that VB6 will presen...
veneff
2

votes
1

answer
703

Views

COleDateTimeSpan: GetTotalDays vs GetDays

Both functions GetTotalDays and GetDays of COleDateTimeSpan class returns number of days contained in object: GetTotalDays: http://msdn.microsoft.com/en-us/library/d22h87z4(v=VS.80).aspx This date/time-span value expressed in days GetDays: http://msdn.microsoft.com/en-us/library/ze8kz4yw(v=VS.80).as...
Budda

View additional questions