Hi there!

I've got a Delphi7 and i wanna to start with a small project. However I can't do that, so I need help

I've got two sources:

Unit1.pas

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, SHDocVw_TLB, StdCtrls;

type
  TForm1 = class(TForm)
    WebBrowser1: TWebBrowser;
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.

and

Unit1.dfm

object Form1: TForm1
  Left = 294
  Top = 226
  Width = 696
  Height = 376
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object WebBrowser1: TWebBrowser
    Left = 160
    Top = 136
    Width = 300
    Height = 160
    TabOrder = 0
    ControlData = {
      4C000000021F0000891000000000000000000000000000000000000000000000
      000000004C000000000000000000000001000000E0D057007335CF11AE690800
      2B2E126208000000000000004C0000000114020000000000C000000000000046
      8000000000000000000000000000000000000000000000000000000000000000
      00000000000000000100000000000000000000000000000000000000}
  end
  object Button1: TButton
    Left = 80
    Top = 64
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 1
  end
end

I need only this:
1. When I click on Button1 it must close my application
2. The TWebBrowser:
- it's url must be page.htm located in the same folder where application is located
- it can't has a context menu
- i need to deny drag/drop on this object
- and i need to deny keyboard shortcuts like F5, Alt + arrow etc.


Please, can you do this for me.
It will really help me.

Thanx

1) you have put here only the basic code of an delphi form

2) take a look on delphi's examples, especially on coolstuf. from what i know, delphi came with 1 or 2 webbrowsers examples

1. When I click on Button1 it must close my application

Application.Terminate;

2. The TWebBrowser:
- it's url must be page.htm located in the same folder where application is located

Check out the GetCurrentDir routine (I work with more recent Delphi's but assume that is there).
GetCurrentDir+'\page.htm';

- it can't has a context menu
- i need to deny drag/drop on this object
- and i need to deny keyboard shortcuts like F5, Alt + arrow etc.

TWebBrowser has a ton of properties. I think you want MenuBar set to False but not sure about the others. If you are trying to turn off those aspects of the browser, you may need to capture the keystrokes, but if you have something else in mind? This is a start.

Also, why are you working in Delphi 7? Turbo Explorer is available for free, why not work with that and be more current?

Also, why are you working in Delphi 7? Turbo Explorer is available for free, why not work with that and be more current?

Explorer version does not support third party components and that is very big disadvantage :(

Please correct me if I'm wrong

Explorer version does not support third party components and that is very big disadvantage :(

Please correct me if I'm wrong

You're right, but this person is a rank newbie, so won't need any add-ons for a long while. And the upgrade to Turbo Pro is very cheap as compared to other versions, and that DOES take add-ins. Thus my recommendation.

You're going to have to struggle up the learning curve. In this case, for instance, there is no URL property, but the URL is a parameter to the Navigate method of TWebBrowser, just like the Microsoft Explorer object which TWebBrowser is an encapsulation of....sort of.
As for the properties which you can't see in the object inspector, only published properties show up in the object inspector. Public properties can be accessed at runtime, but not in the object inspector.
You may want to do some reading, say at Marco Cantu's site. You say you are a newbie, so I don't know how much you know, but I found Marco's book(s) "Mastering Delphi (version)" incredibly valuable and he has free ebooks, Essential Pascal http://www.marcocantu.com/epascal/default.htm and
Essential Delphi http://www.marcocantu.com/edelphi/default.htm
Also, spend some time with the documentation. Once you understand the basics of the language, the documentation becomes more explanatory.
Other than that, you will have to be a lot more specific about what you are trying to accomplish.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.