?
Solved

Problem calling API functions directly

Posted on 1997-10-31
3
Medium Priority
?
225 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
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 400 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

850 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