In Aarons's suite there is a shutdown-function that I would like to use in 
order to shutdown the computer without the dialog-box (not to restart it); but 
it uses soft declares, something RB 5.5.5 cannot make use of.

Since I dont know how to adapt it for RB 5.5.5, I would be glad if somebody 
could 'translate' it for me:

Protected Function Shutdown(owner as Window, reason as String, type as Integer) 
As Boolean
   #if TargetWin32
      Soft Declare Function RestartDialog Lib "Shell32" Alias "#59" ( owner as 
Integer, reason as Ptr, flags as Integer ) as Integer
      
      dim ownerHandle as Integer
      if owner <> nil then ownerHandle = owner.WinHWND
      
      reason = reason + EndOfLine + EndOfLine
      
      dim retVal as Integer
      dim msg as MemoryBlock
      if IsPlatformNT then
         msg = ConvertEncoding( reason + Chr( 0 ), Encodings.UTF16 )
      else
         msg = ConvertEncoding( reason + Chr( 0 ), Encodings.ASCII )
      end if
      
      retVal = RestartDialog( ownerHandle, msg, type )
      
      Const IDOK = 1
      Const IDCANCEL = 2
      
      return retVal = IDOK
   #endif
End Function

and it is called by:

  if not Win32DeclareLibrary.Shutdown( self, "Because I asked nicely", 
Win32DeclareLibrary.kShutdownModeReboot ) then
    MsgBox "Fine, don't reboot then!  Let's see if you'll shutdown instead"
    Win32DeclareLibrary.Shutdown( self )
  end if

Thanks,

-- 
Carlo
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to