Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralConverting text into image Pin
Shamoon19-Nov-02 0:51
Shamoon19-Nov-02 0:51 
GeneralRe: Converting text into image Pin
Miguel Lopes19-Nov-02 10:02
Miguel Lopes19-Nov-02 10:02 
Generala question about formview Pin
niuhaiyun19-Nov-02 0:41
niuhaiyun19-Nov-02 0:41 
GeneralRe: a question about formview Pin
Roger Allen19-Nov-02 1:56
Roger Allen19-Nov-02 1:56 
GeneralRe: a question about formview Pin
valikac19-Nov-02 7:28
valikac19-Nov-02 7:28 
GeneralMS Project 2002 SDK Pin
19-Nov-02 0:26
suss19-Nov-02 0:26 
Generalshutdown Pin
Anonymous19-Nov-02 0:08
Anonymous19-Nov-02 0:08 
GeneralRe: shutdown Pin
RobJones19-Nov-02 5:35
RobJones19-Nov-02 5:35 
I have been using this.. put this in one of you .h files..

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_POWEROFF | EWX_FORCE, 0)) 
		  return FALSE; 

	   return TRUE;
	}


Then make a call to the function in you app..

MySystemShutdown();

I've tested it in windows NT and 2k.. havent tried it in 9x..
GeneralRe: shutdown Pin
Anonymous20-Nov-02 23:36
Anonymous20-Nov-02 23:36 
QuestionDetect number of lines for an edit control? Pin
Anonymous18-Nov-02 23:47
Anonymous18-Nov-02 23:47 
AnswerRe: Detect number of lines for an edit control? Pin
Rickard Andersson2019-Nov-02 0:34
Rickard Andersson2019-Nov-02 0:34 
GeneralRe: Detect number of lines for an edit control? Pin
Anonymous19-Nov-02 0:46
Anonymous19-Nov-02 0:46 
GeneralRe: Detect number of lines for an edit control? Pin
Anonymous19-Nov-02 0:49
Anonymous19-Nov-02 0:49 
GeneralRe: Detect number of lines for an edit control? Pin
Rickard Andersson2019-Nov-02 0:55
Rickard Andersson2019-Nov-02 0:55 
GeneralRe: Detect number of lines for an edit control? Pin
Anonymous19-Nov-02 2:23
Anonymous19-Nov-02 2:23 
GeneralRe: Detect number of lines for an edit control? Pin
Rickard Andersson2019-Nov-02 3:46
Rickard Andersson2019-Nov-02 3:46 
QuestionCall MyDialog's UpdatejData() in Thread's worker function, Always give me out error.. What is the reason..? Pin
Sstar18-Nov-02 23:33
Sstar18-Nov-02 23:33 
AnswerRe: Call MyDialog's UpdatejData() in Thread's worker function, Always give me out error.. What is the reason..? Pin
Hans Ruck19-Nov-02 2:20
Hans Ruck19-Nov-02 2:20 
GeneralRe: Call MyDialog's UpdatejData() in Thread's worker function, Always give me out error.. What is the reason..? Pin
Rickard Andersson2019-Nov-02 3:54
Rickard Andersson2019-Nov-02 3:54 
GeneralRe: Call MyDialog's UpdatejData() in Thread's worker function, Always give me out error.. What is the reason..? Pin
Hans Ruck19-Nov-02 4:00
Hans Ruck19-Nov-02 4:00 
AnswerRe: Call MyDialog's UpdatejData() in Thread's worker function, Always give me out error.. What is the reason..? Pin
Gary R. Wheeler20-Nov-02 14:30
Gary R. Wheeler20-Nov-02 14:30 
GeneralProblem regarding MSChart activex control Pin
Chanda.com18-Nov-02 23:18
Chanda.com18-Nov-02 23:18 
QuestionHow do I make it? Pin
MFC is the Best18-Nov-02 23:12
MFC is the Best18-Nov-02 23:12 
AnswerRe: How do I make it? Pin
Iain Clarke, Warrior Programmer18-Nov-02 23:41
Iain Clarke, Warrior Programmer18-Nov-02 23:41 
GeneralRe: How do I make it? Pin
MFC is the Best19-Nov-02 0:11
MFC is the Best19-Nov-02 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.