|
Found it.
For anybody who cares, you call ExitWindowsEx to force a system shut down.
|
|
|
|
|
You must use AdjustTokenPrivileges for NT/2000/XP to use ExitWindowsEx(...).
I found this on the internet.
DWORD dwVersion = GetVersion();
if ( dwVersion < 0x80000000)
{
HANDLE hToken;
LUID tmpLuid;
HANDLE handleProcess=GetCurrentProcess();
if (!OpenProcessToken(handleProcess,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return;
if (!LookupPrivilegeValue(0,"SeShutdownPrivilege", &tmpLuid))
return;
TOKEN_PRIVILEGES NewState;
LUID_AND_ATTRIBUTES luidattr;
NewState.PrivilegeCount = 1;
luidattr.Luid=tmpLuid;
luidattr.Attributes=SE_PRIVILEGE_ENABLED;
NewState.Privileges[0]=luidattr;
if (!AdjustTokenPrivileges(hToken, false, &NewState, sizeof(TOKEN_PRIVILEGES), 0, 0))
return;
}
ExitWindowsEx(...);
|
|
|
|
|
I'm processing OnInitDialog of a MFC dialog-based application, before the window is shown. Sometimes i need to close this dialog and i'm using PostQuitMessage(0) , but the window will flash for a short moment before the application ends.
Do you know what is the easiest way of getting rid of that flash? I can handle it but my solution is not quite simple.
rechi
|
|
|
|
|
|
|
Use EndDialog() instead.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
|
How Can i change the name of the child window in an MDI application developed using MFC Appwizard...
|
|
|
|
|
Just go to the correspondind child windows document class's classwizard and add function SetTitle.... in that function u can set the name u want to the child window..
gudluck
adi
|
|
|
|
|
GetActiveFrame()->SetWindowText("helloman");
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|
|
Anybody knows how collect information from user`s computer and how this unformation use ?
How to debug those applications ?
|
|
|
|
|
check if following link is helpful
http://www.codeproject.com/debug/mapfile.asp
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|
|
Hi!
I'm using sprintf to get an integer into a string.
When I using strcpy I can use strcat to get my values on the same row.
Is there a command for that for sprintf?
Example how I will have it:
09:03:43 Stefan 123456
end example.
123456 is an integer that is calculated.
Thanks for your help,
Stefan
|
|
|
|
|
sprintf(szBuffer, "09:03:43 Stefan %d", nMyValue);
or if nMyValue is a long
sprintf(szBuffer, "09:03:43 Stefan %ld", nMyValue);
or if the other values are also variable
sprintf(szBuffer, "%s %s %ld", szTime, szName, nMyValue);
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Thank you!
it was "ld" I missed.
|
|
|
|
|
Hi!
Is it possible to use the MS calendar control without placing it in the dialog using the resource editor?
I think it works somehow by subclassing another window, but I don't know exactly how.
Thanks in advance
|
|
|
|
|
of course can, do it like insert an edit box
|
|
|
|
|
Hi all,
an MFC application, MDI. VC7. the wizard has generated few classes for me. and one of them is the main frame CMainFrame (CFrameWnd). If there are no children, the user can see light gray background. How can i customize this background (draw a bitmap)?
When i do ON_WM_PAINT ->
OnPaint(void)
{
CPaintDC dc(this);
// try to draw into dc
}
no effect! still standard light gray background!
how do i cutomize the way background drawn?
regards,
alex
debug - is my life style
|
|
|
|
|
|
wow!
thank you!!!
that't exactly what i looked for!
regards,
alex
debug - is my life style
|
|
|
|
|
I anyone be knowing where can be finding a code for rule editor liking the one in Outlook Express for email filter. Is nice way to building conditions and rules, and would like use of such thing.
Thank,
Quzi
|
|
|
|
|
Hi !
I'm trying to understand what is a XML-GUI....I tried to do a google search but couldn't find any relevant link.
Does anyone know a good site I could look at or could explain me what's a XML-GUI (I know what is a GUI, but cannot figure out what XML has to do with it !).
Thanks !
Jerome
|
|
|
|
|
lets just say that i think my comp sci 1 teacher bought his phd over the internet, cause i didnt learn too much. This is our first assignment for Comp Sci 2 and i'm pretty lost.
heres the problem:
Write a C++ program that will process the user’s full name (i.e., first, middle, and last name –> Joe Bob Allen is an example) and display the name in various ways. There is only one word allowed for the first name and one word allowed for the last name, but the middle name can consist of multiple words. The maximum length of the full name is 75. The maximum length of the first name is 25. The maximum length of the last name is 25.
For the little i do know, i would think it would be easiest just to create a loop that breaks off words at the spaces in the string. We dont actually have to output the middle names, so i'm guessing there would be another loop that starts at the end of the string and works its way up (to get the last name).
Any help would be much appreciated
|
|
|
|
|
Use strtok () function.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Hi,
I think u should make a structure for name
struct MyStructType
{ char First[25];
char Middle[25];
char Last[25];
};
with this way u can easily maintain all..
Data type can be CString...
OK!Good Bye..Have a Nice Life..Bye..Sumit Kapoor
Never consider anything Impossible before trying to solve that..---Sumit Kapoor---
|
|
|
|