Sign in to follow this  

[.net] help! No ATL in VC8

This topic is 4299 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

It's been a while since I've done any programming with COM in C++ but I'm wanting to play with D3D10 and VC8 express but... you can't mix unmanaged dx10 and managed c++... So I decided to try to make a COM DLL wrapper for DX10 but there is no ATL for attributes for COM... So... how do I make a COM server in VC8 express?

Share this post


Link to post
Share on other sites
I did that (download the platform SDK) but it now claims that there is no IDispatch base class....

f:\users\wxb1\documents\visual studio 2005\projects\d3dgraphics\d3dgraphics\d3dgraphics.cpp(27) : error C2504: 'IDispatch' : base class undefined
f:\users\wxb1\documents\visual studio 2005\projects\d3dgraphics\d3dgraphics\d3dgraphics.cpp(27) : error C2504: 'IDispatch' : base class undefined
f:\users\wxb1\documents\visual studio 2005\projects\d3dgraphics\d3dgraphics\d3dgraphics.cpp(34) : warning C4581: deprecated behavior: '"apartment"' replaced with 'apartment' to process attribute
f:\users\wxb1\documents\visual studio 2005\projects\d3dgraphics\d3dgraphics\d3dgraphics.cpp(41) : error C2470: 'CGraphicsManager1' : looks like a function definition, but there is no parameter list; skipping apparent body
f:\users\wxb1\documents\visual studio 2005\projects\d3dgraphics\d3dgraphics\d3dgraphics.cpp(66) : fatal error C1004: unexpected end-of-file found
Build log was saved at "file://f:\Users\wxb1\Documents\Visual Studio 2005\Projects\D3DGraphics\D3DGraphics\Debug\BuildLog.htm"
D3DGraphics - 4 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

[Edited by - wxb1 on March 5, 2006 6:39:16 PM]

Share this post


Link to post
Share on other sites
Here's the source... It just some skeleton code I decide to use since I haven't played with COM in a while:

// D3DGraphics.cpp : Defines the entry point for the DLL application.
//
#include "D3DGraphics.h"
#include "stdafx.h"


#ifdef _MANAGED
#pragma managed(push, off)
#endif

// The module attribute is specified in order to implement DllMain,
// DllRegisterServer and DllUnregisterServer
[ module(dll, name = "D3DGraphics", helpstring = "D3DGraphics Server 1.0 Type Library") ];
[ emitidl ];

/////////////////////////////////////////////////////////////////////////////
// IGraphicsManager
[
object,
uuid("103FF9D9-8BC9-4ea8-8CD4-C1E627D04358"),
dual,
helpstring("IGraphicsManager Interface"),
pointer_default(unique)
]

__interface IGraphicsManager1 : IDispatch
{
HRESULT GetANum([out, retval]int* pInt);
};
/////////////////////////////////////////////////////////////////////////////
// CObject1
[
coclass,
threading("apartment"),
vi_progid("D3DGraphics.GraphicsManager1"),
progid("D3DGraphics.GraphicsManager.1"),
version(1.0),
uuid("15615078-523C-43A0-BE6F-651E78A89213"),
helpstring("GraphicsManager1 Class")
]
class ATL_NO_VTABLE CGraphicsManager1 :
public IGraphicsManager1
{
public:
CGraphicsManager1()
{
}
HRESULT GetANum(int* pInt){
*pInt = 101;
return S_OK;
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}

void FinalRelease()
{
}

#ifdef _MANAGED
#pragma managed(pop)
#endif

Share this post


Link to post
Share on other sites

This topic is 4299 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this