Heenan, Lambert
Lambert.Heenan at aiuholdings.com
Thu May 28 16:03:04 CDT 2009
That's because one line of code turns off the screen, and the other turns it back on again. Drop this code into a form to see it in action... Option Compare Database Option Explicit Private Declare Function SendMessage Lib _ "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long Private Declare Sub sapiSleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long) Const SC_MONITORPOWER = &HF170& Const MONITOR_ON = -1& Const MONITOR_OFF = 2& Const WM_SYSCOMMAND = &H112 Private Sub Command0_Click() ' 'Turn Monitor off: SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF sapiSleep 5000 ' wait 5 seconds 'Turn Monitor on: SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_ON End Sub Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Lonnie Johnson Sent: Thursday, May 28, 2009 3:12 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Can you use an API in vba to shutdown a monitor? Thanks. That seemed to work initially. It comes back on after about 2 seconds. May God bless you beyond your imagination! Lonnie Johnson ProDev, Professional Development of MS Access Databases Visit me at ==> http://www.prodev.us ________________________________ From: "Heenan, Lambert" <Lambert.Heenan at aiuholdings.com> To: Access Developers discussion and problem solving <accessd at databaseadvisors.com> Sent: Thursday, May 28, 2009 1:53:34 PM Subject: Re: [AccessD] Can you use an API in vba to shutdown a monitor? http://forums.devshed.com/visual-basic-programming-52/turn-off-monitor-72283.html Looks like the answer. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Lonnie Johnson Sent: Thursday, May 28, 2009 2:31 PM To: Access Developers discussion and problem solving Subject: [AccessD] Can you use an API in vba to shutdown a monitor? I am sure it is possible but I cannot find any code to shutdown my monitor with code. Does anyone have any direction? Thanks. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com