Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Where to put the files which dll will use?

Posted on 2003-11-25
8
Medium Priority
?
260 Views
Last Modified: 2010-05-03
Hello!

I have another question again. I have created a Matlab Com Dll with matlab's tool "comtool", this dll will read some input files in the current directory and do some computation. I can run the matlab .m file correctly in Matlab. Now I want to call this dll in Visual Basic. I have successfully register the Dll and other things related with the Dll correctly in the visual basic program.  When I tried to run the visual basic program, it seems my Dll worked and tried to open those files. But I get an error "can't open file xxxx.txt", where xxxx.txt needs to be opened by the Dll.

I have put those files in the same directory where my DLL located, or my visual basic program located, or c:\windows\system, or c:\windwos\system32. But I still get that error.

Could someone tell me how to solve this problem?

Thanks a lot.
0
Comment
Question by:yangye
[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
  • 5
  • 3
8 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9821771
try putting the file in the same directory where your VB.EXE is located.

It would appear, if the error message simply names the file, without any path, that the file is assumed to be 'local' - that is, in the directory from which the program is executing.

AW
0
 

Author Comment

by:yangye
ID: 9822098
Thanks Arthur_wood. But it is regret that I still haven't solved the problem yet. My VB is a visual basic macro in the Excel and I don't have a separate visual basic software. I searched the directory of the Excel.exe and put the files there, and I still got the same error. I tried to search VB.exe but didn't find it. Any more suggestions?

Thanks.
0
 

Author Comment

by:yangye
ID: 9822124
Sorry, the error message includes the directory name, like can't open c:\temp\test.txt

Could someone help me what's wrong with my program?
0
Industry Leaders: 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:yangye
ID: 9822132
And I had put that file, i.e., test.txt in the directory of c:\temp, but still get the error message
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 200 total points
ID: 9822421
Does the MatLab documentation have any information about where the file is to be located.  I would contact the Mathworks (vendor of MatLab) at

http://www.mathworks.com/support/

and see it they can shed some light on whre to place the file.

AW

0
 

Author Comment

by:yangye
ID: 9824843
Thank you, AW. I will contact Matlab. I am still working on the problem now.
0
 

Author Comment

by:yangye
ID: 9825287
I have contacted the Matlab technical support and known from them that this problem was caused by the limitation of their compiler. Since I used "load("xxxx.txt") " in my Matlab .m file to load the data, where Matlab C compiler doesn't support ASCII file for loading the data. I can use other functions of Matlab such as fopen, fread, or I can use load("xxxx.mat") format ot solve this problem, where .mat file is a binary file rather than ASCII file.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9826512
never having used, (or needed to use for that matter) Matlab, what you said means almost NOTHING to me, but it it makes sense to you, then great.

AW
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
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…
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

719 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