|
The system prevents sleep mode by detecting user input.
It doesn't automatically detect processes using the CPU or the
display.
To tell the system you're using the CPU, use
ES_SYSTEM_REQUIRED
To tell the system you're using the display, use
ES_DISPLAY_REQUIRED
Of course, you can use combinations.
Use ES_CONTINUOUS to have your settings remain in effect until the next
call.
To clear your continuous settings, use
SetThreadExecutionState(ES_CONTINUOUS);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
What about ES_AWAYMODE_REQUIRED ?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Read carefully[^]
It also looks like it's Vista+ only.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for pointing that out. The example at MSDN had me confused with its using all the 3 params, but now I see it was about 'Television recording'
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I am having two values one is of int type and another is of CString type.
Now I am calling SendMessage function as below:
m_ptrMainDlg->SendMessage(WM_CHAT_PICKED,m_nIndex,m_strSessionID);
but the above code is giving the following error:
Error 41 error C2664: 'CWnd::SendMessageW' : cannot convert parameter 3 from 'CString' to 'LPARAM' c:\documents and settings\shy\desktop\dheeraj latest working copy\sourcecodes 8-10-08(morning)\source code 06dec2007\popupdlg.cpp 148
Please tell me whats the problem
Thanks In Advance
Dhiraj
|
|
|
|
|
Use this:
m_ptrMainDlg->SendMessage(WM_CHAT_PICKED,m_nIndex, (LPARAM) (LPCTSTR) m_strSessionID);
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
it is not advisable sending CString as sendmessage parameter, it always advisable to send Dyanmic allocated character pointer string!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Hi @ all,
is it possible with direct x to list all attatched microphones and
choose one of them to work with? The same question are for speakers.
Greetings
Karsten
|
|
|
|
|
Hi all,
In a FormView Derived class on OnInitialUpdate() function i m using a code that is use many function of my class when i vew this form than before opening the Mouse cursor takes much time and application looks like it hangs.
Can i use thread to reduce the time for open form view.(If yes Please tell me how can i use thread i have no idea about thread.)
or any other method.
please tell me.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Yes, you can use a thread for that purpose. It won't speed up the time needed for the computation but at least your UI won't be frozen. Here's a link to a great article[^] about thread.
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi everyone,
I want an application which detects mouse clicks on desktop (at a particular pixel on the desktop).
For this I have created a global mouse hook to detect mouse events but it detects mouse click on every window, how do i detect that the mouse has clicked on desktop.
thanx in advance
|
|
|
|
|
May be you can get the desktop window handle using
HWND hWndDesktop = GetDesktopWindow();
And compare it with the handle received in the HOOK procedure.
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
By comparing the window handle with the desktop window handle. Convert the lParam to Mouse hook structure like
MOUSEHOOKSTRUCT *pMouseHooksStruct = (MOUSEHOOKSTRUCT *) lParam;
and use the hwnd member variable of the structure for which the event is generated for comparison.
- Malli...!
|
|
|
|
|
|
Hello everyone,
In Windbg help document about poi operator, it is mentioned.
--------------------
poi
Pointer-sized data from the specified address. The pointer size is 32 bits or 64 bits. In kernel debugging, this size is based on the processor of the target computer. In user-mode debugging on an Itanium-based computer, this size is 32 bits or 64 bits, depending on the target application. Therefore, poi is the best operator to use if you want pointer-sized data.
--------------------
My confusion is, what means "pointer-sized data"? Does it mean something like the size of C++ pointer type variable, e.g. 4 bytes for x86 machine and 8 bytes for x64 machine?
thanks in advance,
George
|
|
|
|
|
I want to down load only images from a webpage, please suggest.
Thanks!
|
|
|
|
|
You must be extaract controls on the webpage like buttons,links,images... but for more info see this link here[^].
|
|
|
|
|
Hi,
I have a Fortran program which I have to convert into Java originally. I have converted the code completely but can't get appropriate resutls. The code contains lot of arithmetic calculations using double precision data type of Fortran.
I believe the data types of C++ and Java are based on same whereas of Fortran double precision is based on IEEE756. I want to know how to convert these double precision calculations into C++ normally. For example:
double precision d1 = 0.3648564D0;
d1**2
DSIN(d1)
DCOS(d1)
The above are my main concerns which I find very difficult to convert. I use sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our normal C++ application is what I am looking for.
If you cna provide the same for Java that would be a plus for me, otherwise I will use the code accordingly of C++ in my Java application.
Please help me out. Am stuck up very badly.
Thanks
Terry
|
|
|
|
|
Do you mean IEEE-754? C++ do use IEEE-754 to store the floating point numbers. In fact the floating point number format are implemented at the hardware level and Intel processors use IEEE-754.
-Saurabh
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Trupti Mehta wrote:</div>IEEE756</blockquote>
Never head about. Do you mean IEEE 754 ?
Trupti Mehta wrote: I believe the data types of C++ and Java are based on same whereas of Fortran double precision is based on IEEE756. I want to know how to convert these double precision calculations into C++ normally. For example:
double precision d1 = 0.3648564D0;d1**2 // ** indicates exponentDSIN(d1) // sin of double precisionDCOS(d1) // cos of double precision
Even if the FORTRAN double precision would based on a different standard, I believe the results of both programs (i.e. the FORTRAN and the Java one) should be comparable. Are you sure the logic of your translation is correct?
Have you made a test to compare the results (given by FORTRAN vs Java ) of such simple functions as sin and cos ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is this safe?
inline void YieldMessages( int milliseconds, int sleepTime = 50 )
{
DWORD targetTime = GetTickCount()+milliseconds;
while ( GetTickCount() < targetTime )
{
AfxGetApp()->PumpMessage();
Sleep(sleepTime);
}
}
I wrote this when I was having trouble getting a CWinThread to shutdown. This let's me post a WM_QUIT and wait for the thread to terminte....
I've always wondered if it might be a hack...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: I've always wondered if it might be a hack...
Mmm, it is a hack.
What you normally do when waiting for a thread to finish is to wait on the thread handle with a call to any of the wait functions such as ::WaitForSingleObject() . There you also have the possibility to provide a timeout value.
To be able to do that you first create your thread suspended and then set the CWinThread::m_bAutoDelete member to FALSE before unleashing the thread with a call to CWinThread::ResumeThread() . This prevents the CWinThread object from doing a "delete this " when the thread finishes, otherwise the thread handle will become invalid since the handle will be closed in the CWinThread destructor call chain. Of course this means that you have to destroy the CWinThread object yourself when the thread has finished.
Since it's a UI-thread you post a WM_QUIT message to the thread and then wait on the thread handle. When the thread finishes, the wait function will return and then you can delete the CWinThread object.
This excellent article[^] is absolutely worth reading when it comes to multithreading. Even though the article refers to worker threads explicitly, the mind set is very much the same for UI-threads when shutting down apart from the WM_QUIT message.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks for all the information....
In general, threading's not an issue for me.
It's just dealing with CWinThread that bothers me. I can't say I like it very much.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: In general, threading's not an issue for me.
It's just dealing with CWinThread that bothers me. I can't say I like it very much.
That doesn't really make sense. CWinThread is just a thin wrapper around a
Windows thread. Nothing fancy there. You're still responsible for using
proper thread synchronization, which is much more safe and efficient than
using hacks like you showed above
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|