Solved

Problem calling API functions directly

Posted on 1997-10-31
3
217 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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…

911 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

25 Experts available now in Live!

Get 1:1 Help Now