PDA

Click to See Complete Forum and Search --> : Accessing system stuff with WinAPI


Sentry
Apr 1st, 2001, 01:52 AM
G'day,

I've built a fairly basic voice activated program using Visual Basic and Microsofts voice stuff. It opens programs and responds to simple voice commands.

I want to take it to the next level. (Eg; when I'm sleeping and I hear my renderer has finished beeping, I call out for the computer to shut down)

How do I access these API's?
Any help would be much appriciated :)

- Sentry

lxs
Apr 1st, 2001, 04:21 AM
useage:
to shut down:
ExitWindowsEx EWX_FORCE Or EWX_SHUTDOWN, 0


log off
ExitWindowsEx EWX_FORCE Or EWX_LOGOFF, 0

reboot
ExitWindowsEx EWX_FORCE Or EWX_REBOOT, 0

declares:Public Const SHUT_DOWN_WINDOWS As String = 123
Public Const RESTART_WINDOWS As String = 789
Public Const LOGOFF_WINDOWS As String = 456
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

Sentry
Apr 1st, 2001, 12:02 PM
Thanks Ixs for the help :)