Solved

Dll question

Posted on 2003-11-12
2
226 Views
Last Modified: 2010-04-01
I want to make a little program which uses a dll, but only if the dll is available. If the dll isn't available, the program should give just a messagebox.

I tried it, but it doesn't works when the dll isn't available (it gives an error which says that the dll can't be found, which is normal).
How can this be done ???
Thanks.
0
Comment
Question by:teuntje
[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 19

Accepted Solution

by:
Dexstar earned 75 total points
ID: 9735135
teuntje:

> I want to make a little program which uses a dll, but only if the dll is
> available. If the dll isn't available, the program should give just a messagebox.

> I tried it, but it doesn't works when the dll isn't available (it gives an
> error which says that the dll can't be found, which is normal).
> How can this be done ???

If you are using the DLL via a .lib file, then that is the behavior that you are going to get.  If you want to handle a missing DLL differently, then you will have to use the Win32 APIs.

First call "LoadLibrary" and if that fails, then the DLL is missing.  Then you can call "GetProcAddress" to get the address of the function.

It is more work, but it is nicer on your users.

Hope that helps,
Dex*
0
 
LVL 2

Author Comment

by:teuntje
ID: 9735307
thanks. works now.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

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