ÓÃDelphi±àÖÆ¿É×Ô¶¯Éý¼¶³ÌÐò
ÔÚ±àÖÆÁËÒ»¸öÓ¦ÓóÌÐòºóµÄά»¤½×¶Î£¬ÎÒÃÇ»áÃæÁÙ¸øÓ¦ÓóÌÐòÉý¼¶µÄ¹¤×÷.ÎÞÒÉ£¬ÊÖ¹¤Éý¼¶µÄ¹¤×÷ÊÇÊ®·Ö·±ËöµÄ£¬Äã¿ÉÄÜ»áÐèÒªµ½Óû§µÄ»úÆ÷ÉÏÈ¥¸üÐÂÎļþ.¿ÉÊÇ£¬Èç¹ûÄܱàÒ»¸ö×Ô¶¯Éý¼¶³ÌÐò£¬·ÅÔÚÍøÂçÉÏ£¬ÈÃÓû§ÏÂÔØ£¬Ö»ÐèÖ´ÐÐһϾÍÍê³ÉÉý¼¶¹¤×÷£¬²»ÊǺܷ½±ãÂð£¿Æäʵ£¬ÓÃDelphi¿ÉÒԺܷ½±ãµØ±àÖƳöÕâÑùÒ»¸öµÄ³ÌÐò.
ÒÔÏÂÊÇÎÒÃǵÄÀý×Ó£¬ÉèÎÒÃÇÒѾÓÐÒ»¸öÓ¦ÓóÌÐòThis.exe£¬Òª¶ÔËüÉý¼¶£¬ÓÃÀ´Éý¼¶µÄ³ÌÐòΪUpgrade.exe.
1£®ThisµÄ¹¤³ÌÎļþ¿ò¼Ü
program THIS;
uses
SysUtils,
Windows,
Forms,
...;
ÎÒÃǽ«ËüдÈë´úÂëÖУ¬ÒòΪÕâÔÚDelphiµÄ¹¤³ÌÎļþÖÐÊÇûÓÐ×Ô¶¯Éú³ÉµÄ.“…”²¿·ÖÊÇÄã´´½¨µÄ´°Ì岿·Ö
Var
Fn : String;
TSI : TStartupInfo;
TPI : TProcessInformation;
{$R *.RES}
begin
“Éý¼¶³ÌÐò”ʹÓÃFileAgeÀ´¼ì²éÔÀ´Ó¦ÓóÌÐòµÄ½¨Á¢Ê±¼ä£¬Èç¹û¼ì²âµ½µÄÊǾɰ汾£¬ÔòÌáʾÉý¼¶:
IF FileAge(‘SomeServerSomeDirthis.exe‘) ¡µ FileAge(ParamStr(0)) THEN
IF Application.MessageBox(‘ÕâÊÇÒ»¸ö¸üа汾µÄTHIS.EXE.‘+££13‘ÄãÒªµÃµ½Ð°汾µÄÉý¼¶ÎļþÂ𣿑, ‘Upgrade Time!‘,1) = 1 THEN
Begin
ÔËÐÐÉý¼¶³ÌÐòʱ£¬Éý¼¶³ÌÐòÓ¦ÓëÔÖ÷³ÌÐòthis.exeÔÚͬһĿ¼ÏÂ.Èç¹ûµ±ËüÆô¶¯Ê±£¬Õâ¸ö°æ±¾Ö÷³ÌÐòÓ¦¸ÃÍ˳ö£¬µ«Òª±£Ö¤Ëü²»»áɾ³ýÈκÎÎļþ£¬ÒòΪ´ËʱApplication.Initialize»¹Ã»Óб»µ÷ÓÃ.´úÂëÈçÏÂ:
Fn:= ExtractFilePath(ParamStr(0))+‘UpgradeThis.exe‘;
FillChar(TSI, SizeOf(TSI), 0);
TSI.CB := SizeOf(TSI);
IF CreateProcess (PChar(Fn), NIL, NIL, NIL, False,
DETACHED_PROCESS, NIL, NIL, TSI, TPI)
THEN Exit
µ«ÊÇ£¬Èç¹û“Éý¼¶³ÌÐò”ÓÉÓÚijЩÔÒòûÓÐÔËÐУ¬ÎÒÃÇ´ËʱӦ¸Ã¸æËßÓû§£¬ËûÄÜͨ¹ýÆäËû·½·¨µÃµ½Ò»¸ö¸üеijÌÐò°æ±¾£¬ÕâʱÎÒÃÇÒÀÈ»Í˳öÖ÷³ÌÐòÒÔ±ãÓû§Éý¼¶.Èç¹û±ØÒªµÄ»°£¬Ò²¿ÉÒÔ¼ÌÐø×°Èë²¢ÔËÐоɰ汾.
ELSE
Begin
messagebeep(0);
Application.MessageBox(‘²»ÄÜÍê³ÉÎļþ¿½±´.‘+‘ ‘ ÇëÊÖ¹¤¿½±´£¡.‘, ‘Copy Error!‘,1);
Exit;
End;
End;
Application.Initialize;
Application.Title := ‘This‘;
Application.HelpFile := ‘This.hlp‘;
{autocreate forms, etc.}
Application.Run;
end.
Èç¹û×Ô¶¯Éý¼¶³ÌÐòÊÇÒ»¸ö¿ØÖÆ̨³ÌÐò£¬ÄÇôһ
Ïà¹ØÎĵµ£º
ADO ʹÓà ORACLE provider FOR OLE DB Çý¶¯Ê±
µ÷Óô洢¹ý³ÌÐèÒª·µ»ØÓαêʱ£¬ÔÚÁ¬½Ó×Ö·û´®ÖÐÔö¼Ó
PLSQLRSet=1 ²ÎÊý¡£
´æ´¢¹ý³ÌÖеÄÓα겻ÐèÒª¸¶³õʼֵ
Èç:
sp1: TADOStoredProc;
sp1.Close;
sp1.ProcedureName := 'pkg_ScanList_By_JobNo.sp_GetScanList';& ......
//Delphi²¿·Ö
//»Øµ÷º¯Êý¶¨Òå
type TOnMyCallBack = procedure(data:pchar; id:Integer);stdcall;
//DLLÖеĵ¼³öº¯ÊýÉùÃ÷
procedure StartCall(param: TOnMyCallBack(data:pchar; id:Integer);stdcall;
begin
...
...
end;
&n ......
²Ü×æȨ
¡¡¡¡¹¤¾ßÌõÊdzÌÐòԱϲ»¶²ÉÓõÄ×é¼þ£¬Ëü¾ßÓмòÃ÷Ö±¹ÛµÄÍâÐΣ¬Äܹ»·½±ãÓû§Ö´ÐÐ×î³£ÓõŦÄÜ¡£Èç¹ûÄãʹÓÃdelphi3±à³Ì£¬ÄÇô±¾ÈËÏòÄãÍƼöcoolbar×é¼þ¡£ËüÊÇÒ»ÖÖ¹¦ÄܸüΪ·á¸»µÄ¹¤¾ßÌõ£¬ÓÃËü¿ÉÒÔʹ¶à¸ö´«Í³µÄ¹¤¾ßÌõ¡¢±à¼¿ò¡¢×éºÏÁбí¿ò¡¢Í¼ÏñÉõÖÁ¸ü¶àµÄ×é¼þ¼¯³Éµ½Ò»¸öͳһµÄcoolbarÖУ¬Ê¹µÃÓ¦ÓóÌÐò´°¿Ú¸üΪ½ô´Õ¡¢½çÃæ ......
ÏûÏ¢µÄ´¦ÀíÁ÷³Ì£¬Á÷³ÌÈçÏ£º
ÆäÅÉ·¢´¦Àí¹ý³ÌÏêϸÈçÏ£º
×¢Ò⣺TWinControlÀïÃæWndProcÓе÷ÓÃϵͳAPI DefWindowProc,¸Ãº¯Êýµ÷ÓÃȱʡµÄ´°¿Ú¹ý³ÌÀ´ÎªÓ¦ÓóÌÐòûÓд¦ÀíµÄÈκδ°¿ÚÏûÏ¢ÌṩȱʡµÄ´¦Àí¡£¶øTWinControlÀïÃæDefaultHandlerÓÖµ÷ÓÃÁËϵͳAPI CallWindowProc£¬¸Ãº¯ÊýCallWindowProc½«ÏûÏ¢ÐÅÏ¢´«Ë͸øÖ¸¶¨µÄ´°¿ ......