Delphi实现操作Excel示例
implementation
uses ComOBJ;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ExcelAPP1:Variant;
ExcelApp2:Variant;
I,j: Integer;
ID,IDX:string;
begin
try
ExcelAPP1:=CreateOleObject('Excel.Application');
ExcelAPP1.Workbooks.Open('D:\Program Files\Embarcadero\Projects\操作Excel\奖.xls');
ExcelAPP2:=CreateOleObject('Excel.Application');
ExcelApp2.Workbooks.Open('D:\Program Files\Embarcadero\Projects\操作Excel\贫2.xls');
for I := 2 to 610 do
begin
Label1.Caption:=IntToStr(i)+'行';
ID:=trim(ExcelAPP1.cells[I,2].value);
for j := 4 to 549 do
begin
IDX:=trim(ExcelAPP2.cells[j,4].value);
if (IDX=ID) then
begin
ExcelAPP1.cells[i,12].value:='已建档';
Break;
end;
end;
end;
Label1.Caption:='全部完成,正在保存......';
ExcelAPP1.Save;
Label1.Caption:='全部完成,已保存';
finally
ExcelAPP1.WorkBooks.Close;
ExcelAPP1.Quit;
ExcelApp2.WorkBooks.Close;
ExcelAPP2.Quit;
end;
end;
相关文档:
uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject);
begin
//用IE打开
ShellExecute(Handle, 'open', 'IExplore.EXE', 'about:blank', nil, SW_SHOWNORMAL);
//用火狐打开
ShellExecute(Handle, 'open', 'firefox.exe', 'about:blank', nil, SW_SHOWNORMAL);
//用默认浏览器打开
&nbs ......
显示一个GIF动画
procedure ShowGIF( GIFFileName : String );
var TargetFrameName,PostData,Heads,Flags : OleVariant; URL : widestring; begin TargetFrameName := '';{指定Frame的空字符串时,则在当前Frame中打开动画文件} PostData := false;{不发送数据} Heads := '';{Header信息为空} Flags := 0;{Flags设为0} ......
注意:本文仅供技术交流,请勿用于非法用途。
要修改指定程序的指定地址数据,我们需要用到两个api函数,分别是ReadProcessMemory和WriteProcessMemory。
下载是函数的定义:
ReadProcessMemory
Reads data from an area of memory in a specified process. The entire area to be read must be accessible or the op ......
朋友,先要导入 XDICTGRB_TLB ,然后用下面的source,注意TForm1 = class(TForm,IXDictGrabSink) //!!!
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, XDICTGRB_TLB;
type
TForm1 = class(TForm,IXDictGrabSink) //!!!
GrabPro ......