从delphi7中的按钮单击运行批处理文件

时间:2011-06-17 04:52:49

标签: delphi delphi-7

我有一个批处理文件和一个在delphi7中开发的应用程序。两者都很好。我想在单击按钮时运行批处理文件。我能做些什么呢?

由于 纳尔逊

2 个答案:

答案 0 :(得分:8)

使用在ShellAPI中声明的ShellExecute

ShellExecute(
    MainForm.Handle,
    'open',
    PChar(scriptfilename),
    PChar(params),
    PChar(workingdirectory),
    SW_SHOW
);

答案 1 :(得分:0)

protected void uxTicketHistoryButton_Click(object sender, EventArgs e)
{
    DataTable ticketHist = _dtMgr.GetContactInfoByName(uxContactDropdownList.SelectedValue);
    string rName = ticketHist.Rows[0]["RequestorName"].ToString();
    string rPhone = ticketHist.Rows[0]["RequestorPhone"].ToString();
    ....

    uxTicketHistoryModal.Show();
}

您必须在使用列表中添加ShellApi