将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中编写的最小图形界面程序 ......
这里先说说两个概念:Theme(主题)和 Visual Style 。Theme 最早出现在 Microsoft Plus! for Windows 95 中,是 Windows 中 Wallpaper、Cursors、Fonts、Sounds 、Icons 等的设置值集合。Visual Style 在 Windows XP 中才被引入,Visual Style 规定了 Contorls 的外观,另外还包括使用这些外观的一套 API ......
图像缩放是最常用的图像处理,在图像拉伸和取得图像略图中都要用到。图像缩放质量的好坏与图像像素插值方式有关,本文定义了常用的3种插值方式,即临近插值、线性插值和双立方插值方式:
type
// 插值方式: 缺省(线性插值),临近,线性,双立方
TInterpolateMode = (imDefault, imNear, imBiline ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw;
t ......
方法一:
控件类叫做 TABC,文件名叫 abc.pas 那么新建立一个文件叫
abc.rc
里面内容是
TABC Bitmap icon.bmp
icon.bmp 就是图片文件名,不要超过256色,24x24
然后在命令行下执行 brcc32 abc.rc就会生成 abc.res
改名为 abc.dcr
打开你控件的 dpk文件, 加上 {$R ABC.DCR}
重新编译就可以了。
便捷方 ......