发布网友 发布时间:2023-01-08 06:27
共2个回答
热心网友 时间:2023-10-18 21:34
'新建两个按钮,command1、command2,1为关闭,2为打开。 '*************使用到的API Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Const PROCESS_TERMINATE = 1 '******************************************** Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Const SW_SHOWNORMAL = 1 Const SW_MINIMIZE = 6 Dim pid&, hProcess& Private Sub Command1_Click() hProcess = OpenProcess(PROCESS_TERMINATE, False, pid) TerminateProcess hProcess, 1 CloseHandle hProcess End Sub Private Sub Command2_Click() pid = Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE http://qmmv.com", 1) End Sub热心网友 时间:2023-10-18 21:35
用这个API ShellExecute(NULL, "open", "网址", NULL,NULL,0)