Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Shutdown a system

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Shutdown a system
#4858
Posted by: 2004-07-20 04:50:27
Hello,

I want to use wxWidgets to shutdown a Linux system. I have the inital code which is written using MFC. In the source code, the following are used:

   HANDLE          hToken = NULL;
   TOKEN_PRIVILEGES TokenPriviledge;
   LUID          LocalUniqueID;
...
if(!(::OpenProcessToken(::GetCurrentProcess( ), TOKEN_ADJUST_PRIVILEGES, &hToken )))
...
if(!(::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &LocalUniqueID )))
and so forth...

wxWidgets offers bool wxShutdown(wxShutdownFlagsflags) with either wxSHUTDOWN_POWEROFF or wxSHUTDOWN_REBOOT

The application access token priviledges need to be set to allow the shutdown in the initial code and I don't know if the function is taking care of that or if I have to add some code...

Thanks again,

moons


Message2. Re: Shutdown a system
#4861
Posted by: upCASE 2004-07-20 15:31:50
Hi!
No, just use it.
On WinNT/2000/XP Platforms the priviledges are adjusted, on Win9x ExitWindowsEx() is called.

"...want to use wxWidgets to shutdown a Linux system."
Why would you need MFC code then?
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-7-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0