Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I embed/view diff file types in one form? 1

Status
Not open for further replies.

LucieLastic

Programmer
May 9, 2001
1,694
GB
hi all

I have an app which users can drag and drop different file types in to (eg .xls, .doc, .txt, .pdf, .htm etc). I'd like to be able to view the file in a form where the user can accept or reject the file before continuing.

This works for .xls and .doc files but not .txt and .htm. These are the only 4 types I've tried so far.

FormViewMaterialFile.OLEContainer.CreateObjectFromFile(Materialfilename, False);
FormViewMaterialFile.OLEContainer.Run;

if FormViewMaterialFile.ShowModal = MRCancel then EXIT;

Would it work if I use ShellExecute and set the parent to my form? off to try it...

Many thanks for help
lou

www.radbmx.co.uk
 
I couldn't get the ShellExecute and parent thing working, unfortunately.

Can anyone help on my initial problem? I've since tried it on a .pdf file and that worked too. It still doesn't work for the .txt and .htm files and I can't figure it out.

www.radbmx.co.uk
 
I've managed to get the files displayed using TWebBrowser:

Flags := navNoHistory;
WebBrowser.Navigate(WideString(CurrentFileName), Flags);

I use the TOLEContainer for Word and Excel files and WebBrowser for everything else. Word and XL files can also be displayed in the TWebBrowser but it always prompts the user first to Open or Save the file.

www.radbmx.co.uk
 
A star for solving it on your own.
If still having prob with ShellExecute, searching the forum will find you several examples.

Roo
Delphi Rules!
 
We should probably expand on that, roo0047: "A star for solving it on your own and reporting your progress or success." People often forget that this forum is also a reference, and others who follow can find a complete problem/discussion/solution useful, even when the OP solves his/her own problem.
 
I couldn't agree with you more. All too often solutions are offered and we never know the final outcome.

Roo
Delphi Rules!
 
And as has been suggested to me elsewhere, sometimes we just need a push to figure it out ourselves. Whether or not that push deserves a Star is debatable, but personally I wouldn't Red Flag it! Commiserations to Roo!

There was a girl I used to work with who would sometimes ask, "Can you be my teddy bear?".

She explained that when she had a problem as a little girl it often helped to have a chat with her teddy bear. The teddy bear wouldn't offer any advice (obviously) but was a good listener and the process of explaining the problem often produced the solution.

So, when she had a problem with code she would sometimes sit with someone and explain the problem. The "teddy bear" didn't have to be a programmer to help.



Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
One more thing to add. To clear the WebBrowser component, set it to a blank page#:

webBrowser.Navigate('about:blank');

I realised I had to do this as .pdf files were getting locked once they'd been opened.

www.radbmx.co.uk
 
LucieLastic (or any other active forum member) Using webBrowser.Navigate, I wanted to create a script that would capture hourly jpegs from here: but I've run out of time. I've been capturing them manually in this format: [Ikemm-hh.jpg] (sample: "Ike12-11.jpg") because I live in the path (Houston). I expect the lights to go out ib about 6 hrs. and will no longer be able to capture. Thanks in advance for your assistance. Your prayers are appreciated. No need to express. We shall survive! God bless

Roo
Delphi Rules!
 
Sorry to have hijacked the thread, occasionally we all need a "teddy bear".

(Offline 2 days - not a single post. Interesting.)
 
(Offline 2 days - not a single post. Interesting.)

Interesting in a certain way, how is that?

1) Most Delphi use on this site is in the area that Ike hit? I don't know.

2) Everyone has projects going that they are figuring out or don't have time to post? I don't know.

I'm falling in the #2 category (I pulled out my old decimal math unit and have been looking it over, lately.), though #1 has definitely been a factor, too.

Glad to see that you're back in action, so to speak. Hopefully people will pull together and clean things up there.

----------
Measurement is not management.
 
OT - Actually just an interesting coincidence. If you've ever experienced an information blackout, you understand the need to catch up on email, forums and current events, to name a few. At 2 days, I'm one of the lucky ones, since so many are still in blackout.

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top