½«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
Ïà¹ØÎĵµ£º
Ò»¡¢KOLÊÇʲô?KOLÄÜ×öʲô? MCKÊÇʲô?MCKÄÜ×öʲô?
KOLÊÇÒ»Ì×¶ÔÏó¿â£¬Ãâ·Ñ¶øÇÒ¿ª·ÅÔ´´úÂ룬´ó¼Ò¿ÉÒÔhttp://www.kolmck.net/È¥ÏÂÔØµ½
Ëü¡£ËüÄܹ»Ê¹Delphi±à³ö³ß´ç·Ç³£Ð¡µÄ32λWindowsͼÐÎÓû§½çÃæµÄÓ¦ÓóÌÐò¡£
Ŀǰ֧³ÖµÄDelphi°æ:Delphi6,Delphi5,Delphi4,Delphi3ºÍDelphi2¡£
ʹÓÃKOLÔÚD2-D5ÖбàдµÄ×îСͼÐνçÃæ³ÌÐò ......
н¨Ò»¸öActive Library
2. н¨Ò»¸öCOM Object£¬ÔÚClass NameÌîÒ»¸öÃû×Ö£¬ÈçTest¡£
µãÒ»ÏÂImplemented InterfaceºóÃæµÄList°´Å¥¡£ÔÙµãһ϶Ի°¿òÖеÄAdd Library°´Å¥£¬
Ñ¡Ôñ“Program Files\Common Files\Designer”Ŀ¼ÏµÄmsaddndr.dllÎļþ¡£
È»ºóÔÚÁбíÖÐÕÒµ½msaddndr.dllÀïÃæµÄ_IDTExtensibility2½Ó¿Úµã ......
ListView1.Items Ϊ±ê×¼ TlistitemsÀà
ListView1.Items
(1)¸³Öµ
with ListView1.Items.Add do
begin
Caption:=caption; //Ìí¼ÓµÚÒ»Ïî
SubItems.add(aaaaa); //Ìí¼ÓºóÃæÊý¾Ý
SubItems.add(1234);
SubItems.add(1234);
end; //Ò»¶¨ÒªÊ¹ÓÃWITH½á¹¹.
(2)ȡֵ
listview1.Items.Item[i].Caption È¡µÃijÌõÊý¾Ý±êÌâ
l ......
DelphiµÄTCanvasÒÔ¼°ÅÉÉúÀàÌṩÁËÏÔʾTGraphicͼÏñµÄ·½·¨Draw£¬ÆäʵÕâ¸ö·½·¨±¾Éí²¢Ã»ÓÐÏÔʾͼÏñµÄ¹¦ÄÜ£¬Ö»ÊÇ·´¹ýÀ´µ÷ÓÃÁËÒ»ÏÂTGraphicµÄDraw·½·¨¡£TGraphic±¾ÉíÊǸö³éÏóÀ࣬ÆäDraw·½·¨Ò²ÊǸö´¿Ðé·½·¨£¬ËùÒÔTGraphicµÄËùÓÐÅÉÉúÀà±ØÐëÌṩһ¸ö¾ßÌåµÄDraw·½·¨¡£TGraphicµÄÖ÷ÒªÅÉÉúÀàTBitmapÒ²ÓÐÒ»¸öDraw·½· ......