線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2541
推到 Plurk!
推到 Facebook!

如何控制外部程式並使內容填滿區域(PowerPoint Viewer 2003 or 2007)

缺席
shunchia63
高階會員


發表:26
回覆:141
積分:198
註冊:2007-05-22

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-03-05 11:18:09 IP:61.62.xxx.xxx 訂閱
Hi:

PPT Viewer 97有 Automation Object
PPT Viewer 2003 無 Automation Object
PPT Viewer 2007 無 Automation Object

故要調用PPT Viewer 2003 或 PPT Viewer 2007 我的想法
只能靠Win32 API 控制PPT Viewer

試過後 可以Resize PPT Viewer

目前碰到的問題是,無法將呈現內容也填滿設定自訂區域位置,
MS無API可以使用,有點困難..










如下為Win32 Test 代碼:





var m_FullScreenRect:TRect;
wndpl:WINDOWPLACEMENT;
H1,H2,paneClassDC: Hwnd;



// 外部EXE檔案
WinExec('C:\Program Files\Microsoft Office\Office12\PPTVIEW.EXE "test.pps"',SW_HIDE);
H1 := 0;


while ( H1 = 0 ) do
begin
H1 :=FindWindow('screenClass',nil);
end;



// 假設找到執行之程式後要放在 Panel1
H2 := ScrollBox1.Handle;
// 將外部程式放在 Panel1
Windows.SetParent(H1,H2);
// 設定外部程式顯示的位置及大小
// MoveWindow(hWnd,X,Y,W,H,B) : RETURN BOOL
// hWnd: HWND
// X:Integer; {horizontal}
// Y:Integer; {vertical}
// W:Integer; {the new window width}
// H:Integer; {the new window height}
// B:BOOL; {the repaint flag}

SetWindowPos(H1,HWND_NOTOPMOST ,0,0,ScrollBox1.Width,ScrollBox1.Height,SWP_DRAWFRAME );

Windows.ShowWindow(H1,SW_ShowNormal);



//獲取屏幕的分辨率
m_FullScreenRect.left := 100;
m_FullScreenRect.top := 100;
m_FullScreenRect.right := 500;
m_FullScreenRect.bottom := 500;
//進入全屏顯示狀態
wndpl.length :=sizeof(WINDOWPLACEMENT);
wndpl.flags :=0;
wndpl.showCmd :=SW_RESTORE ;
wndpl.ptMaxPosition.X := 10;
wndpl.ptMaxPosition.Y := 10;
wndpl.ptMinPosition.X := 400;
wndpl.ptMinPosition.Y := 400;
wndpl.rcNormalPosition :=m_FullScreenRect;
SetWindowPlacement(H1,@wndpl);

shunchia63
高階會員


發表:26
回覆:141
積分:198
註冊:2007-05-22

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-03-11 17:26:37 IP:61.62.xxx.xxx 訂閱
使用HOOK PPT  已經可以滿足需求,

但PPT 無在Foucse Windows時無法自動往下翻(.pps)
系統時間:2024-03-28 19:59:55
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!