VB.Net 杀掉进程

VB.Net 杀掉进程,第1张

概述Imports System.Runtime.InteropServices Public Class Form1   Public Const WM_CLOSE = &H10   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click   imports System.Runtime.InteropServices Public Class Form1 Public Const WM_CLOSE = &H10 Private Sub button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles button1.Click Dim EXCELApp As Excel.Application EXCELApp = New Excel.Application() EXCELApp.Visible = True 'EXCELApp.Workbooks.Add() EXCELApp.Workbooks.Open(System.Environment.CurrentDirectory & "\Book1.xls") End Sub Private Sub button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles button2.Click Dim hwndPPt As Integer hwndPPt = MyAPI.FinDWindow("XLMAIN","Microsoft Excel - Book1.xls") 'MsgBox("hwndEXCEL (" & Hex(hwndPPt) & ") has the Window handle to " & _ ' "EXCEL's Main Window." & vbCr & " Click OK to close EXCEL.") 'EXCELApp.Quit() MyAPI.SendMessageA(hwndPPt,WM_CLOSE,0) End Sub End Class Public Class MyAPI <Dllimport("user32.dll")> Public Shared Function _ FinDWindow(ByVal strClassname As String,ByVal strWindowname _ As String) As Integer End Function <Dllimport("user32.dll")> Public Shared Function _ SendMessageA(ByVal hWnd As Integer,ByVal wMsg As Long,ByVal wParam As Long,ByVal lParam As Long) As Long End Function End Class 总结

以上是内存溢出为你收集整理的VB.Net 杀掉进程全部内容,希望文章能够帮你解决VB.Net 杀掉进程所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1285333.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存