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 ......
ÓÐʱºòÎÒÃÇÐèÒª¿ÉÒÔ¸ßËÙ¼ìË÷µÄÁÐ±í£¬×ÔÈ»»áÏëµ½¹þÏ£±í£¬Æ½Ê±ÎÒÃÇ¿ÉÄÜÏëµ½ÓÃIniFilesµ¥ÔªÀïµÄTHashedStringList£¬µ« THashedStringListÿ´ÎÐÂÔöÒ»¸öItemºó¶¼ÐèҪˢÐÂÒ»±é£¬Êý¾Ý¶àÁË¿ÉÄÜ»áÓеãÂý£¬¸Ð¾õ²»Ì«ºÃ£¬¶øTStringHashÔòÖ»ÄÜ´æ IntegerÐ͵Ä(ËäÈ»ÎÒÃÇ¿ÉÒ԰ѱðµÄ¶«Î÷Ç¿ÖÆ×ª³ÉÕûÐÍ´æ½øÈ¥£¬µ«¸Ð¾õ²»Ì«ºÃ)¡£TStringHashÒÑ¾Ê ......
ÀûÓÃÄÚ´æÁ÷À´ÅжÏÎļþµÄ¸ñʽ£¬ÆäʵÅжÏÎļþµÄǰ¼¸¸ö×ֽھͿÉÒÔ¼òµ¥µÄÅжÏÕâ¸öÎļþÊÇʲôÀàÐ͵ÄÎļþ¡£
procedure TFrm.CheckImgType(Sender: TObject);
var //ÉùÃ÷±äÁ¿
MyImage:TMemoryStream; //ÄÚ´æÁ÷¶ÔÏó
Buffer:Word;
i:integer;
beg ......
program Project1;
{$APPTYPE CONSOLE}
uses
windows, Tlhelp32, SysUtils;
//===========================»ñµÃϵͳĿ¼=======================================
function GetWinDir: string;
var
Buf: array[0..MAX_PATH] of char;
begin
GetSystemDirector ......