By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,918 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,918 IT Pros & Developers. It's quick & easy.

What does "::DestroyWindow(hWnd)" mean?

P: n/a
I read a piece of code, and the code looks like the following part.

CWnd is a MFC class

class CFrameGrabber : public CWnd {
....
};

BOOL CFrameGrabber::Create(int x, int y, CWnd *pParentWnd) {
.......
if( !capDriverConnect(hWnd, DEFAULT_CAPTURE_DRIVER)) {
::DestroyWindow(hWnd);
return FALSE;
}
.......
}

My question is: This is a correct code, and what does the preceding
"::" of the DestroyWindow(hWnd) really mean here? If I remove the
preceding "::" from the DestroyWindow(hWnd), the compiler will call the
inherited DestroyWindow() from CWnd class and generate an error.

I can not find any reference about the usage of "::" like this.
Previously, I've only seen something like A::test()....

Thanks

Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
* Joseph:
::DestroyWindow(hWnd);

My question is: This is a correct code, and what does the preceding
"::" of the DestroyWindow(hWnd) really mean here? If I remove the
preceding "::" from the DestroyWindow(hWnd), the compiler will call the
inherited DestroyWindow() from CWnd class and generate an error.
'::' refers to the global namespace. It ensures you're referring to a
freestanding function (or something) outside any namespace.

I can not find any reference about the usage of "::" like this.
Previously, I've only seen something like A::test()....


That's exactly the same, provided 'A' is a namespace name -- the name of
the global namespace is just nothing.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #2

P: n/a
no, the *most* annoying thing is someone that thinks they have the right
to tell others what to do when they're not asked to do so.
Alf P. Steinbach wrote:

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Jul 23 '05 #3

P: n/a
[re-arranged to be more readable :-)]

"jeremiah johnson" <jj******@psg.com> wrote in message
news:ARtDe.189819$xm3.69621@attbi_s21...
Alf P. Steinbach wrote:

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


no, the *most* annoying thing is someone that thinks they have the right
to tell others what to do when they're not asked to do so.


Oh, c'mon...lighten up. It's just Alf's usual signature. It conveys a
useful message, and in a humorous way at that.

-Howard
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.