Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

api

how i am going to use api function in a mfc based application.Eg: SHGetSpecialFolderLocation function
0
poonamvis
Asked:
poonamvis
  • 4
1 Solution
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now