请教关于"ShellExcute"这个API函数的使用实例,主要是想知道它的参数的数据类型,帮助文件所讲的都是C++的变量类型,由于我刚接触delphi,所以不知道如何调用API

解决方案 »

  1.   

    确保把ShellApi添加到你的Unit文件的uses语句中。
    --------------------
    打开notebook.exe
    uses ShellApi;
    ...
    ShellExecute(Handle, ’open’,
      ’c:\Windows\notepad.exe’, nil, nil, SW_SHOWNORMAL);
    --------------------
    用记事本打开扩展名为txt的文件。
    ShellExecute(Handle,’open’,
      ’c:\windows\notepad.exe’,’c:\SomeText.txt’,
      nil, SW_SHOWNORMAL);
    --------------------
    显示DelphiDownlaod文件夹内容。
    ShellExecute(Handle,’open’,
      ’c:\DelphiDownload’,
      nil, nil, SW_SHOWNORMAL);
    --------------------
    通过扩展来执行一个文件
    ShellExecute(Handle, ’open’,
    ’c:\MyDocuments\Letter.doc’,nil,nil,SW_SHOWNORMAL);
    --------------------
    用默认网页浏览器打开web站点或*.htm文件
    ShellExecute(Handle, ’open’,
      ’http://delphi.about.com’,nil,nil, SW_SHOWNORMAL);
    --------------------
    发送一带有标题和消息主题的E-mail
    var em_subject, em_body, em_mail : string;
    begin
     em_subject := ’This is the subject line’;
     em_body := ’Message body text goes here’;
     em_mail := ’mailto:[email protected]?subject=’ + em_subject + ’&body=’ + em_body ;
     ShellExecute(Handle,’open’,
       PChar(em_mail), nil, nil, SW_SHOWNORMAL);
    end;
      

  2.   

    1.将ShellApi添加到你的Unit文件的uses语句中;
    2.shellexecute(self.hand,'open',pchar('要打开发文件的路径和名称'),nil,nil,Sw_shownormal);
      

  3.   

    参数说明:
    1.Thandle;
    2.String;
    3.Pchar(字符串指针);
    4.常量(参数)
    5.常量(默认目录)
    6.常量(显示窗口的模式)