52求如何在form的某个区域播放PowerPoint文件(100分)

  • 主题发起人 主题发起人 悠闲
  • 开始时间 开始时间

悠闲

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在窗口上部分显示一些文字,窗口下部分播放PowerPoint文件
 
servers里不是有powerpointapplication吗
 
powerpointapplication是开启powerpoint去播放
我想在delphi的程序中播放powerpoint
 
我的播放是这样实现的
procedure TForm1.BitBtn1Click(Sender: TObject);
var
TempPath, TempParams: String;
begin
TempPath := 'POWERPNT.EXE';
TempParams := '/s "C:/Documents and Settings/Administrator/桌面/PowerPoint/薪资管理.ppt"';
ShellExecute(Handle,'Open',PChar(TempPath),Pchar(TempParams),nil,SW_SHOWNORMAL);
end;
 
用这种思路来试一下:希望你可以解决问题

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MSPpt2000, OleServer,office2000;

type
TForm1 = class(TForm)
PowerPointApplication1: TPowerPointApplication;
PowerPointPresentation1: TPowerPointPresentation;
PowerPointSlide1: TPowerPointSlide;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
i,slidecount:integer;
begin
PowerPointPresentation1.ConnectTo(PowerPointApplication1.Presentations.Open('c:/1.ppt',msoFalse, msoFalse, msoFalse));
PowerPointPresentation1.SaveAs('c:/1.htm',ppSaveAsHTML,msoTrue);
PowerPointSlide1.Disconnect ;
PowerPointPresentation1.Disconnect ;
PowerPointApplication1.Disconnect ;
end;
end.

用以上方法先转换成网页, 然后在窗体上放WebBrowser控件,用网页格式打开这个Powerpoint文件。你可以用这种思路来试一下,如果有其他好的方法,请告诉我一声谢谢!
laj001@126.com
 
我这也有些资料,你看看??
unit Unit1;

interface

uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Controls,
Forms,
Dialogs,
MSPpt2000,
OleServer,
Office2000,
stdctrls,
wintypes,
winprocs,
Buttons;

type
TForm1 = class(TForm)
ppts: TPowerPointSlide;
ppta: TPowerPointApplication;
pptp: TPowerPointPresentation;
SpeedButton1: TSpeedButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);

private
{ Private declarations }
procedure Moveme(var m: TMSG; var handled: boolean);

public
{ Public declarations }
end;

var
Form1 : TForm1;

implementation

{$R *.dfm}
var
ssSet : SlideShowSettings;
ssWin : SlideShowWindow;
connected, disable: boolean;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
pptA.Disconnect;
pptA.Quit;
if assigned(pptA) then pptA.Free;
except
showmessage('PowerPoint has already closed!');
end;

end;

procedure TForm1.Moveme(var m: TMSG; var handled: boolean);
var
pos : Dword;
posx, posy, px, py, px1, py1, lx, ly, lx1, ly1: word;
begin

pos := getmessagepos;
posx := loword(pos);
posy := hiword(pos);
px := speedbutton1.clienttoscreen(point(speedbutton1.Left,
speedbutton1.top)).X;
py := speedbutton1.clienttoscreen(point(speedbutton1.Left,
speedbutton1.top)).y;
px1 := speedbutton1.clienttoscreen(point(speedbutton1.left +
speedbutton1.Width, speedbutton1.top + speedbutton1.height)).X;
py1 := speedbutton1.clienttoscreen(point(speedbutton1.left +
speedbutton1.Width, speedbutton1.top + speedbutton1.height)).y;

if not ((posx > px) and (posx < px1) and (posy > py) and (posy < py1)) then

begin
inherited;

sendmessage(handle, wm_nclbuttondown, htcaption, getmessagepos);
handled := true;
end;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
d : Topendialog;
i : integer;
filename : string;
begin
try
d := topendialog.Create(self);
d.Filter := 'PowerPoint演示文稿(*.ppt)|*.ppt';
if d.Execute then
filename := d.FileName;
if not connected then
begin
pptA.Connect;
connected := True;
end;
if filename <> '' then
begin
pptA.Visible := msoTrue;
PPtP.ConnectTo(pptA.Presentations.Open(filename, msoFalse, msoFalse,
msoTrue));
ssSet := PPtP.SlideShowSettings;
ssSet.LoopUntilStopped := msoFalse;
ssSet.ShowType := ppShowTypeSpeaker;
ssSet.Run;
ssWin := PPtP.SlideShowWindow;
PPts.ConnectTo(PPtP.Slides.Item(1));
for i := 0 to pptp.Slides.Count - 1 do
begin
ssWin.View.Next;
sleep(55);
end;
ssWin.View.Exit;
pptA.Disconnect;

end;
finally
pptA.Quit;
application.Terminate
end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage := moveme;
end;

end.
 
后退
顶部