Solved

Dll question

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

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…
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 concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

732 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