Solved

Problem calling API functions directly

Posted on 1997-10-31
3
222 Views
Last Modified: 2013-12-14
I am designing a user interface for Win 95 using Microsoft Visual C++ 5.0.  I have not been able to directly call an API function.  I have had no problem accessing them through the MFC library classes though.  For example, I used the CFileDialog class to implement a file open dialog box but when I tried calling the API function, GetOpenFileName() directly nothing happens during execution.  No compile or link error during build.  When I run the debugger and try to step into GetOpenFileName(), it was skipped over without even hitting the first internal line of code.  A call to GetOpenFileName() was in the assembly code when I checked.  Now, I need a simple audible ‘beep’ for my interface and I want to directly call another API function, Beep().  I haven’t found a MFC library class that encompasses Beep() so I am trying to call the API function directly.  Any ideas why I am having problems calling API functions directly?
0
Comment
Question by:chele
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1172332
If you're in the context of a CWnd-derived class's functions, then you will need to use :: (scope resolution operator) to use the global functions.

For example, use ::GetOpenFileName() to call the global version (API version).

If you want a beep, take a look at the online help for ::MessageBeep(). You can pass a parameter for what types of beep you want.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1172333
Are you sure the API function is not executing?  Microsoft's debugger will not step into an API function.  This is to try to keep its workings secret (other debgers will, however.)  However the debugger will still run the function, it just won't step into it.  
0
 

Author Comment

by:chele
ID: 1172334
Thanks again thui!
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

688 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