Solved

Dll question

Posted on 2003-11-12
2
215 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
2 Comments
 
LVL 19

Accepted Solution

by:
Dexstar earned 75 total points
Comment Utility
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
Comment Utility
thanks. works now.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

763 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

6 Experts available now in Live!

Get 1:1 Help Now