Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

½«WordǶÈëDelphiÖÐ

°æȨÉùÃ÷£ºÔ­´´×÷Æ·£¬ÔÊÐíתÔØ£¬×ªÔØʱÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕ ԭʼ³ö´¦ ¡¢×÷ÕßÐÅÏ¢ºÍ±¾ÉùÃ÷¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£http://bigpower.blog.51cto.com/209892/90287
unit Main;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls,Comobj;
type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Panel1Resize(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    FComApp:OleVariant;
    gWaveHwnd:Hwnd;
  public
    { Public declarations }
    procedure SetParentWindow(pParent: TWinControl);
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
  Word : Variant;
begin
  FComApp := CreateOLEObject('Word.Application');
  FComApp.Documents.Open(extractfilepath(Application.ExeName)+'\test.doc',false);
  FComApp.Visible := True;
  Label1.Caption := FComApp.ActiveWindow.Caption;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
  SetParentWindow(Panel1);
end;
procedure TForm1.Panel1Resize(Sender: TObject);
begin
  if gWaveHwnd<>0 then
  begin
    FComApp.ActiveWindow.Height := Panel1.Height;
    FComApp.ActiveWindow.Width := Panel1.Width;
    Windows.MoveWindow(gWaveHwnd,0,0,Panel1.Width,Panel1.Height,false);
  end;
end;
procedure TForm1.SetParentWindow(pParent: TWinControl);
var
  lWaveHwnd : Hwnd;
  lWidth, lHeight: Integer;
  lWindowCap


Ïà¹ØÎĵµ£º

DelphiÖлæÖÆÔ²½Ç¾ØÐεĴ°Ìå

ÖÆ×÷Ô²½Ç¾ØÐεĴ°Ì壺
01.procedure TPortForm.FormCreate(Sender: Tobject);
02.var hr :thandle;
03.begin
04.hr:=createroundrectrgn(0,0,width,height,20,20);
05.setwindowrgn(handle,hr,true);
06.end;
Èç¹û²»Òª´°ÌåÍâ¿ò£¬ÔòʹÓãº
01.procedure TPortForm.FormCreate(Sender: Tobject);
02.var hr :thandl ......

delphiÖÐWEBBrowserÍøÒ³JSº¯Êýµ÷ÓÃdelphiº¯Êý

1.1¡¢¼¤»î
var doc,url:Olevariant ;
begin
url:='about:blank' ;//»òÕßÒ»¸öÓÐʵ¼ÊÒâÒåµÄurl
WebBrowser1.Navigate2(url);//ÕâÑù¾Í¼¤»îÁË£¡
end;
1.2¡¢Ð´HTML´úÂë
var doc:Olevariant ;
s:string;
begin
doc:=WebBrowser1.Document;
doc.clear;//Çå³þÔµÓÉÄÚÈÝ£¬ÒÔ±ãдÐÂÄÚÈÝ
doc.write('<html>');
//ÆäË ......

×ܽáÒ»ÏÂdelphiÖÐSQLÓï¾äÖÐÒýºÅ

×ܽáÒ»ÏÂSQLÓï¾äÖÐÒýºÅ(')¡¢quotedstr()¡¢('')¡¢format()ÔÚSQLÓï¾äÖеÄÓ÷¨ÒÔ¼°SQLÓï¾äÖÐÈÕÆÚ¸ñʽµÄ±íʾ(#)¡¢('')
ÔÚDelphiÖнøÐÐ×Ö·û±äÁ¿Á¬½ÓÏà¼Óʱµ¥ÒýºÅÓÃ('''),ÓÖÒýºÅÓÃ('''')±íʾ
Ê×Ïȶ¨Òå±äÁ¿
var
AnInt:integer=123;//ΪÁË·½±ãÔڴ˶¼¸øËüÃǸ³³õÖµ¡£ËäÈ»¿ÉÄÜÔÚÒý¸³³õÖµÔÚijЩÇé¿öϲ»¶Ô
AnIntStr:string='456'; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ