Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dll question

Posted on 2003-11-12
2
Medium Priority
?
232 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 300 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

Technology Partners: 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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

618 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