请教一下,为什么findwindw函数为什么找不到信使服务窗口?
Public Class Form1Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Integer
Private Const SND_ASYNC = &H1&
Private Const SND_LOOP = &H8&
Private Const SND_MEMORY = &H4&
Private Const SND_NODEFAULT = &H2&
Private Const SND_NOSTOP = &H10&
Private Const SND_SYNC = &H0&
Declare Sub Sleep Lib "kernel32 " (ByVal milliseconds As Long)
Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rc As String
Dim hWnd As Integer
While hWnd = 0
System.Threading.Thread.Sleep(3000)
hWnd = FindWindow(vbNullString, "信使服务")
If hWnd Then
rc = sndPlaySound("tada.wav", SND_ASYNC Or SND_LOOP)
End If
End While
End Sub
End Class
换成“我的电脑”就能找到 --------------------编程问答-------------------- 没有句柄 --------------------编程问答-------------------- 无图无易做图
也许就不是 信使服务!
补充:VB , API