会vb的高手与老师麻烦来看下,谢谢了

[复制链接]
查看11 | 回复1 | 2008-11-26 10:50:04 | 显示全部楼层 |阅读模式
各位老师与高手,下面这是段按照窗口标题结束程序的vb模块代码,运行后会循环结束 远程桌面连接 计算器 程序,请问如何把它转成vbs脚本代码。希望高手与老师帮忙转下,把代码转下。请直接贴转换后的代码,不要说方式呀。我比较笨,实在谢谢了。
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const SYNCHRONIZE = &H100000
Const SPECIFIC_RIGHTS_ALL = &HFFFF
Const STANDARD_RIGHTS_ALL = &H1F0000
Const PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Sub Main()
Do
DoEvents
Sleep 500
Dim a As Long
Dim b As Long
Dim Pid As Long
Dim Jubing As Long
a = FindWindow(vbNullString, "计算器")
b = FindWindow(vbNullString, "远程桌面连接")
GetWindowThreadProcessId a, Pid
Jubing = OpenProcess(PROCESS_ALL_ACCESS, False, Pid)
TerminateProcess Jubing, 0
GetWindowThreadProcessId b, Pid
Jubing = OpenProcess(PROCESS_ALL_ACCESS, False, Pid)
TerminateProcess Jubing, 0
Loop
End Sub

回复

使用道具 举报

千问 | 2008-11-26 10:50:04 | 显示全部楼层
VBS 不能直接调 API不能转...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行