Solved

Setting a working folder.

Posted on 2000-05-17
11
134 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
Independent Software Vendors: 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 30 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

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 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