Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple questions again

Status
Not open for further replies.

sedawk

Programmer
Feb 5, 2002
247
0
0
US
Hi,

Here are some basic VC++ questions I have while I am learning it:

1. BOOL APIENTRY DllMain()

I don't know if it is necessary to have APIENTRY keyword and the name "DllMain" is fixed. Can I use other name such as "DLLMAIN"?

2. std::string str
I couldn't find the MSDN definition about this type declaration when I highlighted it and press F1. What property of std has? what is the difference between std::string str and,
string str?

3. CCaptureFrame::CCaptureFrame()
: CWindowImpl <CCaptureFrame> (),
m_hVfwWnd(NULL),
m_bPreview(false),
m_bStretch(false),
m_bProportional(false),
m_pFormat(NULL),
m_hIC(NULL),
m_dwFrames(0)

From the above declaration, I know the first line is a derived class method(function) by double colon. But what does the second line the single colon mean here? Within the carat &quot;CCapturFrame&quot; means what? Can I use something like:

CCaptureFrame:public CWindwoImpl

for the second line?

Thanks.
 
two answers :
2. std is a namespace, something like a pacjage in ADA (if
you know this language). It is an area of code that
encapsulates type definitions, variables, etc. You can omit
the &quot;std::&quot; prefix by s &quot;use&quot; statement as follows:
using namespace std;
at the begining of your code segment.
string is simply a class (type) declared withing the std namespace
3.The caret identifies the CWindowImpl class as a template class. A template is a generic class that can accept one or more arguments that modify it's behaviour. Read about those in any C++ book. The notation of a colon in a constructor class designates a call to a base class constructor, so if

class AClass : public Class BaseClass
and the constructor of AClass receives a parameter that has
to passed on to the base class, the notaion is

ClassA::ClassA(Param):BaseClass(Param)
{
//Some Code
}

Another reason to use this notation, even withou parameters
to the CTOR is if the base class is a template, like the
example you brought, when the CTOR call the instantiated
CTOR of the Base clas with the desired Template parameter.

Good Luck
======
SeekerOfKnowledge
======
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top