Hello!
I want to log off when the user exits FiveWin application.
Does anyone know how to do it?
Thanks,
Roman
#define EWX_LOGOFF 0
#define EWX_SHUTDOWN 1
#define EWX_REBOOT 2
#define EWX_FORCE 4
#define EWX_POWEROFF 8
FUNCTION LOGOFF()
ENABLEPERMISSIONS()
EXITWINDOWSEX( EWX_LOGOFF, 0 )
RETURN NIL
#pragma BEGINDUMP
#include "WinTen.h"
#include "Windows.h"
#include "HbApi.h"
#include "ClipApi.h"
HB_FUNC( ENABLEPERMISSIONS )
{
LUID tmpLuid;
TOKEN_PRIVILEGES tkp, tkpNewButIgnored;
DWORD lBufferNeeded;
HANDLE hdlTokenHandle;
HANDLE hdlProcessHandle = GetCurrentProcess();
OpenProcessToken( hdlProcessHandle, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hdlTokenHandle );
LookupPrivilegeValue( NULL, "SeShutdownPrivilege", &tmpLuid );
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Luid = tmpLuid;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges( hdlTokenHandle, FALSE, &tkp, sizeof( tkpNewButIgnored ), &tkpNewButIgnored, &lBufferNeeded );
}
HB_FUNC( EXITWINDOWSEX )
{
hb_retl( ExitWindowsEx( ( UINT ) hb_parni( 1 ), ( DWORD ) hb_parnl( 2 ) ) );
}
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 93 guests