You probably went wrong at step #2, given that you didn't get a build error. The wizard gives you more than one choice for the kind of class you add. The default choice is "C++ class", you need to pick ATL + "ATL Simple Object" instead.
The Class View window now shows two types getting added, the IInteropDemo interface and the CInteropDemo class that implements the interface. You next right-click the interface type (not the class) and use "Add Method". You can now also take a look at the IDL file in the project, it should resemble this:
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(CBA0D899-2F4C-4F1D-A935-C80CB981C153),
dual,
nonextensible,
pointer_default(unique)
]
interface IInteropDemo : IDispatch{
[id(1)] HRESULT Method();
};
[
uuid(ED14ACED-4FF9-4144-B302-CC48C481F28B),
version(1.0),
]
library ATLProject4Lib
{
importlib("stdole2.tlb");
[
uuid(8543642F-9927-451C-9784-6A7774418299)
]
coclass InteropDemo
{
[default] interface IInteropDemo;
};
};
That's enough to get it built. Which ought to fail on any modern Windows version, UAC prevents the COM server getting registered. Which requires step #0: Start Visual Studio by right-clicking the shortcut and selecting "Run as Administrator".