?
Solved

Problem calling API functions directly

Posted on 1997-10-31
3
Medium Priority
?
223 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 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

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!

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. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

777 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