|
-
Jun 29th, 2009, 05:08 PM
#1
Thread Starter
Banned
Help me!!
Hey guys! I dont know whats problem but my friend give me some source codes for turn on and turn off monitor:
turn off:
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
turn on:
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) -1);
So it show me like 6 errors .. so can someone help me ?? and i need another 1 so someone know for to change a administrator password on computer ?
-
Jun 29th, 2009, 05:50 PM
#2
Re: Help me!!
So, are we going to have a guessing game at what these 6 errors are, or are you going to tell us?
-
Jun 29th, 2009, 06:05 PM
#3
Re: Help me!!
A code that changes an administrator password? Please, tell us more.
My usual boring signature: Nothing
 
-
Jun 29th, 2009, 06:53 PM
#4
Re: Help me!!
A code that changes an administrator password? Please, tell us more.
Pfft. Every NetAdmin knows the command to do that via CMD.
As for your errors, I could name several:
1. You gave us none.
2. What does your code do?
3. What are the errors actually?
4. What's the purpose? (Optional)
-
Jun 29th, 2009, 07:03 PM
#5
Thread Starter
Banned
Re: Help me!!
Im talknig about code to turn on and turn off MONITOR
-
Jun 29th, 2009, 07:13 PM
#6
Re: Help me!!
yes, you made that clear in the first post. You also told us that you get around 6 errors. Tell us more about them.
-
Jun 29th, 2009, 07:18 PM
#7
Thread Starter
Banned
Re: Help me!!
This is my errors and im newbie here and with coding so i need help:
-
Jun 29th, 2009, 07:35 PM
#8
Re: Help me!!
 Originally Posted by SoulCollector
Im talknig about code to turn on and turn off MONITOR
No need to get mean, we're just asking about this:
 Originally Posted by SoulCollector
So it show me like 6 errors .. so can someone help me ?? and i need another 1 so someone know for to change a administrator password on computer ?
As for your errors, I haven't a clue. Those don't appear to be VB.net codenames that I'm aware of.
-
Jun 29th, 2009, 07:40 PM
#9
Re: Help me!!
looks like you're using API calls and forgot to import something.
can you post your code?
side-note: if i ever had a program try to turn off my monitor (aside from maybe a screen-saver..) i would be thoroughly pissed 
vb Code:
Const HWND_BROADCAST As Integer = &HFFFF
Const SC_MONITORPOWER As Integer = &HF170
Const WM_SYSCOMMAND As Short = &H112S
Sub Main()
Dim instr As String = Command()
Select Case
Command().ToLower
'Make sure it matches - and look at the commandline switch
Case "off"
TurnOff()
Case "on"
TurnOn()
Case "test"
TurnOff()
'turn off monitor
System.Threading.Thread.Sleep(10000)
'wait 10 seconds
TurnOn()
'turn on monitor
Case Else
MsgBox("Usage, [on]/[off]/[test] ", _
MsgBoxStyle.Information, _
"Need Command Switch")
End Select
End Sub
_ Private Function SendMessage( ByVal Handle As Int32, _
ByVal wMsg As Int32, ByVal wParam As Int32, _
ByVal lParam As Int32) As Int32
End Function
Sub StandBy()
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 1)
End Sub
Sub TurnOff()
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2)
End Sub
Sub TurnOn()
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1)
End Sub
Last edited by stateofidleness; Jun 29th, 2009 at 07:43 PM.
-
Jun 29th, 2009, 07:47 PM
#10
Re: Help me!!
found this as well:
vb Code:
MonitorSet False to turn the monitor off or MonitorSet True to turn the monitor on Const MONITOR_ON = -1& Const MONITOR_OFF = 2& Const SC_MONITORPOWER = &HF170& Const WM_SYSCOMMAND = &H112 Declare Auto Function SendMessage Lib "user32" ( _ ByVal hWnd As IntPtr, _ ByVal Msg As Integer, _ ByVal wParam As Integer, _ ByVal lParam As Integer) As Integer Function MonitorSet(Optional ByVal bOn As Boolean = True) As Integer MonitorSet = SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, IIf(bOn, MONITOR_ON, MONITOR_OFF)) End Function
-
Jun 30th, 2009, 05:47 AM
#11
Thread Starter
Banned
Re: Help me!!
is that code for turning off a monitor and turning on ?? if that is then thanks !! hhh i gonna make prank for my friend but thnx for code i m newbie and gonna learn more about vb !
-
Jun 30th, 2009, 06:16 AM
#12
Re: Help me!!
 Originally Posted by SoulCollector
is that code for turning off a monitor and turning on ?? if that is then thanks !! hhh i gonna make prank for my friend but thnx for code i m newbie and gonna learn more about vb !
We do not support pranks.
This thread is closed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|