日期:2009-06-22  浏览次数:20528 次

想要调用系统屏幕保护,主要是发送一个WM_SYSCOMMAND消息即可。

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam


As Int32, ByVal lParam As Int32) As Int32
    Private Const HWND_BROADCAST = &HFFFF&
    Private Const WM_SYSCOMMAND = &H112
    Private Const SC_SCREENSAVE = &HF140&

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_SCREENSAVE, 0)
    End Sub