Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Setting a working folder.

Posted on 2000-05-17
11
Medium Priority
?
138 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 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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

610 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