轉載自: 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; lWindowCaption: String; begin //lwaveHwnd := FindWindow(nil,'Microsoft Word');//窗口標題 lWindowCaption := FComApp.ActiveWindow.Caption; lwaveHwnd := FindWindow(nil,pAnsiChar(lWindowCaption+' - Microsoft Word'));//窗口標題 //lwaveHwnd := FindWindowW(nil,pWideChar(String(FComApp.ActiveWindow.Caption)));//窗口標題 Windows.SetWindowLong(lWaveHwnd,GWL_STYLE,GetWindowLong(lWaveHwnd, GWL_STYLE) and not (WS_CAPTION or WS_SYSMENU)); Windows.SetParent(lWaveHwnd,pParent.Handle); gWaveHwnd:=lWaveHwnd; lWidth := pParent.Width; lHeight := pParent.Height; Windows.MoveWindow(lWaveHwnd,0,0,lWidth,lHeight,false); //mParent := pParent; end; end.
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type
使用數據庫,第一步是建立和數據庫的連接。結果關於連接,不是第一篇,而是本系列第三篇。 我使用 FireBird 開源數據庫作爲測試。FireDAC 支持 FireBird。 在本系列第一篇,我沒有仔細說 FDConnection1 是如何
概念 前面的文章 FireDAC 學習 - 5 講到,將 FdQuery 和 FdMemTable 的 CachedUpdates 設置爲 True,然後在 FdMemTable 裏面編輯後,可以讀取到編輯改動的記錄,將編輯改動過的記錄輸
我們知道,TFdQuery 是通過 TFdConnection 去連接數據庫的。 而 TFdConnection 連接數據庫的參數,可以通過 TFdManager 獲得。 打開前面的例子程序,在設計期,選擇 FdQuery1,看看其屬性面
問題需求: 以前版本的 Delphi,三層架構的程序,採用 TClientDataSet 來作爲客戶端的內存表,所有用戶操作都是針對 TClientDataSet 裏面的記錄進行增刪改的操作。在這裏,用戶修改後的記錄,叫做 Delta。操
GetSystemMetrics(SM_CXSCREEN); //水平分辨率 GetSystemMetrics(SM_CYSCREEN); //垂直分辨率
procedure TForm1.Button1Click(Sender: TObject); begin SendMessage(handle,WM_SYSCOMMAND,SC_TASKLIST,0); end;
//隱藏任務條 procedure HideTaskBar; var h1: THandle; wndClass: array[0..50] of Char; begin StrPCopy(@wndClass[0], 'She
procedure MakeTree(var slFile: TStrings; const FileExt: string); var Sr : TSearchRec; Err : integer; TrSize, File
[摘要]本文介紹Delphi 編寫數字簽名驗證並獲取簽名信息,並提供詳細的示例代碼供參考。 一個客戶想通過編程實現驗證程序自身的數字簽名來確保程序的完整性,防範病毒感染以及防止一些無聊人士的修改(通過十六進制編輯器替換一些版權、
delphiXE10.3.1安裝完以後的開發環境設置 (Android SDK、啓動參數……) 1.設置Delphi啓動參數 [在圖標 點擊鼠標右鍵] ![在這裏插入圖片描述]) 到達 Delphi 快捷方式所在位置 注意
最近幫同學用D7做了一個很小的數據庫管理系統,爲了提示一些信息和美觀而在程序開始運行時設置了一個Splash窗體。具體的實現方法如下:1、打開D7新建一個Application,將默認的窗體Form1的Name屬性改爲frmMain,該窗
1、 使用Visual C++ 6.0編寫和鏈接DLL 打開Visual C++ 6.0集成開發環境,新建一個Win32 Dynamic-Link Library類型的工程CDLL,在工程中新建一個C語言源文件cdll.c。源文件中的內容
cxGrid控件功能很強大,有許多方法及屬性,其中有一個屬性gridmode。 當你設置gridmode=true時,會提高查詢速度,爲false時則反之,爲什麼如此,在網上有相關的貼子。 當設置gridmode=true時,則在
實現效果概述:當打印一些數據時,我們希望每頁都打印20行,當不夠時,打印出空白表格! 這是怎麼實現的呢?下面我說一下實現原理,報表通過FastReport實現 第一步:報表中需要用到的組建 PAGEHEADER,MasterData,Ch