16,554
社区成员
发帖
与我相关
我的任务
分享
Dim sysFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.System)
Dim pInfo As New ProcessStartInfo()
pInfo.FileName = IO.Path.Combine(sysFolder, "Notepad.exe")
If Not IO.File.Exists(pInfo.FileName) Then
MsgBox("找不到‘" & pInfo.FileName & "’文件!", MsgBoxStyle.OkOnly)
Exit Sub
End If
Dim p As Process = Process.Start(pInfo) '运行该文件
p.WaitForInputIdle() '等待程序装载完成
SetWindowPos(p.MainWindowHandle.ToInt32, -1, 0, 0, 0, 0, 3) '窗口最前
Dim preStyle As Long = GetWindowLong(p.MainWindowHandle, GWL_EXSTYLE) '取得当前窗口属性
SetWindowLong(p.MainWindowHandle, GWL_EXSTYLE, preStyle And WS_EX_LAYERED) '加上一个透明属性
On Error Resume Next
SetLayeredWindowAttributes(p.MainWindowHandle, 0, 100, LWA_ALPHA)
p.WaitForExit() '等待进行程退出