Solved

api

Posted on 1998-11-10
6
258 Views
Last Modified: 2010-04-02
how i am going to use api function in a mfc based application.Eg: SHGetSpecialFolderLocation function
0
Comment
Question by:poonamvis
  • 4
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
Comment Utility
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
 
LVL 22

Expert Comment

by:nietod
Comment Utility
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
 
LVL 11

Expert Comment

by:alexo
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 22

Expert Comment

by:nietod
Comment Utility
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
 

Author Comment

by:poonamvis
Comment Utility
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
 
LVL 22

Expert Comment

by:nietod
Comment Utility
Unfortuantely, communication is not my specialty.  (even with humans--my wife would say.)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now