Arama butonu
Bu konudaki kullanıcılar: 1 misafir
5
Cevap
895
Tıklama
0
Öne Çıkarma
c/c++ reset kodu
S
20 yıl
Yüzbaşı
Konu Sahibi

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



P
20 yıl
Yarbay

system("RUNDLL32 shell32.dll,SHExitWindowsEx 6");  //reset için 

system("RUNDLL32 shell32.dll,SHExitWindowsEx 8"); //power-off için


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.
S
20 yıl
Yüzbaşı
Konu Sahibi

xp içinde herhalde win apilerden yararlanmak gerekiyor bununla ilgili birşey bulusan iyi olur


Bu mesaja 1 cevap geldi.
V
20 yıl
Çavuş

aşağıdaki linkte bir program var Dev C++ ta yazılmış
belki işine yarar

http://www.thecodeproject.com/dialog/RathShutdownArticle.asp


Bu mesaja 1 cevap geldi.
S
20 yıl
Yüzbaşı
Konu Sahibi

quote:

Orjinalden alıntı: VatooVatoo

aşağıdaki linkte bir program var Dev C++ ta yazılmış
belki işine yarar

http://www.thecodeproject.com/dialog/RathShutdownArticle.asp

bu bir türlü inmiyor siteye üyeyim


Bu mesaja 1 cevap geldi.
H
20 yıl
Onbaşı

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.


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.



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.