[uuid(336389EB-B3BA-4278-9107-28EA51F552DA)]
interface IParserFile : IUnknown
{
HRESULT LoadFile( [in, string]char *strFileName );
};
programming interfaces
i am trying to create an interface
but it keeps having compiling errors. does anyone know a good website that explains them really well? Do they work like C++ classes with public, private, protected ?
thanks!
What you posted is not C++... C++ has no support for interfaces. If you want to do an interface, just create a class and make all functions pure virtual...
Oxyd
Oxyd
Quote:Original post by guyaton
i am trying to create an interface
*** Source Snippet Removed ***
but it keeps having compiling errors. does anyone know a good website that explains them really well? Do they work like C++ classes with public, private, protected ?
thanks!
Also, telling us that you have errors is not helpful in the slightest, atleast give us the errors you are getting.
Ok, this is what I have so far:
and here's the errors:
error C3303: 'in': attribute can only be used on 'interface methods, interface method parameters, method parameters, idl_module methods'
eerror C3303: 'string': attribute can only be used on 'members, interface methods, interface method parameters, method parameters, idl_module methods, typedefs'
thanks for all the help
[uuid(336389EB-B3BA-4278-9107-28EA51F552DA)]interface IParserFile : IUnknown{ IParserFile(); HRESULT LoadFile( [in, string]char *strFileName );};typedef IParserFile *LPPARSERFILE;
and here's the errors:
error C3303: 'in': attribute can only be used on 'interface methods, interface method parameters, method parameters, idl_module methods'
eerror C3303: 'string': attribute can only be used on 'members, interface methods, interface method parameters, method parameters, idl_module methods, typedefs'
thanks for all the help
A short description of the macro magic involved.
Only explains some of the technical details of declaring a COM interface manually though.
I'm guessing that sample code uses attributed C++, something I doubt you'll get much help with on gamedev.
Only explains some of the technical details of declaring a COM interface manually though.
I'm guessing that sample code uses attributed C++, something I doubt you'll get much help with on gamedev.
i know this is a big streach and i appriciate the help 'n support....once you create one, how do you create an instance of it, because as we all know these are not allowable:
Microsoft has functions that "create" them for example
how would i create one of those?
thanks!
LPPARSERFILE test = NULL;test = new IParserFile();IParserFile test;
Microsoft has functions that "create" them for example
LPDIRECTXFILE lpDXFile;hr = DirectXFileCreate( &lpDXFile )
how would i create one of those?
thanks!
Quote:Original post by guyatonThere's nothing magical about the construction of COM objects.
i know this is a big streach and i appriciate the help 'n support....once you create one, how do you create an instance of it, because as we all know these are not allowable:
*** Source Snippet Removed ***
Microsoft has functions that "create" them for example
*** Source Snippet Removed ***
how would i create one of those?
thanks!
Just add a constructor as usual or make it private and wrap it up in an external function like microsoft does.
The reason that you might want do make it external is that the interface is generally fully virtual and any constructor is placed in the actual (and internal) class implementation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement