Smart Pointers (SQLDMO): Acquiring SQLServer2 interface from SQLServer interface?

M

Mark Findlay

My C++ .Net project currently uses smart points for SQLDMO object
manipulation:

SQLDMO::_SQLServerPtr spSQLServer;
HRESULT hr = spSQLServer.CreateInstance(__uuidof(SQLDMO::SQLServer));
if (FAILED(hr))
{
return;
}

Is there a way I can acquire the SQLServer2 interface from the spSQLServer
object, instead of having to go through the CreateInstance procedure for
SQLServer2?

Given the following declaration, can someone describe how this could be
done?

SQLDMO::_SQLServer2Ptr spSQLServer2;

Thanks!
 
G

Gary Chang[MSFT]

Hi Mark,

After checked the SQLDMO.DLL's type library, we found the _SQLServer2 and
_SQLServer are just 2 different dispatch interfaces to the SQLServer
component:

[
uuid(10020200-E260-11CF-AE68-00AA004A34D5),
version(8.5),
helpstring("SQLDMO Server"),
helpcontext(0x00000258)
]
coclass SQLServer {
[default] interface _SQLServer;
interface _SQLServer2;
[default, source] interface ServerSink;
};

But for the reason that one COM component could only expose one dispatch
interface(e.g. for SQLServer, it expose the interface _SQLServer), so it is
impossible to acquire the SQLServer2 interface from the SQLServer component
whose default dispatch interface is _SQLServer.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top