api

how i am going to use api function in a mfc based application.Eg: SHGetSpecialFolderLocation function
poonamvisAsked:
Who is Participating?
 
nietodCommented:
There is no reason that you can't use the windows API from an MFC application.  MFC provides a wrapper to most (but not all) of the API, where it doesn't just use API calls.  (You can use API calls even where it does provide a wraper, but that defeats the purpose of using MFC).

0
 
nietodCommented:
If you have a CWnd object that you and you wish to pass its window handle to the function, I believe you cna just specify the CWnd instead of the handle (not a pointer to the CWnd), as I think there is a HWND conversion operator.  If not, then you can just specify the m_hWnd data member.

Let me know if you have questions.
0
 
alexoCommented:
It is customary to explicitly use the global scope.  E.g., ::SHGetSpecialFolderLocation(...)
It lets the programmer use the API even if there's a similarly named member function in scope (as is the case with lots of MFC functions).
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
nietodCommented:
Good point.  That insures there is no problem in the future if an interface function with the same name, but different parameters, is added to MFC.  
0
 
poonamvisAuthor Commented:
Thanks Nietods,I'll keep on taking your help when ever necessary
be free to write to me if any way I can help you reqarding communication programming.
0
 
nietodCommented:
Unfortuantely, communication is not my specialty.  (even with humans--my wife would say.)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.