?
Solved

Check for library exist or not.

Posted on 2003-03-21
7
Medium Priority
?
168 Views
Last Modified: 2010-05-01
I have a program with reference to MS Office libraries. If my program is installed in a computer without MS Office, How could I check that so that my program could run correctly?
0
Comment
Question by:chpchai
[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
7 Comments
 
LVL 1

Expert Comment

by:FunkyMeister
ID: 8200050
Any function that hasn't been used won't load the dll needed for it until it actually happens, find an obscure function in the dll that does little (or doesn't do anything bad), give it values it can use to do little with (or not) and call the function, the standard "File Not Found" will happen if the library doesn't exist.

Error #53, "File Not Found".

Quickest way to know a DLL (even when it SHOULD exist) isn't loading correctly, either because it went bad or isn't there.
0
 

Author Comment

by:chpchai
ID: 8216618
Could you give me more explaination, I am not sure how to do.
0
 
LVL 1

Accepted Solution

by:
FunkyMeister earned 80 total points
ID: 8218410
On Error GoTo CallDied
Call [some API call here]
On Error GoTo 0 ' API call was nice.

....

GoTo EndOfRoutine

CallDead:
if Err.Number = 53 then
 Msgbox "Required DLL Missing!" ' Keep it Cryptic, the Microsoft way.
 GoTo [Code to exit program cleanly] ' Or call function that terminates the program.
' Other error checking here.
Resume Next

EndOfRoutine:
Exit Sub/Function here

0
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!

 
LVL 1

Expert Comment

by:FunkyMeister
ID: 8218437
The Call [some API call here] is where you call your DLL or Any DLL for that matter.  Typically, if you want to have a global function that does error testing then place a value (boolean) around the call:

DllCall = True
Call [DLL]
DllCall = False

Then in the CallDead routine:

if Err.Number = 53 Then   replaces to if Err.Number = 53 And DllCall = True Then

The Resume Next will take the DllCall back to false, if it's not a serious error (like a bug in your code, no wait, it's not bug, it's an ISSUE, yes, thats it, ISSUE.  Someone grab me a tISSUE).
0
 

Expert Comment

by:CleanupPing
ID: 8531845
Hi chpchai,
This old question (QID 20559346) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8982563
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in a week or two.  I would appreciate any comments by the experts that would help me in making a recommendation.
It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp

GPrentice00
Cleanup Volunteer
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9046157
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept FunkyMeister's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

771 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