Harus import:
using System.Runtime.InteropServices;
Lock Computer:
[DllImport(“user32.dll”)]
public static extern void LockWorkStation();
Kemudian panggil fungsinya:
LockWorkStation();
Logoff:
[DllImport(“user32.dll”)]
public static extern int ExitWindowsEx(int uFlags, int dwReason);
Panggil fungsinya:
Logoff biasa:
ExitWindowsEx(0, 0);
Logoff force:
ExitWindowsEx(4, 0);
Reboot:
ExitWindowsEx(2, 0);
Shutdown:
ExitWindowsEx(1, 0);
Hibernate:
Application.SetSuspendState(PowerState.Hibernate, true, true);
Standby:
Application.SetSuspendState(PowerState.Suspend true, true);
Bagus kan??
Jadi mengingatkan ak sama programming yang dulu, VB n C#.. eheheheh!! sekarang dah full of Java pak..! :D
Maju terus deh trainingnya..!
Yup keren berguna banget buat bikin app kaya shutdown timer, dll
great jobs hehe
kalo cara lock file ada ga?