arkadaslar ben c/c++ da bilgisatarı yeniden başlatacak/kapatacak reset kodu arıyorum hangisi olursa olsun farketmez kod daha çok borland c/c++ 3.1 uyumlu olursa ve xp dede çalışısa iyi olur
How to Shut Down the System The following example uses the ExitWindowsEx function to shut down the system. Shutting down flushes file buffers to disk and brings the system to a condition in which it is safe to turn off the computer. The application must first enable the SE_SHUTDOWN_NAME privilege. For more information, see Privileges.
The final parameter in the call to ExitWindowsEx indicates that the system was shut down for a planning update of the operating system. For more information, see System Shutdown Reason Codes.
Requirements Client Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95. Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server. Header Declared in Winuser.h; include Windows.h. Library Link to User32.lib. DLL Requires User32.dll.
EWX_SHUTDOWN yerine EWX_REBOOT ile reboot edebilirsin. bu örnek interaktif kullanıcı isen geçerli değilsen InitiateSystemShutdown yada InitiateSystemShutdownEx fonksiyonlarını kullanmalısın. detaylı bilgi için MS Platform SDK da ExitWindowsEx fonksiyonuna bakmalısın.
XP'de deneyemedim henüz sanırım çalışmıyor ama birazdan deneyip buraya yazarım.
Buraya da bir bakhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/how_to_shut_down_the_system.asp
Yukarıdaki kodları XP'de çalıştıramadım ama ME' da çalışıyordu doğru hatırlıyorsam.
< Bu mesaj bu kişi tarafından değiştirildi PHaLaNX. -- 27 Temmuz 2005, 13:22:09 >
Bu mesaja 1 cevap geldi. Cevapları Gizle
Bu mesaja 1 cevap geldi. Cevapları Gizle
belki işine yarar
http://www.thecodeproject.com/dialog/RathShutdownArticle.asp
Bu mesaja 1 cevap geldi. Cevapları Gizle
bu bir türlü inmiyor siteye üyeyim
Bu mesaja 1 cevap geldi. Cevapları Gizle
The following example uses the ExitWindowsEx function to shut down the system. Shutting down flushes file buffers to disk and brings the system to a condition in which it is safe to turn off the computer. The application must first enable the SE_SHUTDOWN_NAME privilege. For more information, see Privileges.
BOOL MySystemShutdown()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return( FALSE );
// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
if (GetLastError() != ERROR_SUCCESS)
return FALSE;
// Shut down the system and force all applications to close.
if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE,
SHTDN_REASON_MAJOR_OPERATINGSYSTEM |
SHTDN_REASON_MINOR_UPDATE |
SHTDN_REASON_FLAG_PLANNED))
return FALSE;
return TRUE;
}
The final parameter in the call to ExitWindowsEx indicates that the system was shut down for a planning update of the operating system. For more information, see System Shutdown Reason Codes.
Requirements
Client Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header Declared in Winuser.h; include Windows.h.
Library Link to User32.lib.
DLL Requires User32.dll.
EWX_SHUTDOWN yerine EWX_REBOOT ile reboot edebilirsin. bu örnek interaktif kullanıcı isen geçerli değilsen InitiateSystemShutdown yada InitiateSystemShutdownEx fonksiyonlarını kullanmalısın.
detaylı bilgi için MS Platform SDK da ExitWindowsEx fonksiyonuna bakmalısın.