易截截图软件、单文件、免安装、纯绿色、仅160KB

如何让Delphi调用外部程序并等待其运行信息(如结束)

函数一:
view plaincopy to clipboardprint?
uses 
    Windows,  
    SysUtils,  
    Classes,  
    ShellAPI;  
function RunAndWait(FileName: string; Visibility: Integer): THandle;  
var 
    zAppName: array[0..512] of Char;  
    zCurDir: array[0..255] of Char;  
    WorkDir: string;  
    StartupInfo: TStartupInfo;  
    ProcessInfo: TProcessInformation;  
begin 
    try 
      StrPCopy(zAppName, FileName);  
      GetDir(0, WorkDir);  
      StrPCopy(zCurDir, WorkDir);  
      FillChar(StartupInfo, SizeOf(StartupInfo), #0);  
      StartupInfo.cb := SizeOf(StartupInfo);  
      StartupInfo.dwFlags := STARTF_USESHOWWINDOW;  
      StartupInfo.wShowWindow := Visibility;  
      if not CreateProcess(nil, zAppName, nil, nil, false, Create_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then 
      begin 
        result := 0;  
        Exit;  
      end 
      else 
      begin 
        WaitForSingleObject(ProcessInfo.hProcess, INFINITE);  
        GetExitCodeProcess(ProcessInfo.hProcess, result);  
      end;  
 


相关文档:

Delphi操作注册表的一般步骤

Delphi操作注册表步骤如下:
-------------------------------------
1)在Uses中添加Registry单元;
2)声明TRegistry对象;
3)创建TRegistry对象;
4)指定根键;
----------------try------------------
5)打开需要操作的主键;
6)读写操作;
7)保存并关闭主键;
--------------finally----------------
......

Delphi中实现文件拷贝的三种方法

Delphi中实现文件拷贝的三种方法
1.调用API函数
procedure CopyFile(fromFileName,ToFileName:string);
var
f1,f2:file;
Begin
AssignFile(f1,fromFileName); file://指定源文件名
AssignFile(f2,ToFileName); file://指定目标文件名
Reset(f1);
Try
Rewrite(f2);
Try
If Lzcopy(TfileRec(f1).handle,TfileRe ......

Delphi中动态链接库(DLL)的建立和使用

动态链接库是一个能够被应用程序和其它的DLL调用的过程和函数的集合体,它里面包含的是公共代码或资源。由于DLL代码使用了内存共享技术,在某些地方windows也给了DLL一些更高的权限,因而DLL中可以实现一些一般程序所不能实现的功能,如实现windows的HOOK、ISAPI等。同时,DLL还为不同语言间代码共享提供了一条方便的途径。因而D ......

在delphi中判断字符串是否数字,以及精度处理函数

// 判断是否是数值型   By yangxiao  2007.7.21
function isNumeric(strText: WideString): Boolean;
var
  s: string;
  i, l, p: Integer;
begin
  Result := False;
  l := Length(strText);
  if l = 0 then Exit;
  s := '';
  for i:=1 to l do
  ......

Delphi 的运算符列表


分类
运算符
操作
操作数
结果类型
范例
算术运算符
+

整数,实数
整数,实数
X + Y
-

整数,实数
整数,实数
Result - 1
*

整数,实数
整数,实数
P * InterestRate
/
实数除
整数,实数
实数
X / 2
div
整数除
整数
整数
Total div UnitSize
mod
取模
整数
整数
Y mod 6 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号