Solved

api

Posted on 1998-11-10
6
260 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
ID: 1177438
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
ID: 1177439
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
ID: 1177440
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 22

Expert Comment

by:nietod
ID: 1177441
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
ID: 1177442
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
ID: 1177443
Unfortuantely, communication is not my specialty.  (even with humans--my wife would say.)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

813 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

14 Experts available now in Live!

Get 1:1 Help Now