Solved

Thaddy>> wher r u ? ( Java applets question )

Posted on 1998-11-11
19
247 Views
Last Modified: 2009-07-29
Hi there, remember that I posted a question about how to use
java applets in delphi ? You told me to email you for some code, and so I did, but still had no response for almost 2 weeks,

did u ever get my email ?

http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10093140

bryan
0
Comment
Question by:bryan7
  • 10
  • 9
19 Comments
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346498
Was on a short break (Dublin) Code on its way
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346499
Bublin ? hmm...    

     germany ?

k, I'll be waiting, thanx,

bryan =)

0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346500
email me your adrress please:thaddy@cyco.nl
I knocked up a simple example for you to control Msword from Jscript
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 3

Author Comment

by:bryan7
ID: 1346501
hi,

I tried the code, but when it loads it says: ( I have Delphi 3, not 4 )
"Error reading Form1.OldCreateOrder: Property doesn't exist. Ignor..."

then I choose "ignore" and when I run it, I get this error:
"File not found: MSScriptControl_TLB.dcu"

at the USES clause over the MMSCript..

bryan


0
 
LVL 3

Author Comment

by:bryan7
ID: 1346502
I think I haven't yet understood what those libs do..

Can I use a Java Applet in my program's form ? I mean, i.e. I have a java applet to make a water reflection effect under an image, ever seen it ?

i.e.: http://geocities.com/SiliconValley/Foothills/2019/lake.htm

bryan
0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346503
All you have to do to get the code working in delphi 4 is:

1) Add the msscript.ocx to the Active X page (Component|Import ActiveX

Download Conert3 from http://www.drbob42.com/
it will convert Delhi4 form files to delphi3 formfiles:-)
the recompile my project

or:
2) Create a form with a standardbutton and a standard memo.
3) Copy the code for the Oncreate handler of the form to your new form
4) Copy the code for the button handler to your form's button handler

The file MsscriptControl_Tlb.pas will be automatically generated in the imports directory.

Now, run the program. If you have EXACTLY what wrote, i guarantee you it will work.

It is alas, almost impossible to write an easier example than this one.

0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346504
Oh, now I see, you don't need scriptsupport, but dhtml support!
You can do this with msscript and you can use applets, provided they are implemented as com classes(See the microsoft documentation on scripting) and that you have an object that supports dhtml, because you write to the html document dynamically. An example is microsofts htmledit ocx.
In principle, you can do what you want, but you need some extra's as I explained.
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346505
.. ehh, ..   some extras ? .. I have no idea on how to do it.
can you be a bit more detailed ?

I'll increase the points if you want.( Let's follow this at http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10093140 )

bryan

0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346506
Well, see, the script engine is nothing more than a way to handle language constructs in a universal way. On top of the Script engine goes a parser that creates a prerry much universal stream of byte codes that can be interpreted by the script engine. This parser can be JavaScript, VBScript, Perl, really any language that supports Objects. Mind the last to words: Objects. You can manipulate these objects using the language keywords, let's say javascript. Now, look in your lake.htm code and look in the JavaScript keyword list. You will notice that 'Document' is not a JavaScript Keyword. It's a HTML key word.
That is because Java Script is embedded/connected (depending on the model) into another object or object family, the browser, that has a HTML object. Now,if you want to implement your *.HTM (As opposed to *.JS) into your application, you need apart from the scripting engine one or more objects that support HTML in addition to Javascript. The HTML and additional objects (Java.classes or com objects) can then be manipulated by the scripting language.
Now for your particular wish:
The easiest solution is to import ms internet explorer as an ocx.
Delphi then creates a Component for you called TWebbrowser.
This will automatically support JvaScript.
Pass the Twebbrower simply the url or disk-path to your Lake.Htm and it will work inside your own Application.
The other solution is a bit more complicated and needs conversion of your HTML script (Note:Not JAVA script, the JavaScript is embedded in HTML) and one ore more objects that implement HTML and are capable of Interpreting Javascript.
MsScript is able to interpret JavaScript
MsDhtmlEdit is Able to interpret Html.
So, you need to design an application that uses the JavaScript Scripting engine to manipulate The Html Object (with it's contained object Html.Document).
Clear?

0
 
LVL 3

Author Comment

by:bryan7
ID: 1346507
hmm.. yeah, .. a bit more clear...

there's something you should know: I've been using Delphi from around 2 months ago,
and never before programmed in any windows' language, only Ms-Dos( basic, C, Pascal, assembler,.. ) ., not even in C++ with objects...

Well, I did this: Component/Import ActiveX control, and added msscript.ocx. then I installed 'Microsoft Script Control 1.0'. Then between those ActiveX controls, I saw
'Microsoft internet Controls' with classes: 'TWebBrowser_V1', 'TWebBrowser', and TShellFolderViewOC'.    Is that what I need ?

bryan

0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346508
Yes, that's all!
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346509
but there's no help on that TWebBrowser component..

bryan

ps: where could I find some help on the ActiveX controls included with Delphi 3 c/s ?

0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346510
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  pvOpenDialog, ExtDlgs, OleCtrls, SHDocVw_TLB;
type
  TForm1 = class(TForm)
    br: TWebBrowser;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var Br2:iwebbrowser2;
begin
  Br2:=br.ControlInterface;
  Olevariant(br2).Navigate2('www.cyco.nl');
end;

end.
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346511
..
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346512
hi there, your example didn't work, it gave me some probs running.
well, anyway, i found a component that does what i wanted. Not the way i wanted, but nearly.

It's like a box, which can contain a HTML page, as if was a browser.
And it includes the needed help about the procedures.

k, drop something as an answer in both questions, so I can close them.
thanx for all,

bryan

0
 
LVL 2

Accepted Solution

by:
Thaddy earned 0 total points
ID: 1346513
It * should have worked *, since I wrote and tested it specially for you. Oh, well, if you need more info, drop me a line.
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346514
well, I would like to find some info on the TWebBrowser and the ActiveX Libraries that appear when i choose " Import ActiveX Control ".
There are many components, but there's no help with them..

bryan

ps: give a comment as an answer at the other question, so it can be closed..

0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346515
Have you tried the codecompletion feature? I use that a lot, and it provides me with enough information.
You can find a lot of info on how to use the webbrowser ocx on the msdn. If you do not have direct access to the msdn, it's also on-line on the ms website. The examples are in c++, VB and VBA and can easily be translated into delphi.
Also, when you read the *_TLB.PAS files you can obtain alot of info of how things work. A reasonable understanding of COM is necessary, however. I'd recommend 'Inside COM' and 'Inside OLE'. Both are heavy reading, but those books are the best way to learn to really understand working with this technology.
Also, knowledge of VB and C++ comes in handy, albeit to translate the stuff to delphi.:-)
0
 
LVL 3

Author Comment

by:bryan7
ID: 1346516
I'll have a trip throught the ms website, k, thanx for all, I'll try to find about COM and OLE too, I'll post a comment if I ever need some help on this again.

bryan

ps: can we close the other question too ?
http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10093140
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

806 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