Solved

Setting a working folder.

Posted on 2000-05-17
11
130 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
  • 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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now