c++builder中怎么调用系统的记事本、计算器、Outlook(50分)

  • 主题发起人 主题发起人 kit
  • 开始时间 开始时间
K

kit

Unregistered / Unconfirmed
GUEST, unregistred user!
谢谢各位大狭!
c++builder中怎么调用系统的记事本、计算器、Outlook
 
ShellExecute(frmMain.Handle,nil,PChar('WINWORD.EXE'),nil,nil,SW_SHOWNORMAL);
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;
StartupInfo.cb = sizeof(STARTUPINFO);

StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWDEFAULT;
// 运行计算器
CreateProcess(NULL,
"Calc",
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&StartupInfo,
&ProcessInfo);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
// 运行写字本
WinExec("NotePad",SW_RESTORE);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)
{
HWND hWndCalc; // 窗口句柄
// 查找“计算器”窗口
hWndCalc = FindWindow(NULL, "计算器");
if( hWndCalc!=0 )
SendMessage(hWndCalc, WM_CLOSE, 0, 0);
}
 
ShellExecute(frmMain.Handle,nil,PChar('WINWORD.EXE'),nil,nil,SW_SHOWNORMAL);
 
接受答案了.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
930
DelphiTeacher的专栏
D
D
回复
0
查看
871
DelphiTeacher的专栏
D
后退
顶部