Solved

Setting a working folder.

Posted on 2000-05-17
11
133 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

856 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