project in vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nimbalkar
    New Member
    • Feb 2008
    • 14

    project in vb

    Desciption : This VB project enables you to logoff
    programme:
    [CODE=vb]const EWX_LogOff as long=0
    const EWX_SHUTDOWN as long=1
    const EWX_REBOOT as long=2
    const EWX_FORCE as long=4
    Private Declare Function ExitWindow _
    Lib "User32" Alias "ExitWindow Ex" _
    (Byval dwOption as Long, Byval dwReserved as Long) as Long
    Private Sub command1_Click( )
    ExitWindow EWX_SHUTDOWN,&H FFFFFFFF
    End Sub
    Private Sub command2_Click( )
    ExitWindow EWX_REBOOT ,&HFFFFFFFF
    End Sub[/CODE]

    ERROR :
    But there is error as compiler error :
    expected :Lib
    I can't understand it and also &HFFFFFFFF what is that?
    It will not work on the window ntos.
    Last edited by Killer42; Feb 8 '08, 01:16 AM. Reason: Added CODE=vb tag
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    use this

    [code=vb]
    Private Declare Function ExitWindow Lib "User32" Alias "ExitWindow Ex" (ByVal dwOption As Long, ByVal dwReserved As Long) As Long

    [/code]
    and is not supported on NT.

    Please find details here .

    Comment

    • VACEPROGRAMER
      Banned
      New Member
      • Nov 2007
      • 167

      #3
      Hi. Dont do taht , this is easy way . . . .

      Shell("ShutDown -i , -t 01)

      ' i don't know was -i or something other
      It works whit VB5,VB6 and VB.Net

      *VACE*

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by debasisdas
        [code=vb]Private Declare Function ExitWindow Lib "User32" Alias "ExitWindow Ex" (ByVal dwOption As Long, ByVal dwReserved As Long) As Long[/code]
        That's exactly what the original post said. Except that it was typed in and was missing some capitals, of course (I've corrected it now).

        nimbalkar, the &HFFFFFFFF you asked about is a hexadecimal (base 16) value. Look it up in your documentation, or on the web. Wikipedia probably has a good description.
        Last edited by Killer42; Feb 8 '08, 01:17 AM.

        Comment

        • nimbalkar
          New Member
          • Feb 2008
          • 14

          #5
          ERROR:
          while running again there run time error:
          can't find dll entry point exitwindowex in user 32
          -------------------------------------------------------------------------------------------------------------------
          [QUOTE=nimbalkar]Desciption : This VB project enables you to logoff
          programme:
          [CODE=vb]const EWX_LogOff as long=0
          const EWX_SHUTDOWN as long=1
          const EWX_REBOOT as long=2
          const EWX_FORCE as long=4
          Private Declare Function ExitWindow _
          Lib "User32" Alias "ExitWindow Ex" _
          (Byval dwOption as Long, Byval dwReserved as Long) as Long
          Private Sub command1_Click( )
          ExitWindow EWX_SHUTDOWN,&H FFFFFFFF
          End Sub
          Private Sub command2_Click( )
          ExitWindow EWX_REBOOT ,&HFFFFFFFF
          End Sub[/CODE]

          Comment

          • nimbalkar
            New Member
            • Feb 2008
            • 14

            #6
            ERROR:
            while running again there run time error:
            can't find dll entry point exitwindowex in user 32

            Comment

            • QVeen72
              Recognized Expert Top Contributor
              • Oct 2006
              • 1445

              #7
              Hi,

              When you Shut-Down a WindowsNT , / Win2K, you need to have Sufficient Privileges, and the Status of Shut-Down.
              Check the code here

              Regards
              Veena

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                My initial guess would be that ExitWindowEx is a mis-typed ExitWindowsEx. This is based merely on the observation that we're dealing with Microsoft Windows.

                Comment

                • werks
                  New Member
                  • Dec 2007
                  • 218

                  #9
                  Try this code..

                  Shell("rundll32 .exe user32.dll, LockWorkStation ")

                  Comment

                  • nimbalkar
                    New Member
                    • Feb 2008
                    • 14

                    #10
                    Originally posted by Killer42
                    My initial guess would be that ExitWindowEx is a mis-typed ExitWindowsEx. This is based merely on the observation that we're dealing with Microsoft Windows.

                    I have saw that there is nothing missing .again there is same error cant find the dll entry point. what is that

                    Comment

                    • Killer42
                      Recognized Expert Expert
                      • Oct 2006
                      • 8429

                      #11
                      Originally posted by nimbalkar
                      I have saw that there is nothing missing .again there is same error cant find the dll entry point. what is that
                      I'm afraid your post is a bit hard to understand. But a little research on the web has shown that the suggestion I made in post #8 is almost certainly correct. For details, see this link.

                      Comment

                      • nimbalkar
                        New Member
                        • Feb 2008
                        • 14

                        #12
                        [QUOTE=nimbalkar]Desciption : This VB project enables you to logoff
                        programme:
                        [CODE=vb]const EWX_LogOff as long=0
                        const EWX_SHUTDOWN as long=1
                        const EWX_REBOOT as long=2
                        const EWX_FORCE as long=4
                        Private Declare Function ExitWindow _
                        Lib "User32" Alias "ExitWindow Ex" _
                        (Byval dwOption as Long, Byval dwReserved as Long) as Long
                        Private Sub command1_Click( )
                        ExitWindow EWX_SHUTDOWN,&H FFFFFFFF
                        End Sub
                        Private Sub command2_Click( )
                        ExitWindow EWX_REBOOT ,&HFFFFFFFF
                        End Sub[/CODE]

                        PROBLEM:
                        now there is no error but the system willnot shut down

                        Comment

                        Working...