Solved

Is it possible to specify WINAPI when calling a function

Posted on 2011-02-12
2
368 Views
Last Modified: 2012-05-11
The following won't compile because GetProcAddress name clashs between the class and WINAPI. If I rename MY_ODBC_DriverMangerClass::GetProcAddress  then it works. Is there any way I can specify the WINAPI call within the body of the class function so I can keep the same function name? Any alternative suggestions?

class MY_ODBC_DriverMangerClass
{
      private:
            HINSTANCE DLLinstance;
      public:
            VOID LoadDriverManager() { DLLinstance = LoadLibrary(_T("odbc32.dll")); };
            FARPROC WINAPI GetProcAddress(__in  LPCSTR lpProcName) {return(GetProcAddress(DLLinstance,lpProcName));};
};
0
Comment
Question by:elcbruce
[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
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 34881195
Just use the scope resolution operator '::' to distinguish between the Windows API and your member function and that will compile fine:
class MY_ODBC_DriverMangerClass
{
      private:
            HINSTANCE DLLinstance;
      public:
            VOID LoadDriverManager() { DLLinstance = LoadLibrary(_T("odbc32.dll")); };
            FARPROC WINAPI GetProcAddress(__in  LPCSTR lpProcName) {return(::GetProcAddress(DLLinstance,lpProcName));};
};

Open in new window

0
 

Author Comment

by:elcbruce
ID: 34882446
That worked, thanks.
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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

724 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