Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: URL parsing; how annoying can it be Pin
Rob Caldecott10-Nov-02 23:12
Rob Caldecott10-Nov-02 23:12 
GeneralRe: URL parsing; how annoying can it be Pin
spod11-Nov-02 1:09
spod11-Nov-02 1:09 
GeneralDockable streched toolbar Pin
Anonymous10-Nov-02 22:07
Anonymous10-Nov-02 22:07 
GeneralPrinting Job Status Query Pin
jmarcos10-Nov-02 20:36
jmarcos10-Nov-02 20:36 
Generalsimple question: casting Pin
devvvy10-Nov-02 20:25
devvvy10-Nov-02 20:25 
GeneralRe: simple question: casting Pin
Michael Dunn10-Nov-02 20:31
sitebuilderMichael Dunn10-Nov-02 20:31 
GeneralRe: simple question: casting Pin
Christian Graus10-Nov-02 20:37
protectorChristian Graus10-Nov-02 20:37 
GeneralRe: simple question: casting Pin
ian mariano10-Nov-02 20:34
ian mariano10-Nov-02 20:34 
All that's going on here is the code is returning the proper interface requested through the QueryInterface call. What may be confusing you is the double cast, e.g., first a cast to an IUnknown*, then to LPVOID.

They're first casting to the proper interface (the one that was requested), then "stuffing" the ppv return variable with that interface. They have to cast to LPVOID because that's the variable type, even though its unecessary since casting to void* is native.

"Casting" is just making one thing appear to be another and is used quite often in C / C++ programming, though it may be "unsafe" because you could lose things in the translation.

In C++, some programmers consider it better to explicitly state that you are casting, such as using reinterpret_cast. That way the intent is clear:

IUserInfo* pUI = reinterpret_cast<IUserInfo*>(this);
*ppv = reinterpret_cast<LPVOID>(pUI);


Either way is acceptable. I try not to cast as much as possible, but if I do, tend to use the latter unless I'm feeling carpal tunnel from all the extra typing /:]

"The greatest danger to humanity is humanity without an open mind."
  - Ian Mariano - http://www.ian-space.com/

Generalstill confused Pin
devvvy10-Nov-02 22:18
devvvy10-Nov-02 22:18 
GeneralRe: still confused Pin
ian mariano11-Nov-02 7:39
ian mariano11-Nov-02 7:39 
GeneralRe: still confused Pin
devvvy11-Nov-02 14:47
devvvy11-Nov-02 14:47 
GeneralRe: still confused Pin
s o v a n n16-Nov-02 15:28
s o v a n n16-Nov-02 15:28 
QuestionWhere/How can I download the newest MSDN iso file? Pin
George210-Nov-02 19:55
George210-Nov-02 19:55 
AnswerRe: Where/How can I download the newest MSDN iso file? Pin
Christian Graus10-Nov-02 20:40
protectorChristian Graus10-Nov-02 20:40 
GeneralRe: Where/How can I download the newest MSDN iso file? Pin
George210-Nov-02 22:00
George210-Nov-02 22:00 
GeneralWrappers of Variants, smart pointers and bstrs Pin
Anonymous10-Nov-02 18:14
Anonymous10-Nov-02 18:14 
GeneralRe: Wrappers of Variants, smart pointers and bstrs Pin
Christian Graus10-Nov-02 18:21
protectorChristian Graus10-Nov-02 18:21 
GeneralPOP 3 server Pin
Shamoon10-Nov-02 17:09
Shamoon10-Nov-02 17:09 
GeneralRe: POP 3 server Pin
Daniel Turini10-Nov-02 20:12
Daniel Turini10-Nov-02 20:12 
GeneralRe: POP 3 server Pin
Scott H. Settlemier11-Nov-02 5:31
Scott H. Settlemier11-Nov-02 5:31 
QuestionHow to debug a screensaver? Pin
phped10-Nov-02 16:45
phped10-Nov-02 16:45 
AnswerRe: How to debug a screensaver? Pin
Christian Graus10-Nov-02 16:59
protectorChristian Graus10-Nov-02 16:59 
GeneralRe: How to debug a screensaver? Pin
phped10-Nov-02 17:26
phped10-Nov-02 17:26 
AnswerRe: How to debug a screensaver? Pin
Larry Antram10-Nov-02 17:43
Larry Antram10-Nov-02 17:43 
GeneralRe: How to debug a screensaver? Pin
phped10-Nov-02 20:22
phped10-Nov-02 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.