Parsi Coders
سورس کد خاموش کردن مانیتور Vb6 - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Visual Basic Programming (http://parsicoders.com/forumdisplay.php?fid=39)
+---- انجمن: Visual Basic 6 (http://parsicoders.com/forumdisplay.php?fid=44)
+---- موضوع: سورس کد خاموش کردن مانیتور Vb6 (/showthread.php?tid=1393)



سورس کد خاموش کردن مانیتور Vb6 - Amin_Mansouri - 12-30-2011

کد:
'=========================================================================
' =========== Paste the lines below into a standard module ===============

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

Const SC_MONITORPOWER = &HF170&
Const MON_OFF = 2&
Const WM_SYSCOMMAND = &H112


Private Sub procTurnOff()

  SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MON_OFF

End Sub


'Now you can call the above procedure using a command button , say cmdTurnOff

'==============Add this code to the command button=======================

Private Sub cmdTurnOff_Click()

Call procTurnOff

End Sub

'====================End=================================================