共和国之辉隐藏兵种:如何在vb中调用系统的计算器程序?

来源:百度文库 编辑:高校问答 时间:2024/05/05 19:34:27

Dim ProcID As Integer
' Run Calculator.
ProcID = Shell("C:\Windows\system32\calc.exe", AppWinStyle.NormalFocus)
' The preceding path is for Windows XP;
' The Windows 2000 path is C:\WINNT\system32\calc.exe.
把上面的代码加到一个事件中去就行了(比如:button_click事件),就可以了.

楼上的程序清单没错,但是你确定所有的操作系统都是安装在 C 盘 Windows 目录下吗??如果要实现严谨的调用需借助 API 函数 GetSystemDirectory 来获得系统的路径,然后再写上面的代码就可以了。