|
Here is my source code for locking my computer screen (Generally we do by pressing win+L)But Here in the below code what i am trying to do is , when user run the exe created by this application 1st the screen will be invisible (which is not happening in case of win+L) then next time when the user interact with the system it will show the user that the screen is locked .
<pre lang="c++"> #include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// Turn off monitor
Sleep(500); // Eliminate user's interaction for 500 ms
ret =SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
}
LockWorkStation();
return 0;
}
|
|
|
|
|
I have just tested this sequence of commands on Windows 7 and it works correctly. Is there something else in your code that you have not shown?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
no .. i have written everything .. i am using win 7 enterprise edition ..
|
|
|
|
|
I just ran the code you provided (after correcting the errors) and it again works fine in my Windows 7 Home Edition.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
May be its working in Home edition but my question is for enterprise edition .
|
|
|
|
|
Are you sure your code is actually running properly? The code that you posted in your original question will not even compile, so there may be some other bugs in your program.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Could it be the video driver? Could your keyboard/mouse be keeping the computer "alive?" Do you have Power Management configured correctly?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
can you please give some hint what shall be the power management for this ?
Please brother do reply soon ..Lots of my work depends on it ..
|
|
|
|
|
@DavidCrow : You are genius man .. Thankxx a lot .. As you said its just because of my Graphics driver . Earlier my graphics driver was not compatible with the hardware .. Now i have installed the new driver .. and the issue is resolved.. Thankxx again ..
|
|
|
|