[求助] 用Delphi6制作控制电脑显示器开关的小软件
我初学Delphi6 我想用Delphi6制作一个软件,用它来控制我的显示器的关闭与打开,请问这个怎么实现?
Delphi中 procedure TForm1.Button1Click(Sender: TObject); begin SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2); end; VB中 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Const WM_SYSCOMMAND = &H112& Const SC_MONITORPOWER = &HF170&
Private Sub Command1_Click() SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2 End Sub