I'll open a program and then close the program, How can I?(100分)

  • 主题发起人 主题发起人 sandal
  • 开始时间 开始时间
S

sandal

Unregistered / Unconfirmed
GUEST, unregistred user!
沒分了, 不知怎辦<br>我想在程式自動運行一外部程式(某硬件自帶的下載數據的程式), 運行完后要求<br>立即關閉. 我能將外部程式, 可是不知如何在程中自動關閉它.
 
各位大俠, 幫我一把吧!<br>把經過向各位描寫一下吧: 我要設計一個程式, 安裝在nt報務器上, 任務是定期去<br>分布各處的考勤刷卡機上下載數據, 下載完后再自動轉換進數據庫文件中.難點是程<br>式能自動調用外部程式(downdata.exe)去下載刷卡資料, 但是不能在下載完后自動把它<br>關閉, 所以后面轉換數據的工作無法進行.downdata.exe 是隨刷卡機附送的, 沒有運行<br>完后自動關閉的參數.<br>救命呀!!!
 
取得该程序的句柄就可以调用api关闭它了
 
我也用這個方法試過, 但不成功, 可能代碼有錯, 可否試舉一例?<br>我想可能是調動外部程式后, 外部程式還未執行完, 程式就開始執行關閉它的<br>指令, 結果不能如其關閉.<br>我用的函數是 shellexecute 和 sendmessage 或 closehandle.<br>
 
换用postmessage试下
 
你启动一个程序肯定用了 CreateProcess,就可以使用<br>BOOL TerminateProcess(<br>&nbsp; HANDLE hProcess, // handle to the process<br>&nbsp; UINT uExitCode &nbsp; // exit code for the process<br>);<br>结束它。<br>你可以看看 rxlib 的 rxshell.pas 关于使用 CreateProcess 的部分。
 
哪里有rxshell.pas ? 這個東東我現在急用, 可否幫我舉個例子示范一下.<br>謝你大思大德
 
我的意思是你启动程序的方法要参照这里的 FileExecute,因为它使用了<br>CreateProcess,然后你就可以利用这个句柄调用 TerminateProcess 关闭<br>程序。<br>{*******************************************************}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; &nbsp; Delphi VCL Extensions (RX) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; &nbsp; Copyright (c) 1995, 1996 AO ROSNO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; &nbsp; Copyright (c) 1997 Master-Bank &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{*******************************************************}<br><br>{.$DEFINE USE_TIMER}<br>{ - Use Windows timer instead thread to the animated TrayIcon }<br><br>{$IFNDEF WIN32}<br>&nbsp; {$DEFINE USE_TIMER} &nbsp;{ - Always use timer in 16-bit version }<br>{$ENDIF}<br><br>unit RXShell;<br><br>{$I RX.INC}<br>{$P+,W-,R-}<br><br>interface<br><br>uses {$IFDEF WIN32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF} Messages,<br>&nbsp; Classes, Graphics, SysUtils, Forms, Controls, Menus, ShellAPI,<br>&nbsp; {$IFDEF USE_TIMER} ExtCtrls, {$ENDIF} IcoList;<br><br>type<br>{$IFNDEF WIN32}<br>&nbsp; PNotifyIconData = ^TNotifyIconData;<br>&nbsp; TNotifyIconData = record<br>&nbsp; &nbsp; cbSize: Longint;<br>&nbsp; &nbsp; Wnd: Longint;<br>&nbsp; &nbsp; uID: Longint;<br>&nbsp; &nbsp; uFlags: Longint;<br>&nbsp; &nbsp; uCallbackMessage: Longint;<br>&nbsp; &nbsp; hIcon: Longint;<br>&nbsp; &nbsp; szTip: array [0..63] of Char;<br>&nbsp; end;<br>{$ENDIF}<br><br>&nbsp; TMouseButtons = set of TMouseButton;<br><br>{ TRxTrayIcon }<br><br>&nbsp; TRxTrayIcon = class(TComponent)<br>&nbsp; private<br>&nbsp; &nbsp; FHandle: HWnd;<br>&nbsp; &nbsp; FActive: Boolean;<br>&nbsp; &nbsp; FAdded: Boolean;<br>&nbsp; &nbsp; FAnimated: Boolean;<br>&nbsp; &nbsp; FEnabled: Boolean;<br>&nbsp; &nbsp; FClicked: TMouseButtons;<br>&nbsp; &nbsp; FIconIndex: Integer;<br>&nbsp; &nbsp; FInterval: Word;<br>&nbsp; &nbsp; FIconData: TNotifyIconData;<br>&nbsp; &nbsp; FIcon: TIcon;<br>&nbsp; &nbsp; FIconList: TIconList;<br>{$IFDEF USE_TIMER}<br>&nbsp; &nbsp; FTimer: TTimer;<br>{$ELSE}<br>&nbsp; &nbsp; FTimer: TThread;<br>{$ENDIF}<br>&nbsp; &nbsp; FHint: string;<br>&nbsp; &nbsp; FShowDesign: Boolean;<br>&nbsp; &nbsp; FPopupMenu: TPopupMenu;<br>&nbsp; &nbsp; FOnClick: TMouseEvent;<br>&nbsp; &nbsp; FOnDblClick: TNotifyEvent;<br>&nbsp; &nbsp; FOnMouseMove: TMouseMoveEvent;<br>&nbsp; &nbsp; FOnMouseDown: TMouseEvent;<br>&nbsp; &nbsp; FOnMouseUp: TMouseEvent;<br>&nbsp; &nbsp; procedure ChangeIcon;<br>{$IFDEF USE_TIMER}<br>&nbsp; &nbsp; procedure Timer(Sender: TObject);<br>{$ELSE}<br>&nbsp; &nbsp; procedure Timer;<br>{$ENDIF}<br>&nbsp; &nbsp; procedure SendCancelMode;<br>&nbsp; &nbsp; function CheckMenuPopup(X, Y: Integer): Boolean;<br>&nbsp; &nbsp; function CheckDefaultMenuItem: Boolean;<br>&nbsp; &nbsp; procedure SetHint(const Value: string);<br>&nbsp; &nbsp; procedure SetIcon(Value: TIcon);<br>&nbsp; &nbsp; procedure SetIconList(Value: TIconList);<br>&nbsp; &nbsp; procedure SetPopupMenu(Value: TPopupMenu);<br>&nbsp; &nbsp; procedure Activate;<br>&nbsp; &nbsp; procedure Deactivate;<br>&nbsp; &nbsp; procedure SetActive(Value: Boolean);<br>&nbsp; &nbsp; function GetAnimated: Boolean;<br>&nbsp; &nbsp; procedure SetAnimated(Value: Boolean);<br>&nbsp; &nbsp; procedure SetShowDesign(Value: Boolean);<br>&nbsp; &nbsp; procedure SetInterval(Value: Word);<br>&nbsp; &nbsp; procedure IconChanged(Sender: TObject);<br>&nbsp; &nbsp; procedure WndProc(var Message: TMessage);<br>&nbsp; &nbsp; function GetActiveIcon: TIcon;<br>&nbsp; protected<br>&nbsp; &nbsp; procedure DblClick; dynamic;<br>&nbsp; &nbsp; procedure DoClick(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); dynamic;<br>&nbsp; &nbsp; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); dynamic;<br>&nbsp; &nbsp; procedure MouseMove(Shift: TShiftState; X, Y: Integer); dynamic;<br>&nbsp; &nbsp; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); dynamic;<br>&nbsp; &nbsp; procedure Loaded; override;<br>&nbsp; &nbsp; procedure Notification(AComponent: TComponent; Operation: TOperation); override;<br>&nbsp; &nbsp; procedure UpdateNotifyData; virtual;<br>&nbsp; public<br>&nbsp; &nbsp; constructor Create(AOwner: TComponent); override;<br>&nbsp; &nbsp; destructor Destroy; override;<br>&nbsp; &nbsp; procedure Hide;<br>&nbsp; &nbsp; procedure Show;<br>&nbsp; &nbsp; property Handle: HWnd read FHandle;<br>&nbsp; published<br>&nbsp; &nbsp; property Active: Boolean read FActive write SetActive default True;<br>&nbsp; &nbsp; property Enabled: Boolean read FEnabled write FEnabled default True;<br>&nbsp; &nbsp; property Hint: string read FHint write SetHint;<br>&nbsp; &nbsp; property Icon: TIcon read FIcon write SetIcon;<br>&nbsp; &nbsp; property Icons: TIconList read FIconList write SetIconList;<br>&nbsp; &nbsp; { Ensure Icons is declared before Animated }<br>&nbsp; &nbsp; property Animated: Boolean read GetAnimated write SetAnimated default False;<br>&nbsp; &nbsp; property Interval: Word read FInterval write SetInterval default 150;<br>&nbsp; &nbsp; property PopupMenu: TPopupMenu read FPopupMenu write SetPopupMenu;<br>&nbsp; &nbsp; property ShowDesign: Boolean read FShowDesign write SetShowDesign stored False;<br>&nbsp; &nbsp; property OnClick: TMouseEvent read FOnClick write FOnClick;<br>&nbsp; &nbsp; property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick;<br>&nbsp; &nbsp; property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;<br>&nbsp; &nbsp; property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;<br>&nbsp; &nbsp; property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp;<br>&nbsp; end;<br><br>function IconExtract(const FileName: string; Id: Integer): TIcon;<br>procedure WinAbout(const AppName, Stuff: string);<br><br>type<br>&nbsp; TExecState = (esNormal, esMinimized, esMaximized, esHidden);<br><br>function FileExecute(const FileName, Params, StartDir: string;<br>&nbsp; InitialState: TExecState): THandle;<br>function FileExecuteWait(const FileName, Params, StartDir: string;<br>&nbsp; InitialState: TExecState): Integer;<br><br>implementation<br><br>uses RxConst, RxCConst, VCLUtils, MaxMin;<br><br>{$IFNDEF WIN32}<br>const<br>&nbsp; Shell = 'shell';<br><br>function ExtractAssociatedIcon(hInst: THandle; lpIconPath: PChar;<br>&nbsp; var lpiIcon: Word): HIcon; far; external Shell;<br>function ShellAbout(Wnd: HWnd; App, Stuff: PChar; Icon: HIcon): Integer;<br>&nbsp; far; external Shell;<br>{$ENDIF WIN32}<br><br>procedure WinAbout(const AppName, Stuff: string);<br>var<br>{$IFNDEF WIN32}<br>&nbsp; szApp, szStuff: array[0..255] of Char;<br>{$ENDIF}<br>&nbsp; Wnd: HWnd;<br>&nbsp; Icon: HIcon;<br>begin<br>&nbsp; if Application.MainForm &lt;&gt; nil then Wnd := Application.MainForm.Handle<br>&nbsp; else Wnd := 0;<br>&nbsp; Icon := Application.Icon.Handle;<br>&nbsp; if Icon = 0 then Icon := LoadIcon(0, IDI_APPLICATION);<br>{$IFDEF WIN32}<br>&nbsp; ShellAbout(Wnd, PChar(AppName), PChar(Stuff), Icon);<br>{$ELSE}<br>&nbsp; StrPLCopy(szApp, AppName, SizeOf(szApp) - 1);<br>&nbsp; StrPLCopy(szStuff, Stuff, SizeOf(szStuff) - 1);<br>&nbsp; ShellAbout(Wnd, szApp, szStuff, Icon);<br>{$ENDIF}<br>end;<br><br>function IconExtract(const FileName: string; Id: Integer): TIcon;<br>var<br>&nbsp; S: array[0..255] of char;<br>&nbsp; IconHandle: HIcon;<br>&nbsp; Index: Word;<br>begin<br>&nbsp; Result := TIcon.Create;<br>&nbsp; try<br>&nbsp; &nbsp; StrPLCopy(S, FileName, SizeOf(S) - 1);<br>&nbsp; &nbsp; IconHandle := ExtractIcon(hInstance, S, Id);<br>&nbsp; &nbsp; if IconHandle &lt; 2 then begin<br>&nbsp; &nbsp; &nbsp; Index := Id;<br>&nbsp; &nbsp; &nbsp; IconHandle := ExtractAssociatedIcon(hInstance, S, Index);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; if IconHandle &lt; 2 then begin<br>&nbsp; &nbsp; &nbsp; if IconHandle = 1 then<br>&nbsp; &nbsp; &nbsp; &nbsp; raise EResNotFound.Create(LoadStr(SFileNotExec))<br>&nbsp; &nbsp; &nbsp; else begin<br>&nbsp; &nbsp; &nbsp; &nbsp; Result.Free;<br>&nbsp; &nbsp; &nbsp; &nbsp; Result := nil;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end else Result.Handle := IconHandle;<br>&nbsp; except<br>&nbsp; &nbsp; Result.Free;<br>&nbsp; &nbsp; raise;<br>&nbsp; end;<br>end;<br><br>const<br>&nbsp; ShowCommands: array[TExecState] of Integer =<br>&nbsp; &nbsp; (SW_SHOWNORMAL, SW_MINIMIZE, SW_SHOWMAXIMIZED, SW_HIDE);<br><br>function FileExecute(const FileName, Params, StartDir: string;<br>&nbsp; InitialState: TExecState): THandle;<br>{$IFDEF WIN32}<br>begin<br>&nbsp; Result := ShellExecute(Application.Handle, nil, PChar(FileName),<br>&nbsp; &nbsp; PChar(Params), PChar(StartDir), ShowCommands[InitialState]);<br>end;<br>{$ELSE}<br>var<br>&nbsp; cFileName, cParams, cPath: array [0..80] of Char;<br>begin<br>&nbsp; Result := ShellExecute(Application.Handle, nil, StrPCopy(cFileName,<br>&nbsp; &nbsp; FileName), StrPCopy(cParams, Params), StrPCopy(cPath, StartDir),<br>&nbsp; &nbsp; ShowCommands[InitialState]);<br>end;<br>{$ENDIF}<br><br>function FileExecuteWait(const FileName, Params, StartDir: string;<br>&nbsp; InitialState: TExecState): Integer;<br>{$IFDEF WIN32}<br>var<br>&nbsp; Info: TShellExecuteInfo;<br>&nbsp; ExitCode: DWORD;<br>begin<br>&nbsp; FillChar(Info, SizeOf(Info), 0);<br>&nbsp; Info.cbSize := SizeOf(TShellExecuteInfo);<br>&nbsp; with Info do begin<br>&nbsp; &nbsp; fMask := SEE_MASK_NOCLOSEPROCESS;<br>&nbsp; &nbsp; Wnd := Application.Handle;<br>&nbsp; &nbsp; lpFile := PChar(FileName);<br>&nbsp; &nbsp; lpParameters := PChar(Params);<br>&nbsp; &nbsp; lpDirectory := PChar(StartDir);<br>&nbsp; &nbsp; nShow := ShowCommands[InitialState];<br>&nbsp; end;<br>&nbsp; if ShellExecuteEx(@Info) then begin<br>&nbsp; &nbsp; repeat<br>&nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; &nbsp; GetExitCodeProcess(Info.hProcess, ExitCode);<br>&nbsp; &nbsp; until (ExitCode &lt;&gt; STILL_ACTIVE) or Application.Terminated;<br>&nbsp; &nbsp; Result := ExitCode;<br>&nbsp; end<br>&nbsp; else Result := -1;<br>end;<br>{$ELSE}<br>var<br>&nbsp; Task: THandle;<br>begin<br>&nbsp; Result := 0;<br>&nbsp; Task := FileExecute(FileName, Params, StartDir, InitialState);<br>&nbsp; if Task &gt;= HINSTANCE_ERROR then begin<br>&nbsp; &nbsp; repeat<br>&nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; until (GetModuleUsage(Task) = 0) or Application.Terminated;<br>&nbsp; end<br>&nbsp; else Result := -1;<br>end;<br>{$ENDIF}<br><br>{$IFNDEF USE_TIMER}<br><br>{ TTimerThread }<br><br>type<br>&nbsp; TTimerThread = class(TThread)<br>&nbsp; private<br>&nbsp; &nbsp; FOwnerTray: TRxTrayIcon;<br>&nbsp; protected<br>&nbsp; &nbsp; procedure Execute; override;<br>&nbsp; public<br>&nbsp; &nbsp; constructor Create(TrayIcon: TRxTrayIcon; CreateSuspended: Boolean);<br>&nbsp; end;<br><br>constructor TTimerThread.Create(TrayIcon: TRxTrayIcon; CreateSuspended: Boolean);<br>begin<br>&nbsp; FOwnerTray := TrayIcon;<br>&nbsp; inherited Create(CreateSuspended);<br>&nbsp; FreeOnTerminate := True;<br>end;<br><br>procedure TTimerThread.Execute;<br><br>&nbsp; function ThreadClosed: Boolean;<br>&nbsp; begin<br>&nbsp; &nbsp; Result := Terminated or Application.Terminated or (FOwnerTray = nil);<br>&nbsp; end;<br><br>begin<br>&nbsp; while not Terminated do begin<br>&nbsp; &nbsp; if not ThreadClosed then<br>&nbsp; &nbsp; &nbsp; if SleepEx(FOwnerTray.FInterval, False) = 0 then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if not ThreadClosed and FOwnerTray.Animated then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FOwnerTray.Timer;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; end;<br>end;<br><br>{$ENDIF USE_TIMER}<br><br>{$IFNDEF WIN32}<br><br>type<br>&nbsp; TLoadLibrary32 = function (FileName: PChar; Handle, Special: Longint): Longint;<br>&nbsp; TFreeLibrary32 = function (Handle: Longint): Bool;<br>&nbsp; TGetAddress32 = function (Handle: Longint; ProcName: PChar): Pointer;<br>&nbsp; TCallProc32 = function (Msg: Longint; Data: PNotifyIconData; ProcHandle: Pointer;<br>&nbsp; &nbsp; AddressConvert, Params: Longint): Longint;<br><br>const<br>&nbsp; NIM_ADD &nbsp; &nbsp; = $00000000;<br>&nbsp; NIM_MODIFY &nbsp;= $00000001;<br>&nbsp; NIM_DELETE &nbsp;= $00000002;<br><br>&nbsp; NIF_MESSAGE = $00000001;<br>&nbsp; NIF_ICON &nbsp; &nbsp;= $00000002;<br>&nbsp; NIF_TIP &nbsp; &nbsp; = $00000004;<br><br>const<br>&nbsp; Shell32: Longint = 0;<br>&nbsp; ProcAddr: Pointer = nil;<br>&nbsp; FreeLib32: TFreeLibrary32 = nil;<br>&nbsp; CallPrc32: TCallProc32 = nil;<br><br>procedure FreeHandles; far;<br>begin<br>&nbsp; if (ProcAddr &lt;&gt; nil) and Assigned(FreeLib32) then FreeLib32(Shell32);<br>end;<br><br>procedure InitHandles;<br>var<br>&nbsp; Kernel16: THandle;<br>&nbsp; LoadLib32: TLoadLibrary32;<br>&nbsp; GetAddr32: TGetAddress32;<br>begin<br>&nbsp; Kernel16 := GetModuleHandle('kernel');<br>&nbsp; @LoadLib32 := GetProcAddress(Kernel16, 'LoadLibraryEx32W');<br>&nbsp; @FreeLib32 := GetProcAddress(Kernel16, 'FreeLibrary32W');<br>&nbsp; @GetAddr32 := GetProcAddress(Kernel16, 'GetProcAddress32W');<br>&nbsp; @CallPrc32 := GetProcAddress(Kernel16, 'CallProc32W');<br>&nbsp; if (@LoadLib32 &lt;&gt; nil) and (@FreeLib32 &lt;&gt; nil) and (@GetAddr32 &lt;&gt; nil)<br>&nbsp; &nbsp; and (@CallPrc32 &lt;&gt; nil) then<br>&nbsp; begin<br>&nbsp; &nbsp; Shell32 := LoadLib32('shell32', 0, 0);<br>&nbsp; &nbsp; if Shell32 &gt;= HINSTANCE_ERROR then begin<br>&nbsp; &nbsp; &nbsp; ProcAddr := GetAddr32(Shell32, 'Shell_NotifyIcon');<br>&nbsp; &nbsp; &nbsp; if ProcAddr = nil then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; FreeLib32(Shell32);<br>&nbsp; &nbsp; &nbsp; &nbsp; Shell32 := 1;<br>&nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; else AddExitProc(FreeHandles);<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else Shell32 := 1;<br>&nbsp; end;<br>end;<br><br>function Shell_NotifyIcon(dwMessage: Longint; lpData: PNotifyIconData): Bool;<br>begin<br>&nbsp; if (ProcAddr = nil) and (Shell32 &lt;&gt; 1) then InitHandles;<br>&nbsp; if ProcAddr &lt;&gt; nil then<br>&nbsp; &nbsp; Result := Bool(CallPrc32(dwMessage, lpData, ProcAddr, $01, 2));<br>end;<br><br>{$ENDIF WIN32}<br><br>{ TRxTrayIcon }<br><br>constructor TRxTrayIcon.Create(AOwner: Tcomponent);<br>begin<br>&nbsp; inherited Create(AOwner);<br>&nbsp; FHandle := AllocateHWnd(WndProc);<br>&nbsp; FIcon := TIcon.Create;<br>&nbsp; FIcon.OnChange := IconChanged;<br>&nbsp; FIconList := TIconList.Create;<br>&nbsp; FIconList.OnChange := IconChanged;<br>&nbsp; FIconIndex := -1;<br>&nbsp; FEnabled := True;<br>&nbsp; FInterval := 150;<br>&nbsp; FActive := True;<br>end;<br><br>destructor TRxTrayIcon.Destroy;<br>begin<br>&nbsp; Destroying;<br>&nbsp; FEnabled := False;<br>&nbsp; FIconList.OnChange := nil;<br>&nbsp; FIcon.OnChange := nil;<br>&nbsp; SetAnimated(False);<br>&nbsp; Deactivate;<br>&nbsp; DeallocateHWnd(FHandle);<br>&nbsp; FIcon.Free;<br>&nbsp; FIcon := nil;<br>&nbsp; FIconList.Free;<br>&nbsp; FIconList := nil;<br>&nbsp; inherited Destroy;<br>end;<br><br>procedure TRxTrayIcon.Loaded;<br>begin<br>&nbsp; inherited Loaded;<br>&nbsp; if FActive and not (csDesigning in ComponentState) then Activate;<br>end;<br><br>procedure TRxTrayIcon.Notification(AComponent: TComponent;<br>&nbsp; Operation: TOperation);<br>begin<br>&nbsp; inherited Notification(AComponent, Operation);<br>&nbsp; if (AComponent = PopupMenu) and (Operation = opRemove) then<br>&nbsp; &nbsp; PopupMenu := nil;<br>end;<br><br>procedure TRxTrayIcon.SetPopupMenu(Value: TPopupMenu);<br>begin<br>&nbsp; FPopupMenu := Value;<br>{$IFDEF WIN32}<br>&nbsp; if Value &lt;&gt; nil then Value.FreeNotification(Self);<br>{$ENDIF}<br>end;<br><br>procedure TRxTrayIcon.SendCancelMode;<br>var<br>&nbsp; F: TForm;<br>begin<br>&nbsp; if not (csDestroying in ComponentState) then begin<br>&nbsp; &nbsp; F := Screen.ActiveForm;<br>&nbsp; &nbsp; if F = nil then F := Application.MainForm;<br>&nbsp; &nbsp; if F &lt;&gt; nil then F.SendCancelMode(nil);<br>&nbsp; end;<br>end;<br><br>function TRxTrayIcon.CheckMenuPopup(X, Y: Integer): Boolean;<br>begin<br>&nbsp; Result := False;<br>&nbsp; if not (csDesigning in ComponentState) and Active and<br>&nbsp; &nbsp; (PopupMenu &lt;&gt; nil) and PopupMenu.AutoPopup then<br>&nbsp; begin<br>&nbsp; &nbsp; PopupMenu.PopupComponent := Self;<br>&nbsp; &nbsp; SendCancelMode;<br>&nbsp; &nbsp; SwitchToWindow(FHandle, False);<br>&nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; PopupMenu.Popup(X, Y);<br>&nbsp; &nbsp; finally<br>{$IFDEF WIN32}<br>&nbsp; &nbsp; &nbsp; SwitchToWindow(FHandle, False);<br>{$ENDIF}<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; Result := True;<br>&nbsp; end;<br>end;<br><br>function TRxTrayIcon.CheckDefaultMenuItem: Boolean;<br>{$IFDEF WIN32}<br>var<br>&nbsp; Item: TMenuItem;<br>&nbsp; I: Integer;<br>{$ENDIF}<br>begin<br>&nbsp; Result := False;<br>{$IFDEF WIN32}<br>&nbsp; if not (csDesigning in ComponentState) and Active and<br>&nbsp; &nbsp; (PopupMenu &lt;&gt; nil) and (PopupMenu.Items &lt;&gt; nil) then<br>&nbsp; begin<br>&nbsp; &nbsp; I := 0;<br>&nbsp; &nbsp; while (I &lt; PopupMenu.Items.Count) do begin<br>&nbsp; &nbsp; &nbsp; Item := PopupMenu.Items;<br>&nbsp; &nbsp; &nbsp; if Item.Default and Item.Enabled then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; Item.Click;<br>&nbsp; &nbsp; &nbsp; &nbsp; Result := True;<br>&nbsp; &nbsp; &nbsp; &nbsp; Break;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; Inc(I);<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>{$ENDIF}<br>end;<br><br>procedure TRxTrayIcon.SetIcon(Value: TIcon);<br>begin<br>&nbsp; FIcon.Assign(Value);<br>end;<br><br>procedure TRxTrayIcon.SetIconList(Value: TIconList);<br>begin<br>&nbsp; FIconList.Assign(Value);<br>end;<br><br>function TRxTrayIcon.GetActiveIcon: TIcon;<br>begin<br>&nbsp; Result := FIcon;<br>&nbsp; if (FIconList &lt;&gt; nil) and (FIconList.Count &gt; 0) and Animated then<br>&nbsp; &nbsp; Result := FIconList[Max(Min(FIconIndex, FIconList.Count - 1), 0)];<br>end;<br><br>function TRxTrayIcon.GetAnimated: Boolean;<br>begin<br>&nbsp; Result := FAnimated;<br>end;<br><br>procedure TRxTrayIcon.SetAnimated(Value: Boolean);<br>begin<br>&nbsp; Value := Value and Assigned(FIconList) and (FIconList.Count &gt; 0);<br>&nbsp; if Value &lt;&gt; Animated then begin<br>&nbsp; &nbsp; if Value then begin<br>{$IFDEF USE_TIMER}<br>&nbsp; &nbsp; &nbsp; FTimer := TTimer.Create(Self);<br>&nbsp; &nbsp; &nbsp; FTimer.Enabled := FAdded;<br>&nbsp; &nbsp; &nbsp; FTimer.Interval := FInterval;<br>&nbsp; &nbsp; &nbsp; FTimer.OnTimer := Timer;<br>{$ELSE}<br>&nbsp; &nbsp; &nbsp; FTimer := TTimerThread.Create(Self, not FAdded);<br>{$ENDIF}<br>&nbsp; &nbsp; &nbsp; FAnimated := True;<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else begin<br>&nbsp; &nbsp; &nbsp; FAnimated := False;<br>{$IFDEF USE_TIMER}<br>&nbsp; &nbsp; &nbsp; FTimer.Free;<br>&nbsp; &nbsp; &nbsp; FTimer := nil;<br>{$ELSE}<br>&nbsp; &nbsp; &nbsp; TTimerThread(FTimer).FOwnerTray := nil;<br>&nbsp; &nbsp; &nbsp; while FTimer.Suspended do FTimer.Resume;<br>&nbsp; &nbsp; &nbsp; FTimer.Terminate;<br>{$ENDIF}<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; FIconIndex := 0;<br>&nbsp; &nbsp; ChangeIcon;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.SetActive(Value: Boolean);<br>begin<br>&nbsp; if (Value &lt;&gt; FActive) then begin<br>&nbsp; &nbsp; FActive := Value;<br>&nbsp; &nbsp; if not (csDesigning in ComponentState) then<br>&nbsp; &nbsp; &nbsp; if Value then Activate else Deactivate;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.Show;<br>begin<br>&nbsp; Active := True;<br>end;<br><br>procedure TRxTrayIcon.Hide;<br>begin<br>&nbsp; Active := False;<br>end;<br><br>procedure TRxTrayIcon.SetShowDesign(Value: Boolean);<br>begin<br>&nbsp; if (csDesigning in ComponentState) then begin<br>&nbsp; &nbsp; if Value then Activate else Deactivate;<br>&nbsp; &nbsp; FShowDesign := FAdded;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.SetInterval(Value: Word);<br>begin<br>&nbsp; if FInterval &lt;&gt; Value then begin<br>&nbsp; &nbsp; FInterval := Value;<br>{$IFDEF USE_TIMER}<br>&nbsp; &nbsp; if Animated then FTimer.Interval := FInterval;<br>{$ENDIF}<br>&nbsp; end;<br>end;<br><br>{$IFDEF USE_TIMER}<br>procedure TRxTrayIcon.Timer(Sender: TObject);<br>{$ELSE}<br>procedure TRxTrayIcon.Timer;<br>{$ENDIF}<br>begin<br>&nbsp; if not (csDestroying in ComponentState) and Animated then begin<br>&nbsp; &nbsp; Inc(FIconIndex);<br>&nbsp; &nbsp; if (FIconList = nil) or (FIconIndex &gt;= FIconList.Count) then<br>&nbsp; &nbsp; &nbsp; FIconIndex := 0;<br>&nbsp; &nbsp; ChangeIcon;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.IconChanged(Sender: TObject);<br>begin<br>&nbsp; ChangeIcon;<br>end;<br><br>procedure TRxTrayIcon.SetHint(const Value: string);<br>begin<br>&nbsp; if FHint &lt;&gt; Value then begin<br>&nbsp; &nbsp; FHint := Value;<br>&nbsp; &nbsp; ChangeIcon;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.UpdateNotifyData;<br>var<br>&nbsp; Ico: TIcon;<br>begin<br>&nbsp; with FIconData do begin<br>&nbsp; &nbsp; cbSize := SizeOf(TNotifyIconData);<br>&nbsp; &nbsp; Wnd := FHandle;<br>&nbsp; &nbsp; uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;<br>&nbsp; &nbsp; Ico := GetActiveIcon;<br>&nbsp; &nbsp; if Ico &lt;&gt; nil then hIcon := Ico.Handle<br>{$IFDEF WIN32}<br>&nbsp; &nbsp; else hIcon := INVALID_HANDLE_VALUE;<br>{$ELSE}<br>&nbsp; &nbsp; else hIcon := 0;<br>{$ENDIF}<br>&nbsp; &nbsp; StrPLCopy(szTip, GetShortHint(FHint), SizeOf(szTip) - 1);<br>&nbsp; &nbsp; uCallbackMessage := CM_TRAYICON;<br>&nbsp; &nbsp; uID := 0;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.Activate;<br>var<br>&nbsp; Ico: TIcon;<br>begin<br>&nbsp; Deactivate;<br>&nbsp; Ico := GetActiveIcon;<br>&nbsp; if (Ico &lt;&gt; nil) and not Ico.Empty then begin<br>&nbsp; &nbsp; FClicked := [];<br>&nbsp; &nbsp; UpdateNotifyData;<br>&nbsp; &nbsp; FAdded := Shell_NotifyIcon(NIM_ADD, @FIconData);<br>&nbsp; &nbsp; if (GetShortHint(FHint) = '') and FAdded then<br>&nbsp; &nbsp; &nbsp; Shell_NotifyIcon(NIM_MODIFY, @FIconData);<br>{$IFDEF USE_TIMER}<br>&nbsp; &nbsp; if Animated then FTimer.Enabled := True;<br>{$ELSE}<br>&nbsp; &nbsp; if Animated then<br>&nbsp; &nbsp; &nbsp; while FTimer.Suspended do FTimer.Resume;<br>{$ENDIF}<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.Deactivate;<br>begin<br>&nbsp; Shell_NotifyIcon(NIM_DELETE, @FIconData);<br>&nbsp; FAdded := False;<br>&nbsp; FClicked := [];<br>{$IFDEF USE_TIMER}<br>&nbsp; if Animated then FTimer.Enabled := False;<br>{$ELSE}<br>&nbsp; if Animated and not FTimer.Suspended then FTimer.Suspend;<br>{$ENDIF}<br>end;<br><br>procedure TRxTrayIcon.ChangeIcon;<br>var<br>&nbsp; Ico: TIcon;<br>begin<br>&nbsp; if (FIconList = nil) or (FIconList.Count = 0) then SetAnimated(False);<br>&nbsp; if FAdded then begin<br>&nbsp; &nbsp; Ico := GetActiveIcon;<br>&nbsp; &nbsp; if (Ico &lt;&gt; nil) and not Ico.Empty then begin<br>&nbsp; &nbsp; &nbsp; UpdateNotifyData;<br>&nbsp; &nbsp; &nbsp; Shell_NotifyIcon(NIM_MODIFY, @FIconData);<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else Deactivate;<br>&nbsp; end<br>&nbsp; else begin<br>&nbsp; &nbsp; if ((csDesigning in ComponentState) and FShowDesign) or<br>&nbsp; &nbsp; &nbsp; (not (csDesigning in ComponentState) and FActive) then Activate;<br>&nbsp; end;<br>end;<br><br>procedure TRxTrayIcon.MouseMove(Shift: TShiftState; X, Y: Integer);<br>begin<br>&nbsp; if Assigned(FOnMouseMove) then FOnMouseMove(Self, Shift, X, Y);<br>end;<br><br>procedure TRxTrayIcon.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);<br>begin<br>&nbsp; if Assigned(FOnMouseDown) then FOnMouseDown(Self, Button, Shift, X, Y);<br>end;<br><br>procedure TRxTrayIcon.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);<br>begin<br>&nbsp; if Assigned(FOnMouseUp) then FOnMouseUp(Self, Button, Shift, X, Y);<br>end;<br><br>procedure TRxTrayIcon.DblClick;<br>begin<br>&nbsp; if not CheckDefaultMenuItem and Assigned(FOnDblClick) then<br>&nbsp; &nbsp; FOnDblClick(Self);<br>end;<br><br>procedure TRxTrayIcon.DoClick(Button: TMouseButton; Shift: TShiftState;<br>&nbsp; X, Y: Integer);<br>begin<br>&nbsp; if (Button = mbRight) and CheckMenuPopup(X, Y) then Exit;<br>&nbsp; if Assigned(FOnClick) then FOnClick(Self, Button, Shift, X, Y);<br>end;<br><br>procedure TRxTrayIcon.WndProc(var Message: TMessage);<br><br>&nbsp; function GetShiftState: TShiftState;<br>&nbsp; begin<br>&nbsp; &nbsp; Result := [];<br>&nbsp; &nbsp; if GetKeyState(VK_SHIFT) &lt; 0 then Include(Result, ssShift);<br>&nbsp; &nbsp; if GetKeyState(VK_CONTROL) &lt; 0 then Include(Result, ssCtrl);<br>&nbsp; &nbsp; if GetKeyState(VK_MENU) &lt; 0 then Include(Result, ssAlt);<br>&nbsp; end;<br><br>var<br>&nbsp; P: TPoint;<br>&nbsp; Shift: TShiftState;<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; with Message do<br>&nbsp; &nbsp; &nbsp; if (Msg = CM_TRAYICON) and Self.FEnabled then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; case lParam of<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_LBUTTONDBLCLK:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DblClick;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseDown(mbLeft, GetShiftState + [ssDouble], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_RBUTTONDBLCLK:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseDown(mbRight, GetShiftState + [ssDouble], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_MBUTTONDBLCLK:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseDown(mbMiddle, GetShiftState + [ssDouble], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_MOUSEMOVE:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseMove(GetShiftState, P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_LBUTTONDOWN:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseDown(mbLeft, GetShiftState + [ssLeft], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Include(FClicked, mbLeft);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_LBUTTONUP:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Shift := GetShiftState + [ssLeft];<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if mbLeft in FClicked then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Exclude(FClicked, mbLeft);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DoClick(mbLeft, Shift, P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseUp(mbLeft, Shift, P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_RBUTTONDOWN:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseDown(mbRight, GetShiftState + [ssRight], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Include(FClicked, mbRight);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_RBUTTONUP:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Shift := GetShiftState + [ssRight];<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if mbRight in FClicked then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Exclude(FClicked, mbRight);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DoClick(mbRight, Shift, P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseUp(mbRight, Shift, P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_MBUTTONDOWN:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseDown(mbMiddle, GetShiftState + [ssMiddle], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WM_MBUTTONUP:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(P);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseUp(mbMiddle, GetShiftState + [ssMiddle], P.X, P.Y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; else Result := DefWindowProc(FHandle, Msg, wParam, lParam);<br>&nbsp; except<br>&nbsp; &nbsp; Application.HandleException(Self);<br>&nbsp; end;<br>end;<br><br>end.
 
上面这位好厉害;<br>知道大富翁有的是纸啊,<br><br>可以检测程序是否结束;<br><br>干吗非要去取系统信息,当然那样也许更保险<br><br>但<br><br>当所调程序结束时,你不是说它要转换数据到文件吗?<br>————&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;下載完后再自動轉換進數據庫文件中<br>那么,它转换完了,不是该关闭了吗?<br><br>检测那个数据文件,<br><br>if 所调程序以独占方式使用数据库;<br>如果可以打开了,证明转换完了,可以关闭;<br>为防止冲突 , 用 try<br><br>if 所调程序以多用户方式使用数据库;<br>如果文件大小不变,那么,可以关闭;<br>
 
可否寫點代碼之類參考:<br>程式作業過程:調用外部程式---&gt;等外部程式下載數據,外部程式會把下載的數據存于一個<br>.txt文件中---&gt;等下載完了立馬把外部程關閉---&gt;把.txt中的數據轉入數據庫文件中.<br>關鍵: 等待並關閉外部程式
 
可否寫點代碼之類參考:<br>程式作業過程:調用外部程式---&gt;等外部程式下載數據,外部程式會把下載的數據存于一個<br>.txt文件中---&gt;等下載完了立馬把外部程關閉---&gt;把.txt中的數據轉入數據庫文件中.<br>關鍵: 等待並關閉外部程式<br>
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
761
import
I
I
回复
0
查看
816
import
I
后退
顶部