Solved

Where to put the files which dll will use?

Posted on 2003-11-25
8
258 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
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: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 100 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 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…

710 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