ActiveForm and read deployed files.

Hi all,
I want to deploy a ActiveForm and a file (textfile). Now I want to read the text file and show it in a memo field. How is the pathname to load the txt file.
Memo1.Lines.LoadFromFile('?');

Micha
PROGRAMMING030999Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
An easier way might be to load the file into the memo field at design time --> No need to deploy an additional file and no worries about where it is.

Cheers,

Raymond.

0
PROGRAMMING030999Author Commented:
Hi rwilson,
thanks for your comment and
you are right with a txtfile, *but* the txtfile is only an example.

Micha
0
rwilson032697Commented:
Hmm.. I'm not sure about this, but if you have the Application Object available (though probably not), you could do ExtractFilePath(Application.Exename)+'\MyTextFile.txt';

Cheers,

Raymond.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

intheCommented:
hi
one way is to have a small install program that asks for path names on install so you can then save this path in registry then always know where the file is.
0
PROGRAMMING030999Author Commented:
to rwilson:
that I tried already. And I got C:\windows\dektop back.

to inthe:
Do mean a install program in the OCX?

More Questions:
How do I get the root path?

In the inf file there is a DestDir = 11 entry (system folder), is there to modify it? The Macromedia people make a MacroMed folder in the Window directory?


Mich el
0
PROGRAMMING030999Author Commented:
Adjusted points to 200
0
intheCommented:
you can get the system path by using the  GetSystemDirectory() Api:

For example:

var
lpBuffer: array[0..255] of char;
SysDir: string;
begin
GetSystemDirectory(lpBuffer, 255);
SysDir := lpBuffer;
....
end;

about the install i meant make a small instalation app that copys your files to a folder and writes this path to the registry so when your program needs to know this path to your files it can read the path from the registry.
 
0
intheCommented:
this install app could also register your ocx for you if needed.
this is the sort of thing installshield does.
0
PROGRAMMING030999Author Commented:
Thanks inthe!
GetSystemDirectory worked.

And did you know, how to get the root path of an ActiveX in the IE?

500 Points for a little example :)

Mich el
0
rwilson032697Commented:
In your case it should be <System Directory>\Downloaded Program Files

(Assuming, of course, its downloaded by windows from a web page)

Cheers,

Raymond.
0
intheCommented:
well this is guess :

var
ocxpath : cardinal;
begin
ocxpath:=pchar(ExtractFilePath(ParamStr(0))+'blah.ocx');
where blah.ocx is name of your activeX

note:
  this is untested ;-)
0
intheCommented:
actually thats wrong what i last said because now the ocx is in the cache loaded by explorer so the paramstr(0) will give iexplorers path name.i dont think it will know what its own proper path is unless you either hardcode it or write it somewhere..
0
PROGRAMMING030999Author Commented:
Hi,
I did not need the rootpath now, I think I could use chdir.

Mich el
0
intheCommented:
hi,
i found the proper method to get directory of activeform.
GetModuleFilename(HInstance, ModuleName, SizeOf(ModuleName)). ModuleName can be declared as an array [0..255] of Char.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PROGRAMMING030999Author Commented:
Thanks again inthe!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.