Hi
if two users are working simultaneously in a same form,How to refresh the data automatically which was added by the other user.
I herad that through windows API 'Postmessage' and 'registerdwindowmessgae' we can handle this.
Please give some examples
runcyclexcsk wrote:
Scott - many thanks, I will give it a try!
07-Jul-07
Scott - many thanks, I will give it a try!
Previous Posts In This Thread:
On Wednesday, July 04, 2007 4:03 PM
runcyclexcsk wrote:
passing "parent" ID to a new thread
Hi all
secondary window and to communicate with the main window b
PostMessage
pNewThread = (CNewThread*)AfxBeginThread(RUNTIME_CLASS(CNewThread),0)
I need to pass the ID of the main window to the new thread when
create the new thread, to be able to PostMessage to the main windo
later. How do I pass the main widnow ID to the new thread?
understand that there is no parent-child reglationship between threads.
On Wednesday, July 04, 2007 4:21 PM
Doug Harrison [MVP] wrote:
Re: passing "parent" ID to a new thread
On Wed, 04 Jul 2007 13:03:41 -0700, ***@yahoo.com wrote
If there were such a relationship, it wouldn't be between a window and
thread; it would be between the threads. For a number of reasons, it i
usually better for one thread to create all the windows; this thread i
called the "main UI thread" among other things. That said, to pas
information into a thread when you create it, use the second AfxBeginThrea
parameter for which you're currently passing 0. If it's pointer-sized o
smaller, you can just cast it to LPVOID when you call AfxBeginThread an
back to the original type in the thread entry function; it's common to d
this with the "this" pointer of a member function. If you need to pass
lot of information and can't do it with "this", create a new class o
struct, dynamically create an instance with new, and pass a pointer to i
as the thread parameter. The created thread then assumes ownership of th
object and must delete it when done with it. This hand-off protocol avoid
lifetime issues, and you may need to use it when you PostMessage betwee
threads. Finally, for some info on safely using AfxBeginThread, see
http://members.cox.net/doug_web/threads.ht
--
Doug Harriso
Visual C++ MVP
On Wednesday, July 04, 2007 4:30 PM
runcyclexcsk wrote:
Doug,Thanks a bunch, it hepled a lot.
Doug
Thanks a bunch, it hepled a lot.
On Wednesday, July 04, 2007 10:05 PM
Ben Voigt [C++ MVP] wrote:
Re: passing "parent" ID to a new thread
If there is only one "main window", then a global variable will wor
perfectly fine.
On Wednesday, July 04, 2007 10:50 PM
runcyclexcsk wrote:
I know, this is how I've been doing it so far, but I am drowning inglobals by
I know, this is how I have been doing it so far, but I am drowning i
globals by now... too many of them. I am trying to make it cleaner.
On Wednesday, July 04, 2007 11:13 PM
Ben Voigt [C++ MVP] wrote:
Re: passing "parent" ID to a new thread
static member variable... to keep things organize
But it still acts like a global.
On Thursday, July 05, 2007 12:27 AM
Scott Seligman [MSFT] wrote:
Re: passing "parent" ID to a new thread
Why not pass it in as the pParam of AfxBeginThread()
-
Scott Seligman [MSFT
This posting is provided AS IS with no warranties, and confer
no rights.
On Friday, July 06, 2007 12:34 AM
runcyclexcsk wrote:
Yeah, I am trying to figure it out, but I am confused about converting"this"
Yeah, I am trying to figure it out, but I am confused about convertin
"this" (which is a pointer to a CDialog class) to LPVOID. If I jus
d
AfxBeginThread(RUNTIME_CLASS(Fluoro_532_thread), this
...it does not work, and casting "this" to (void *) does not wor
either.
On Friday, July 06, 2007 12:50 AM
runcyclexcsk wrote:
AfxBeginThread with RUNTIME_CLASS(thread) as the first parametercreates a user
AfxBeginThread with RUNTIME_CLASS(thread) as the first paramete
creates a user interface thread. "LPVOID pParameter" is not amon
parameters of an interface thread overloading.
On Friday, July 06, 2007 7:33 AM
Scott McPhillips [MVP] wrote:
Re: passing "parent" ID to a new thread
***@yahoo.com wrote:
Here is a two-step way to pass parameters to a UI thread:
pThread = (CMyThread *)AfxBeginThread(
RUNTIME_CLASS(CMyThread),
THREAD_PRIORITY_NORMAL,
0,
CREATE_SUSPENDED);
pThread->m_hModalWait = CreateEvent(NULL, FALSE, FALSE, NULL);
pThread->m_bAutoDelete = FALSE;
pThread->ResumeThread();
--
Scott McPhillips [MVP VC++]
On Saturday, July 07, 2007 5:13 PM
runcyclexcsk wrote:
Scott - many thanks, I will give it a try!
Scott - many thanks, I will give it a try!
Submitted via EggHeadCafe - Software Developer Portal of Choice
A Framework to Animate WPF and Silverlight Pages Similar to the PowerPoint Slides
http://www.eggheadcafe.com/tutorials/aspnet/7390a840-dd39-4c35-9940-c7354940d878/a-framework-to-animate-wp.aspx