Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HOW to use ATL dll in vc++

460 views
Skip to first unread message

behapp...@gmail.com

unread,
Apr 16, 2009, 7:27:50 AM4/16/09
to
Hi,
I have an ATL dll.i need to use it vc++ project in vs2005
Please help I dont know how to do it


Mohit Kumar

Giovanni Dicanio

unread,
Apr 16, 2009, 9:15:49 AM4/16/09
to

<behapp...@gmail.com> ha scritto nel messaggio
news:52567592-bf97-45c3...@d25g2000prn.googlegroups.com...

> Hi,
> I have an ATL dll.i need to use it vc++ project in vs2005
> Please help I dont know how to do it

What do you mean by "ATL DLL" ?

Is it a COM DLL written using ATL?

Is it a pure Win32 DLL with a C or C++ interface that uses some of ATL
classes (like CString) inside?

Note that there is a specific group to discuss ATL: microsoft.public.vc.atl.

Giovanni


Tom Serface

unread,
Apr 16, 2009, 10:02:16 AM4/16/09
to
Lots of us here have some ATL experience. What is it you are trying to use?
We might be able to help if we know what part of ATL you're trying to use.
It's easier in previous versions of VS since it was integrated, but still
possible in any version. For one of my projects I had to copy in the .h
files for some functions I needed that weren't in 2008, but were in 2005.

Tom

<behapp...@gmail.com> wrote in message
news:52567592-bf97-45c3...@d25g2000prn.googlegroups.com...

Trevor

unread,
Apr 16, 2009, 1:50:51 PM4/16/09
to
<behapp...@gmail.com> wrote in message
news:52567592-bf97-45c3...@d25g2000prn.googlegroups.com...

If it is an ATL COM DLL then you can use #import to import the TLB/DLL and
generate wrapper classes for the COM object. If it is just a normal DLL
using ATL functionality then you can either link to the .lib file, or load
it at runtime using LoadLibrary/GetProcAddress.

You can tell if it is a COM DLL by looking for the exported function
DllRegisterServer.

Ajay

unread,
Apr 16, 2009, 7:47:27 PM4/16/09
to

You can use ATL with MFC at compile time and also at run time (COM)?
It all depends upon what you are doing.

--
Ajay

Mohit

unread,
Apr 17, 2009, 4:56:49 AM4/17/09
to

Hi,
I had created an ATL COM Dll using using Web service proxy wizard
(http://msdn.microsoft.com/en-us/library/aa239611(VS.60).aspx)
I have to use output dll in my c++ project .
Please help

Mohit Kumar

Mohit

unread,
Apr 17, 2009, 5:17:55 AM4/17/09
to

Giovanni Dicanio

unread,
Apr 17, 2009, 5:36:48 AM4/17/09
to

"Mohit" <behapp...@gmail.com> ha scritto nel messaggio
news:1eecd214-3175-4ec0...@y10g2000prc.googlegroups.com...

> I had created an ATL COM Dll using using Web service proxy wizard
> (http://msdn.microsoft.com/en-us/library/aa239611(VS.60).aspx)
> I have to use output dll in my c++ project .
> Please help

My understanding is that your ATL COM DLL is just a simple COM Server (no
ActiveX, right?).

In that case, you can use it from C++ with code like this:

<code>

// Result of COM operations
HRESULT hr;

// COM interface to call the services offered by the ATL component
IYourATLComponent * pATLComponent = NULL;

// Initialize COM
hr = CoInitialize(NULL);
if (FAILED(hr))
... error

// Create an instance of the component
hr = CoCreateInstance(
CLSID_YourATLComponent,
NULL,
CLSCTX_INPROC_SERVER,
IID_IYourATLComponent,
(void**) &pATLComponent
);
if ( SUCCEEDED(hr) )
{
... call component methods using returned COM interface
hr = pATLComponent->DoSomething(...);
}

// Cleanup COM
CoUninitialize();

</code>


HTH,
Giovanni


Ajay

unread,
Apr 17, 2009, 8:42:39 PM4/17/09
to

Your ATL module is simply another COM server so all you need is an
COM client with or without ATL. There are tons of examples at codeguru/
codeproject to do this.

I dont know if your web service was written in .Net. If it is, you
dont need to wrap it with ATL proxy dll. You can use managed code in C+
+ and avoid all the COM stuff.

--
Ajay

0 new messages