Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can we read one application variable value from other application Pin
Cedric Moonen28-Sep-09 22:31
Cedric Moonen28-Sep-09 22:31 
GeneralRe: How can we read one application variable value from other application Pin
mohant$.net28-Sep-09 22:54
mohant$.net28-Sep-09 22:54 
GeneralRe: How can we read one application variable value from other application Pin
Cedric Moonen28-Sep-09 23:02
Cedric Moonen28-Sep-09 23:02 
GeneralRe: How can we read one application variable value from other application Pin
mohant$.net28-Sep-09 23:15
mohant$.net28-Sep-09 23:15 
GeneralRe: How can we read one application variable value from other application Pin
Cedric Moonen28-Sep-09 23:26
Cedric Moonen28-Sep-09 23:26 
GeneralRe: How can we read one application variable value from other application Pin
mohant$.net28-Sep-09 23:41
mohant$.net28-Sep-09 23:41 
QuestionWait cursor remain waiting after the even finished Pin
Chesnokov Yuriy28-Sep-09 21:41
professionalChesnokov Yuriy28-Sep-09 21:41 
AnswerRe: Wait cursor remain waiting after the even finished Pin
Iain Clarke, Warrior Programmer28-Sep-09 21:58
Iain Clarke, Warrior Programmer28-Sep-09 21:58 
Windows is constantly sending WM_SETCURSOR messages to the window under the mouse. The onlt reason CWaitCursor works is that while you're in an event handler, you're not pumping messages.

If you're doing the calculations in another thread, then your main thread is able to proceed quite happily, so the wait cursor would not be appropriate anyway!

You have a few choices.

1/ My favourite.
Provide a progress bar in your main thread, and a cancel button. As the calculate thread proceeds, post messages to the main thread, which will then update the process bar. But... if this was within your casual abilities [*], you would not be asking the question...

2/ Handle WM_SETCURSOR, and return differing values.

This is still not easy...

You need to set the view to use a window class with no default cursor:
BOOL CMyView::OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message )
{
   if (m_bThreadRunning) // set to an hour glass is we have our thread running
   {
       ::SetCursor (::LoadCursor (NULL, IDC_WAIT)); // set the hourglass
       return TRUE; // We set the cursor manually,. so all done!
   }

   return FALSE; // do the default thing
}


How you set the m_bThreadRunning flag is another question. But you know when the thread starts, as you fire it yourself. And you must have some way of knowing when the calculations are done, or they're not much use to you!

3/
Well, there are many other ways, but a lot will depend on the nature of your application, which I can't see.

Good luck - you'll find many more problems with multithreading. It's very powerful, but hard. And pretty much expected from any modern program.

Iain.

[*] I'm not trying to be patronising. I have every confidence you will gain experience, and be able to do this stuff in your sleep.

I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[^]

QuestionRe: Wait cursor remain waiting after the even finished Pin
Chesnokov Yuriy28-Sep-09 22:44
professionalChesnokov Yuriy28-Sep-09 22:44 
AnswerRe: Wait cursor remain waiting after the even finished Pin
Iain Clarke, Warrior Programmer29-Sep-09 0:26
Iain Clarke, Warrior Programmer29-Sep-09 0:26 
QuestionProblem in Image save Pin
Game-point28-Sep-09 21:37
Game-point28-Sep-09 21:37 
AnswerRe: Problem in Image save [modified] Pin
CPallini28-Sep-09 22:35
mveCPallini28-Sep-09 22:35 
GeneralRe: Problem in Image save Pin
Game-point28-Sep-09 22:47
Game-point28-Sep-09 22:47 
GeneralRe: Problem in Image save Pin
CPallini28-Sep-09 23:08
mveCPallini28-Sep-09 23:08 
GeneralRe: Problem in Image save Pin
Game-point28-Sep-09 23:13
Game-point28-Sep-09 23:13 
Questionrun one system exe on the Another system Pin
trioum28-Sep-09 21:31
trioum28-Sep-09 21:31 
AnswerRe: run one system exe on the Another system Pin
Rajesh R Subramanian29-Sep-09 1:54
professionalRajesh R Subramanian29-Sep-09 1:54 
GeneralRe: run one system exe on the Another system Pin
trioum29-Sep-09 2:44
trioum29-Sep-09 2:44 
QuestionPointer to CWnd* - why does not this work? [modified] Pin
Makakuin28-Sep-09 21:23
Makakuin28-Sep-09 21:23 
AnswerRe: Pointer to CWnd* - why does not this work? Pin
Cedric Moonen28-Sep-09 21:50
Cedric Moonen28-Sep-09 21:50 
QuestionRe: Pointer to CWnd* - why does not this work? Pin
CPallini28-Sep-09 22:08
mveCPallini28-Sep-09 22:08 
AnswerRe: Pointer to CWnd* - why does not this work? Pin
Makakuin28-Sep-09 22:09
Makakuin28-Sep-09 22:09 
QuestionHow can i read environment variable from c program [modified] Pin
mohant$.net28-Sep-09 20:08
mohant$.net28-Sep-09 20:08 
AnswerRe: How can i read environment variable from c program Pin
Code-o-mat28-Sep-09 20:25
Code-o-mat28-Sep-09 20:25 
AnswerRe: How can i read environment variable from c program Pin
«_Superman_»28-Sep-09 20:47
professional«_Superman_»28-Sep-09 20:47 

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.