Solved

Where to put the files which dll will use?

Posted on 2003-11-25
8
254 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
  • 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
 

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now