Solved

Where to put the files which dll will use?

Posted on 2003-11-25
8
259 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

615 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