|
Use WaitForSingle object instead of loop. WaitForSingleObject returns when thread is finished, or specified timeout is reached.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
could you give an example of this?
|
|
|
|
|
::WaitForSingleObject(pYourThread->m_hThread, INFINITE);
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
DWORD exitcode = STILL_ACTIVE;
//set autodelete to false. This allows us to retrieve a handle for m_pThread.
m_pThread->m_bAutoDelete = false;
//tell the thread to end
m_pThread->PostThreadMessage(WM_STOPTHREAD, 0, 0);
bool temp = ::GetExitCodeThread(m_pThread->m_hThread, &exitcode);
if ( exitcode == STILL_ACTIVE ) ::WaitForSingleObject(m_pThread->m_hThread,INFINITE);
|
|
|
|
|
Is this the right way to force a dialog to repaint it's client area?
CRect r;
GetClientRect(&r);
InvalidateRect(r);
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Just call CWnd::Invalidate, which calls ::InvalidateRect and passes NULL as rectangle. In that case, complete client area is invalidated.
Why are you doing this to CDialog?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
|
Tomasz is right, in that calling Invalidate() will make the window eligible for repainting. But to force a repaint, you should do:
Invalidate();
UpdateWindow(); /ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks Ravi
It was basically for my demo app in my new article
By the way it repainted without the call to UpdateWindow()() on my Win XP prof
Maybe if none of the other threads or processes are busy an Invalidate() alone will do, but if the system is real busy, then we can force it by an UpdateWindow()
I am correct I hope
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Yes, UpdateWindow() causes Windows to send a WM_PAINT message to an invalidated window, while Invalidate() cause WM_PAINT to be posted. I use UpdateWindow() to force a repaint when I can't afford to wait for the posted WM_PAINT to eventually arrive. It probably doesn't make a difference in your demo app.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi
How can i associate a file extension with my app?
i want that all double clicks will will open the files in the same instance of my app.
thanks
|
|
|
|
|
Anonymous wrote:
How can i associate a file extension with my app?
If this is an SDI app, you can use these lines of code in the InitInstance:-
EnableShellOpen();
RegisterShellFileTypes(TRUE);
m_pMainWnd->DragAcceptFiles(); //for drag/drop support
Anonymous wrote:
want that all double clicks will will open the files in the same instance of my app.
For this you need to use a mutex to prevent multiple instances. You check if the prog is already running and if it is already running [search for it using window title/class name] post a WM_COPYDATA message to it passing the command line.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
There's an article by Joseph Newcomer that describes how to limit your app to one instance.
In the C++/MFC section, it's called "Avoiding Multiple Instances of an Application".
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Nish - Native CPian wrote:
How can i associate a file extension with my app?
If this is an SDI app, you can use these lines of code in the InitInstance:-
EnableShellOpen();
RegisterShellFileTypes(TRUE);
m_pMainWnd->DragAcceptFiles(); //for drag/drop support
What if I have a dialog-based app? Since I don't have the doc-view framework, AddDocTemplate() doesn't work.
Thanks!
|
|
|
|
|
Does anyone know of any website that contain tutorials for a beginner to learn opengl?
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I think Microsoft has invented A.I. My computer has a mind of its own!"
|
|
|
|
|
Try www.codeproject.com in the tutorial area
~RaGE();
|
|
|
|
|
http://nehe.gamedev.net/
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
|
And, of course, the beginners coding forum at opengl.org.
|
|
|
|
|
|
Hello
I have a CBitmap object.
It's a member of a class.
The user can call a function to load a bitmap into this CBitmap object.
Now I have another function where I use the CBitmap object.
Here I would not know whether the user has actually loaded the bitmap or not.
So can I use this code to check if the CBitmap object has a valid bitmap in it?
if(!m_bitmap.m_hObject)
MessageBox("No bitmap found");
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
That code looks fine Nish.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Roger Allen wrote:
That code looks fine Nish.
Thanks Riga, I am totally new at all this GDI stuff
But after converting that MSP thing to BMP this week, I am suddenly interested in GDI
Nish
p.s. GDI coding is highly leak-prone I think, for newbies anyway!
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Here is an artical which you may find useful on the subject:
http://www.codeproject.com/gdi/csavedc.asp
If you havn't read it already.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Does anyone know if it's possible to make dxdiag (the directx diagnostics tool), to lauch silently and dump its output to a given file (i.e. from the command line)
This is so that I can make an app automatically dump the system info of our users machines onto a network drive, which would simplify many support problems greatly (as many things have been down to not having the right graphics / directx version or having an old rubbish graphics card)
[I know I can ask them to manually run dxdiag and mail me the results, but I prefer something that is totally transparent, and would allow me to check the details the moment I'm told of a problem]
--
Help me! I'm turning into a grapefruit!
|
|
|
|