Results 1 to 12 of 12

Thread: Help me!!

  1. #1

    Thread Starter
    Banned
    Join Date
    Jun 2009
    Posts
    12

    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 ?

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    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?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Help me!!

    A code that changes an administrator password? Please, tell us more.
    My usual boring signature: Nothing

  4. #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)

  5. #5

    Thread Starter
    Banned
    Join Date
    Jun 2009
    Posts
    12

    Re: Help me!!

    Im talknig about code to turn on and turn off MONITOR

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    Banned
    Join Date
    Jun 2009
    Posts
    12

    Re: Help me!!

    This is my errors and im newbie here and with coding so i need help:


  8. #8

    Re: Help me!!

    Quote Originally Posted by SoulCollector View Post
    Im talknig about code to turn on and turn off MONITOR
    No need to get mean, we're just asking about this:
    Quote 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.

  9. #9
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    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:
    1. Const HWND_BROADCAST As Integer = &HFFFF
    2. Const SC_MONITORPOWER As Integer = &HF170
    3. Const WM_SYSCOMMAND As Short = &H112S
    4.  
    5. Sub Main()
    6.     Dim instr As String = Command()
    7.     Select Case
    8.       Command().ToLower
    9.       'Make sure it matches - and look at the commandline switch
    10.       Case "off"
    11.             TurnOff()
    12.       Case "on"
    13.             TurnOn()
    14.       Case "test"
    15.             TurnOff()
    16.             'turn off monitor
    17.             System.Threading.Thread.Sleep(10000)
    18.             'wait 10 seconds
    19.             TurnOn()
    20.             'turn on monitor
    21.       Case Else
    22.             MsgBox("Usage, [on]/[off]/[test] ", _
    23.                    MsgBoxStyle.Information, _
    24.                    "Need Command Switch")
    25.     End Select
    26. End Sub
    27.  
    28. _ Private Function SendMessage( ByVal Handle As Int32, _
    29.           ByVal wMsg As Int32, ByVal wParam As Int32, _
    30.           ByVal lParam As Int32) As Int32
    31.  
    32. End Function
    33.  
    34. Sub StandBy()
    35.     SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 1)
    36. End Sub
    37.  
    38. Sub TurnOff()
    39.     SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2)
    40. End Sub
    41.  
    42. Sub TurnOn()
    43.     SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1)
    44. End Sub

  10. #10
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    Re: Help me!!

    found this as well:

    vb Code:
    1. MonitorSet False
    2.  
    3. to turn the monitor off or
    4.  
    5. MonitorSet True
    6.  
    7. to turn the monitor on
    8.  
    9.  
    10. Const MONITOR_ON = -1&
    11. Const MONITOR_OFF = 2&
    12. Const SC_MONITORPOWER = &HF170&
    13. Const WM_SYSCOMMAND = &H112
    14.  
    15. Declare Auto Function SendMessage Lib "user32" ( _
    16. ByVal hWnd As IntPtr, _
    17. ByVal Msg As Integer, _
    18. ByVal wParam As Integer, _
    19. ByVal lParam As Integer) As Integer
    20.  
    21. Function MonitorSet(Optional ByVal bOn As Boolean = True) As Integer
    22. MonitorSet = SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, IIf(bOn, MONITOR_ON, MONITOR_OFF))
    23. End Function

  11. #11

    Thread Starter
    Banned
    Join Date
    Jun 2009
    Posts
    12

    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 !

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help me!!

    Quote Originally Posted by SoulCollector View Post
    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
  •  



Click Here to Expand Forum to Full Width