?
Solved

Setting a working folder.

Posted on 2000-05-17
11
Medium Priority
?
137 Views
Last Modified: 2010-05-02
I've created an application the uses an external DLL. This DLL is currently in the same path as my VB project.
When I run the project trough VB it can't find this DLL. But when I run this project by double clicking on the *.vbp file, its O.K.
Does anyone know how to overcome this problem?!

In my project I wrote the following:
Declare Function MyFuncion Lib "MyDLL.dll"


0
Comment
Question by:yafita
[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
  • 6
  • 3
  • 2
11 Comments
 
LVL 2

Expert Comment

by:BobbyOwens
ID: 2816759
VB uses a different path wor it's working folder. Why don't you put the DLL in the Windows System path?
0
 
LVL 2

Expert Comment

by:BobbyOwens
ID: 2816765
I've just checked. If you open VB via the EXE and then open the directory, the current directory is treated as where VB has been installed. If you double click a VBP, the current directory is that of the project.

You need to either always double click the VBP, or put the DLL in the VB path.

You could also try chaning the current directory to the App.path before calling the DLL
0
 
LVL 2

Expert Comment

by:BobbyOwens
ID: 2816782
....Forgot to mention. Make sure the VBP is on the same drive as VB. If it isn't, you'll need to run:

ChDrive DriveLetter

before running

ChDir app.path
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!

 

Author Comment

by:yafita
ID: 2816983
How ca I change the current directory to App.path?
0
 

Author Comment

by:yafita
ID: 2816991
How ca I change the current directory to App.path?
0
 
LVL 2

Expert Comment

by:BobbyOwens
ID: 2817367
ChDir app.path
0
 
LVL 2

Accepted Solution

by:
BobbyOwens earned 120 total points
ID: 2817382
ChDir app.path
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2817521
why dont you just add a reference to this dll?
0
 
LVL 2

Expert Comment

by:BobbyOwens
ID: 2818371
I thought you could only add references to COM dll's. This sounds like and API style DLL.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2818389
yeah but since i dont know i gave a suggestion
also it strikes me funny he is having this problem so long as the more common dlls are in windows/system directory and are thus registered there. the program should automatically find it
0
 

Author Comment

by:yafita
ID: 2820081
Thanks. It is fixed now.
And you're right. It is an API DLL (and I can't put it in the system library...).
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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

741 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