MFC, sockets and threads
J.Mendes@frcl.bull.fr
Thursday, November 14, 1996
Hello,
Environment: VC++ 4.2b, NT 4.0
I created a simple MDI application.
This application, when I select "New" in "File" menu, creates
a window and displays some information inside, this info
is retrieved using a connection(socket) to a remote application server.
My CDocument object has only one view.
I would like to do the same thing but using a thread.
I mean, when I select "New" in "File" menu, a thread is created
and this thread creates the window(document/view) and displays the information
inside, always using a connection(socket) to a remote application server.
How could I do that with the MFC AFXBeginThread API ?
Do you know examples in MSDN that provide such information?
Thanks for any help and information.
Regards,
Jean.
-------------------------------------------------
_____ Mendes Jean, Bull S.A
| | CL/F6/1G26
_|___|_ Rue Jean Jaures
( o o ) 78340 Les Clayes sous Bois
oo0-(_)-0oo FRANCE
e-mail : J.Mendes@frcl.bull.fr
bulltel : (23) 76225
phone : (33 1) 30 80 62 25
fax : (33 1) 30 80 75 63
-------------------------------------------------
Disclaimer: "The opinions expressed above are my own,
and not those of my employer."
Clarence Chiang -- CCCHIANG@us.oracle.com
Friday, November 15, 1996
[Mini-digest: 2 responses]
My suggestion would be created a UI thread which associated the CMDIChildWnd as the frame
window for the thread. But I think a even better idea would be to create the worker thread
for retrieving the info over the net.
Clarence Chiang
Oracle Corporation
Hello,
Environment: VC++ 4.2b, NT 4.0
I created a simple MDI application.
This application, when I select "New" in "File" menu, creates
a window and displays some information inside, this info
is retrieved using a connection(socket) to a remote application server.
My CDocument object has only one view.
I would like to do the same thing but using a thread.
I mean, when I select "New" in "File" menu, a thread is created
and this thread creates the window(document/view) and displays the information
inside, always using a connection(socket) to a remote application server.
How could I do that with the MFC AFXBeginThread API ?
Do you know examples in MSDN that provide such information?
Thanks for any help and information.
Regards,
Jean.
-------------------------------------------------
_____ Mendes Jean, Bull S.A
| | CL/F6/1G26
_|___|_ Rue Jean Jaures
( o o ) 78340 Les Clayes sous Bois
oo0-(_)-0oo FRANCE
e-mail : J.Mendes@frcl.bull.fr
bulltel : (23) 76225
phone : (33 1) 30 80 62 25
fax : (33 1) 30 80 75 63
-------------------------------------------------
Disclaimer: "The opinions expressed above are my own,
and not those of my employer."
-----From: Dong Chen
There is an article in the latest MSJ about MFC and multithreading
programming. There are also chapters in both Mike Blaszczak's "Revolutionary
guide to Win32 programming" and Jeff Prosise's "Programming windows 95 with
MFC" books about threads. These materials can get you started. Sooner or
later, you will need a copy of Jeffrey Richter's "Advanced Windows" book if
you are serious about win32 programming. But this book is not for MFC.
Exam your application carefully before you start thinking of multithreads.
Ask yourself some questions like: What the benefits will be if you use the
multithreads? How the threads communicate with each other? Will one thread
access an object belong to the other one (since some MFC objects are not
thread safe)? In your MDI application, Do you want to use separate UI
threads to create different view or let the framework to handle the UI while
use worker thread inside the child windows to do the job? Anyway, you should
pay much attention to the application design.
--
Dong
d_chen@ix.netcom.com
| Вернуться в корень Архива
|