Solved

Dll question

Posted on 2003-11-12
2
220 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

827 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