how to organize several class and their instance in windows programming

Hi, everyone, I'm designing a project which could do some image 
processing, motion control and networking  using MFC.

nowadays I'm puzzled how to organize so many class and their instances. 
Though I think the "design pattern" could solve my problem, but what I 
only want is to get a simple method or a belief understand.

suppose these class are like this:

CImageProc  	(class deal with image processing)
CMotionControl	(class deal with motion control)
CNetwork 	(class deal with networking)
CXXXClass	(class doing other work)

This is the way I use, in the CMainFrame( I'm using SDI based MFC 
project), I add all these class as it's member variable. so, things can 
look like this.

class CMainFrame : public CFrameWnd{
.......
public:
	CImageProc 	m_image;
	CMotionControl 	m_motor;
	CNetwork 	m_socket;
	CXXXClass	m_myxxx;
....
}

So, I'm confused that how does these members communicate with each 
other. For example, After Image processing, I would like to do some 
motion control...

So, some member function of CMotionControl should be called in 
CImageProc like below:

CImageProc::Processing(){
	...
	//the next line is what I want to do or something like that
	m_motor.move(..);//This is just a pseudo code
}
But As we know, CImageProc could not access CMotionControl class 
directly, So, It should Add a Pointer to CMotionControl As it's member.
class CImageProc{
....
	CMotionControl *m_pMotor;
}

You can imagine that things become more complicated while all these 
Classes will Call other class's function. Each Class should maintain 
several Pointers pointing to other classes.

I thinks this is what my puzzle come from and I can't find the way to 
solve it. Especially When the Objects or instances number becomes larger 
and larger...

Thanks for reading my post.






0
Asmwarrior (75)
5/23/2008 4:19:22 AM
vc.mfc 33608 articles. 0 followers. Follow

19 Replies
782 Views

Similar Articles

[PageSpeed] 58

"asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
news:g15gls$tdm$1@aioe.org...

> class CMainFrame : public CFrameWnd{
> ......
> public:
> CImageProc m_image;
> CMotionControl m_motor;
> CNetwork m_socket;
> CXXXClass m_myxxx;
> ...
> }
>
> So, I'm confused that how does these members communicate with each other. 
> For example, After Image processing, I would like to do some motion 
> control...

[...]

> You can imagine that things become more complicated while all these 
> Classes will Call other class's function. Each Class should maintain 
> several Pointers pointing to other classes.

You may consider defining a class that stores instances of those "shared" 
"component" classes, e.g.

 // Stores all the subsystems of your app
 // (image processing, motion control, ...)
 class CSystemCore
 {
 public:
   CImageProc m_image;
   CMotionControl m_motor;
   CNetwork m_socket;
    ...

   //
   // Of course you may declare the above instances
   // as private/protected, and just expose some
   // public methods for accessing them, e.g.
   //
   // private:
   //    CImageProc m_image;
   //
   // public:
   //   CImageProc & GetImageProc() { return m_image; }
   //
 };

Then, you can pass a pointer to the CSystemCore instance to each of the 
"component" classes (like CImageProc, etc.), e.g.

  // Forward reference
  class CSystemCore;

  CImageProc
  {
     ...
     // Needs to access to all system components
     CSystemCore * m_pSystem;
  };

So, inside your CImageProc methods, you can reference the other system 
components (like CMotionControl), using the pointer to CSystemCore, e.g.

  void CImageProc::DoSomething()
  {
     ...

     // Need to control the m_motor CMotionControl instance
     m_pSystem->m_motor.DoSomethingWithMotor(...);

     // or more elegant (with private instance of CMotionControl
     // and public accessor):
     //  m_pSystem.GetMotionControl().DoSomethingWithMotore(...);
  }

Of course, when you create the CSystemCore instance, you must set the 
pointer to it into several component classes, e.g.

  // In CSystemCore constructor
  CSystemCore::CSystemCore()
  {
      m_image.m_pSystem = this;
      m_motor.m_pSystem = this;
  }

Or you can define proper constructors for CImageProc, CMotionContorl, etc.

  CImageProc( SystemCore * pSystem )
     : m_pSystem( pSystem )
    ...
  {
     ...
  }


  CMotionControl( SystemCore * pSystem )
    : m_pSystem( pSystem )
    ...
  {
     ...
  }

And initialize these instances in CSystemCore constructor like this:

  CSystemCore::CSystemCore()
     : m_image( this ),
       m_motor( this ),
      ...
  {
     ...
  }

So, you can make CSystemCore a singleton in your app, or you can put it into 
your CDocument class, or in whatever place your design suggests.

HTH,
Giovanni


0
5/23/2008 8:37:32 AM
"Giovanni Dicanio" <giovanni.dicanio@invalid.com> ha scritto nel messaggio 
news:%230uqMCLvIHA.3680@TK2MSFTNGP05.phx.gbl...

>     // or more elegant (with private instance of CMotionControl
>     // and public accessor):
>     //  m_pSystem.GetMotionControl().DoSomethingWithMotore(...);

typo:

  m_pSystem->GetMotionControl().DoSomethingWithMotor(...);




0
5/23/2008 8:43:23 AM
"asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
news:g15gls$tdm$1@aioe.org...

> You can imagine that things become more complicated while all these 
> Classes will Call other class's function. Each Class should maintain 
> several Pointers pointing to other classes.

In addition to what I wrote in my previous post, if you instead want to use 
the kind of "intricated" network of pointers, I would suggest to *not* use 
raw pointers, but use a smart pointer template class, like shared_ptr.
In fact, shared_ptr does a very good job in keeping reference counts of 
pointed instances, so you can just pass shared_ptr< of your class > around, 
and you don't need to pay attention to proper lifetime management of class 
instances ("who must delete whom and when, to avoid memory leaks?").

Giovanni


0
5/23/2008 8:50:58 AM
asm23 wrote:
> Hi, everyone, I'm designing a project which could do some image 
> processing, motion control and networking  using MFC.
> 
> nowadays I'm puzzled how to organize so many class and their instances. 
> Though I think the "design pattern" could solve my problem, but what I 
> only want is to get a simple method or a belief understand.
> 
> suppose these class are like this:
> 
> CImageProc      (class deal with image processing)
> CMotionControl    (class deal with motion control)
> CNetwork     (class deal with networking)
> CXXXClass    (class doing other work)
> 
> This is the way I use, in the CMainFrame( I'm using SDI based MFC 
> project), I add all these class as it's member variable. so, things can 
> look like this.
> 
> class CMainFrame : public CFrameWnd{
> ......
> public:
>     CImageProc     m_image;
>     CMotionControl     m_motor;
>     CNetwork     m_socket;
>     CXXXClass    m_myxxx;
> ...
> }
> 
> So, I'm confused that how does these members communicate with each 
> other. For example, After Image processing, I would like to do some 
> motion control...
> 
> So, some member function of CMotionControl should be called in 
> CImageProc like below:
> 
> CImageProc::Processing(){
>     ...
>     //the next line is what I want to do or something like that
>     m_motor.move(..);//This is just a pseudo code
> }
> But As we know, CImageProc could not access CMotionControl class 
> directly, So, It should Add a Pointer to CMotionControl As it's member.
> class CImageProc{
> ...
>     CMotionControl *m_pMotor;
> }
> 
> You can imagine that things become more complicated while all these 
> Classes will Call other class's function. Each Class should maintain 
> several Pointers pointing to other classes.
> 
> I thinks this is what my puzzle come from and I can't find the way to 
> solve it. Especially When the Objects or instances number becomes larger 
> and larger...

asm23:

I think I would just pass a pointer parameter to the methods that need it:

CImageProc::Processing(CMotionControl *pMotor)
{
     //...
     pMotor->move(..);
}

-- 
David Wilkinson
Visual C++ MVP
0
no-reply8010 (1791)
5/23/2008 12:44:09 PM
Giovanni Dicanio wrote:
> "Giovanni Dicanio" <giovanni.dicanio@invalid.com> ha scritto nel messaggio 
> news:%230uqMCLvIHA.3680@TK2MSFTNGP05.phx.gbl...
> 
>>     // or more elegant (with private instance of CMotionControl
>>     // and public accessor):
>>     //  m_pSystem.GetMotionControl().DoSomethingWithMotore(...);
> 
> typo:
> 
>   m_pSystem->GetMotionControl().DoSomethingWithMotor(...);
> 
> 
> 
> 
This is really a good method. Each embedded member class should contain 
a Pointer pointing to their enclosed class(how do we call it?) for 
calling each other.
Thank you very much. I'd change my project structure to  fit this method.
By the way, I think they are some ideas which I can't learned from C++ 
books  nor books talk about MFC or windows programming. ( I want to 
improve my programming ability...) Are there any books cover topics such 
as how to designed your program structure? Maybe, they are only exist in 
experience.

thank you!
0
Asmwarrior (75)
5/23/2008 1:11:12 PM
Giovanni Dicanio wrote:
> "asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
> news:g15gls$tdm$1@aioe.org...
> 
>> You can imagine that things become more complicated while all these 
>> Classes will Call other class's function. Each Class should maintain 
>> several Pointers pointing to other classes.
> 
> In addition to what I wrote in my previous post, if you instead want to use 
> the kind of "intricated" network of pointers, I would suggest to *not* use 
> raw pointers, but use a smart pointer template class, like shared_ptr.
> In fact, shared_ptr does a very good job in keeping reference counts of 
> pointed instances, so you can just pass shared_ptr< of your class > around, 
> and you don't need to pay attention to proper lifetime management of class 
> instances ("who must delete whom and when, to avoid memory leaks?").
> 
> Giovanni
> 
> 
Thanks again, though I have heard a little about "smart pointer", I 
should search some tutorials to learn it.
0
Asmwarrior (75)
5/23/2008 1:15:47 PM
Giovanni Dicanio wrote:
> "asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
> news:g15gls$tdm$1@aioe.org...
> 
>> You can imagine that things become more complicated while all these 
>> Classes will Call other class's function. Each Class should maintain 
>> several Pointers pointing to other classes.
> 
> In addition to what I wrote in my previous post, if you instead want to use 
> the kind of "intricated" network of pointers, I would suggest to *not* use 
> raw pointers, but use a smart pointer template class, like shared_ptr.
> In fact, shared_ptr does a very good job in keeping reference counts of 
> pointed instances, so you can just pass shared_ptr< of your class > around, 
> and you don't need to pay attention to proper lifetime management of class 
> instances ("who must delete whom and when, to avoid memory leaks?").

Giovanni:

I think in this situation the actual objects are on the stack, so there is no 
problem using ordinary pointers. In fact it would be a big mistake to put them 
in a smart pointer class, because the smart pointer will try to delete them when 
the reference count drops to zero.

-- 
David Wilkinson
Visual C++ MVP
0
no-reply8010 (1791)
5/23/2008 1:55:30 PM
See below...
On Fri, 23 May 2008 12:19:22 +0800, asm23 <asmwarrior@gmail.com> wrote:

>Hi, everyone, I'm designing a project which could do some image 
>processing, motion control and networking  using MFC.
>
>nowadays I'm puzzled how to organize so many class and their instances. 
>Though I think the "design pattern" could solve my problem, but what I 
>only want is to get a simple method or a belief understand.
>
>suppose these class are like this:
>
>CImageProc  	(class deal with image processing)
>CMotionControl	(class deal with motion control)
>CNetwork 	(class deal with networking)
>CXXXClass	(class doing other work)
>
>This is the way I use, in the CMainFrame( I'm using SDI based MFC 
>project), I add all these class as it's member variable. so, things can 
>look like this.
****
So, what do these classes represent?  First, I'd suggest that the mainframe is the WORST
possible place to put these.  They are probably part of the document or the view,
depending on what they do.  When working with external devices, for example, think of the
device as being logically part of the "document", a "virtual document" if you want.
Therefore, it seems more likely that CMotionControl deals with controlling a device and
therefore should be in the document.

Here's a question to ask: if it were MDI, controlling, independently, several things and
displaying several things, what would you do?  You couldn't have just ONE instance in the
mainframe because you would be controlling multiple devices.  And displaying information
independently for multiple devices.

So it looks like the CImageProc belongs in the view, and the CNetwork belongs in the
document, and CXXXClass is probably part of the CDocument.
*****
>
>class CMainFrame : public CFrameWnd{
>......
>public:
>	CImageProc 	m_image;
>	CMotionControl 	m_motor;
>	CNetwork 	m_socket;
>	CXXXClass	m_myxxx;
>...
>}
>
>So, I'm confused that how does these members communicate with each 
>other. For example, After Image processing, I would like to do some 
>motion control...
****
This is a common error of design.  They probably shouldn't know very much about each
other's existence at all.  In particular, things that logically deal with views should not
be known to the document.
****
>
>So, some member function of CMotionControl should be called in 
>CImageProc like below:
>
>CImageProc::Processing(){
>	...
>	//the next line is what I want to do or something like that
>	m_motor.move(..);//This is just a pseudo code
>}
****
Why should the image function know about moving motors?  What it should do is tell the
document to move the motor.  The document does whatever it has to in order to move the
motor, but the very existence of CMotionControl should be invisible.  Nobody outside the
document should care in the slightest how the document effects motion.
****
>But As we know, CImageProc could not access CMotionControl class 
>directly, So, It should Add a Pointer to CMotionControl As it's member.
****
No.  See above.  It shouldn't know this class exists.  I think you have really confused
what is going on by trying to lump these all together in the mainframe.  Virtually NOTHING
of interest goes in the mainframe, except in MDI the functions that create new views, or
new doc/view pairs.  But think of it this way: if it deals with the logic of managing
windows, it goes into the mainframe.  If it deals with the logic of the embedded device,
it goes into the document; If it deals with the logic of displaying data or responding to
user input, it goes into the view.  All other decisions are based on that model, and at NO
time does the frame know anything about views or documents except at the most abstract
level (it would never know about a view or document method unique to your app, for
example); the view never knows about how a document is implemented, only the abstract
interface to your document class for effecting document changes, etc.

As long as you keep thinking in the model that these go into the mainframe, you will be
confused, because you're really trying to program in C, not C++, and are forcing
antiquated C-style ideas into an OO model.
****
>class CImageProc{
>...
>	CMotionControl *m_pMotor;
>}
****
Bad idea.  It should have no concept that a CMotionControl object exists.  
****
>
>You can imagine that things become more complicated while all these 
>Classes will Call other class's function. Each Class should maintain 
>several Pointers pointing to other classes.
****
And that's where this whole thing turns into spaghetti.  If every class can call every
other class, you have a class C-style mush of "flat" objects, every object knows the
internals of every other object, this is just flat-out WRONG in the OO domain.

If something involves updating the display, because the motion control has now effected a
change and wishes the view to update, it will call UpdateAllViews with an lHint/pHint
combination that says "I did the following".  The views will tell the CImageProc to do
something to change the display.  No document, no motion control, will ever know that a
CImageProc class exists, or what it does.  They will only know to tell views to update
themselves, period.  What the view does to effect that is entirely the business of the
view, and not the mainframe, and not the document.
****
>
>I thinks this is what my puzzle come from and I can't find the way to 
>solve it. Especially When the Objects or instances number becomes larger 
>and larger...
****
How can you have more instances?  You have only one instance, in the mainframe.  

Note: I've done embedded HVAC controllers, mass spectrometers, liquid CO2 chromatographs,
and a variety of other apps like this where we had views and controllers, and not once did
I put any knowledge of any of these classes into a mainframe.  It wouldn't even occur to
me to CONSIDER a solution in which (a) anything for these appeared in the mainframe and
(b) any class had a pointer to any other class.  So I consider the whole design very
confused, and I think you need to reconsider it.  

Think MDI.  What would happen if tomorrow your client came to you and said "We want MDI"?
What would have to change?  What if you had MDI with two or more views per document?
Perhaps a graph view (e.g., as I have done, of temperature trends) and a controller view
(what parameters affect the device).  Then this structure of
everything-pointing-to-everything begins to disintegrate.  Think structure FIRST, worry
about trivial concepts such as pointers ONLY after your design is solid.  This does not
strike me as a particularly solid design.  Anything that lumps device control and image
processing into the mainframe (which handles neither views nor documents) has too many
problems already.

Rethink it.  
				joe
****
>
>Thanks for reading my post.
>
>
>
>
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
5/23/2008 3:00:48 PM
"David Wilkinson" <no-reply@effisols.com> ha scritto nel messaggio 
news:eUDhqyNvIHA.5832@TK2MSFTNGP02.phx.gbl...

> I think in this situation the actual objects are on the stack, so there is 
> no problem using ordinary pointers. In fact it would be a big mistake to 
> put them in a smart pointer class, because the smart pointer will try to 
> delete them when the reference count drops to zero.

Hi David,

yes, of course you are right.

But I implicitly assumed in my mind that if the OP wants to use shared_ptr, 
he must allocate class instances on the heap, using new.
So, of course, the data members should be shared_ptr< of something > and not 
just instances built on the stack (like in OP's code).

I think that you did a good thing in pointing that out, because something 
that may appear obvious for someone, might appear not obvious to others. So, 
better be clear :)

Thanks,
Giovanni


0
5/23/2008 4:20:39 PM
"asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
news:g16g3j$2ak$2@aioe.org...

> Thanks again, though I have heard a little about "smart pointer", I should 
> search some tutorials to learn it.

Smart pointers can give a productivity boost in C++ development, giving to 
C++ programmers a kind of "managed heap" or "garbage collector" like C# and 
..NET.

Actually, some smart pointer classes (like shared_ptr) are better than .NET 
garbage collector, because garbage collector is non-deterministic, and is 
good for memory resources only (garbage collector is not good for non-memory 
resources, like textures, sockets, file handles... you must implement the 
"dispose" pattern for them in C#...).
Instead, shared_ptr is deterministic (i.e. in the point in time that the 
reference count of the pointed object becomes 0, the object is immediately 
destructed, and its resource released), and shared_ptr is good also for 
non-memory resources.

There's a video on Channel 9 by a bright member of VC++ Team: Stephan 'STL':


0
5/23/2008 4:30:41 PM
"asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
news:g16g3j$2ak$2@aioe.org...

> Thanks again, though I have heard a little about "smart pointer", I should 
> search some tutorials to learn it.

Smart pointers can give a productivity boost in C++ development, giving to
C++ programmers a kind of "managed heap" or "garbage collector" like C# and
..NET.

Actually, some smart pointer classes (like shared_ptr) are better than .NET
garbage collector, because garbage collector is non-deterministic, and is
good for memory resources only (garbage collector is not good for non-memory
resources, like textures, sockets, file handles... you must implement the
"dispose" pattern for them in C#...).

Instead, shared_ptr is deterministic (i.e. in the point in time that the
reference count of the pointed object becomes 0, the object is immediately
destructed, and its resource released), and shared_ptr is good also for
non-memory resources.

There's a video on Channel 9 about shared_ptr, by a bright member of VC++ 
Team: Stephan 'STL':

http://channel9.msdn.com/showpost.aspx?postid=385821

And there are some posts about that on VC++ Team's blog:

http://blogs.msdn.com/vcblog/archive/2008/02/25/channel-9-stephan-t-lavavej-digging-into-c-technical-report-1-tr1.aspx
http://blogs.msdn.com/vcblog/archive/2008/01/08/q-a-on-our-tr1-implementation.aspx
http://blogs.msdn.com/vcblog/archive/2007/12/26/just-what-is-this-tr1-thing.aspx


A final note:
If you use shared_ptr and smart pointers, your class instances must be 
created on the heap (using 'new'), and not on the stack, as correctly David 
W. pointed out.

HTH,
Giovanni



0
5/23/2008 4:33:19 PM
"asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
news:g16fr2$2ak$1@aioe.org...

> Thank you very much. I'd change my project structure to  fit this method.

You're welcome.


> By the way, I think they are some ideas which I can't learned from C++ 
> books  nor books talk about MFC or windows programming. ( I want to 
> improve my programming ability...) Are there any books cover topics such 
> as how to designed your program structure? Maybe, they are only exist in 
> experience.

Frankly speaking, I think that experience, and reading code written by 
people more expert than us, are the best things.

I bought a book about Design Patterns some years ago (I don't recall the 
author's names, but they were nicknamed like the "Gang of Four", IIRC), but 
I learnt much more from experience and from code written by people more 
expert than me, than from that book (I did not read that book entirely).

I would suggest also to read this newsgroup.
In fact, there are people here with very long quality experience in software 
development, like Tom, Joe, David-s, etc. (I think that Joe was in computer 
programming since the era of the punched cards!): you can learn a lot from 
them.

Giovanni


0
5/23/2008 4:38:33 PM
"Giovanni Dicanio" <giovanni.dicanio@invalid.com> ha scritto nel messaggio 
news:%23YTQYKPvIHA.3760@TK2MSFTNGP04.phx.gbl...

[...]
> There's a video on Channel 9 by a bright member of VC++ Team: Stephan 
> 'STL':

Ignore this post: I pressed some short-cut key on my keyboard before 
completing writing it... (sorry).

I sent the complete post below.



0
5/23/2008 4:40:04 PM
I think the REAL problem is that you are answering the question he asked, instead of
answering the question he SHOULD have asked, which is "does this organization make any
sense?".  I think it does not.  As soon as you start tossing document and view-related
stuff into the CMainFrame of SDI or MDI, you have made a serious design error.  As soon as
classes start getting complicated pointer schemes, it's probably a serious design error. I
think the fundamental design is confused, and looking like C, not OO; it sounds like
things are just being randomly tossed into CMainFrame, and that is already a serious
indicator of a design error.  Tossing thrings into CMainFrame is almost as bad as tossing
things into the CWinApp class.

I think the effort should concentrate on a good design, not some minor and trivial detail
of pointer management.  I don't think the concept of the pointers even makes sense.
					joe

On Fri, 23 May 2008 18:20:39 +0200, "Giovanni Dicanio" <giovanni.dicanio@invalid.com>
wrote:

>
>"David Wilkinson" <no-reply@effisols.com> ha scritto nel messaggio 
>news:eUDhqyNvIHA.5832@TK2MSFTNGP02.phx.gbl...
>
>> I think in this situation the actual objects are on the stack, so there is 
>> no problem using ordinary pointers. In fact it would be a big mistake to 
>> put them in a smart pointer class, because the smart pointer will try to 
>> delete them when the reference count drops to zero.
>
>Hi David,
>
>yes, of course you are right.
>
>But I implicitly assumed in my mind that if the OP wants to use shared_ptr, 
>he must allocate class instances on the heap, using new.
>So, of course, the data members should be shared_ptr< of something > and not 
>just instances built on the stack (like in OP's code).
>
>I think that you did a good thing in pointing that out, because something 
>that may appear obvious for someone, might appear not obvious to others. So, 
>better be clear :)
>
>Thanks,
>Giovanni
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
5/23/2008 8:20:16 PM
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
news:tg9e349fvatfknqpf9a90a5or3a2vj3uqb@4ax.com...

>I think the REAL problem is that you are answering the question he asked, 
>instead of
> answering the question he SHOULD have asked, which is "does this 
> organization make any
> sense?".

I think that I don't have enough elements to judge if the OP's design is 
good or not...

Yes, I was just trying to answer his original question, proposing a possible 
solution in C++.

Note that in my post I did not write about CMainFrame, etc.
I "abstracted" from that, and I suggested to put the OP's "component" 
classes (CMotionControl, CImageProc, etc.) into a common "container" (I 
called that CSystemCore), instead of putting everything in CMainFrame.

I don't know if for OP's design CSystemCore should be a singleton, or 
something related to a particular document, or something different...
I think that to understand these things one need to communicate with the 
designers, understand the problem, the requirements, the analysis...


> As soon as
> classes start getting complicated pointer schemes, it's probably a serious 
> design error.

I agree that the KISS (Keep It Simple Stupid - or something like this...) 
rule is a good rule to follow. And I do agree that the simpler the design, 
the better.
However, again, I don't know details of OP's original problem, so I assume 
that he simply wanted to do that (kind of several classes that need pointers 
to each others).


> I think the effort should concentrate on a good design, not some minor and 
> trivial detail
> of pointer management.

100% agree that design is *number one* thing. Implementation and coding come 
after design.
I just assumed the OP's design as an input "fixed" datum, kind of a 
constraint, and tried to propose a solution in C++.

Giovanni


0
5/23/2008 10:31:28 PM
Joseph M. Newcomer wrote:
> See below...
> On Fri, 23 May 2008 12:19:22 +0800, asm23 <asmwarrior@gmail.com> wrote:
> 
>> Hi, everyone, I'm designing a project which could do some image 
>> processing, motion control and networking  using MFC.
>>
>> nowadays I'm puzzled how to organize so many class and their instances. 
>> Though I think the "design pattern" could solve my problem, but what I 
>> only want is to get a simple method or a belief understand.
>>
>> suppose these class are like this:
>>
>> CImageProc  	(class deal with image processing)
>> CMotionControl	(class deal with motion control)
>> CNetwork 	(class deal with networking)
>> CXXXClass	(class doing other work)
>>
>> This is the way I use, in the CMainFrame( I'm using SDI based MFC 
>> project), I add all these class as it's member variable. so, things can 
>> look like this.
> ****
> So, what do these classes represent?  First, I'd suggest that the mainframe is the WORST
> possible place to put these.  They are probably part of the document or the view,
> depending on what they do.  When working with external devices, for example, think of the
> device as being logically part of the "document", a "virtual document" if you want.
> Therefore, it seems more likely that CMotionControl deals with controlling a device and
> therefore should be in the document.
> 
> Here's a question to ask: if it were MDI, controlling, independently, several things and
> displaying several things, what would you do?  You couldn't have just ONE instance in the
> mainframe because you would be controlling multiple devices.  And displaying information
> independently for multiple devices.
> 
> So it looks like the CImageProc belongs in the view, and the CNetwork belongs in the
> document, and CXXXClass is probably part of the CDocument.
> *****
>> class CMainFrame : public CFrameWnd{
>> ......
>> public:
>> 	CImageProc 	m_image;
>> 	CMotionControl 	m_motor;
>> 	CNetwork 	m_socket;
>> 	CXXXClass	m_myxxx;
>> ...
>> }
>>
>> So, I'm confused that how does these members communicate with each 
>> other. For example, After Image processing, I would like to do some 
>> motion control...
> ****
> This is a common error of design.  They probably shouldn't know very much about each
> other's existence at all.  In particular, things that logically deal with views should not
> be known to the document.
> ****
>> So, some member function of CMotionControl should be called in 
>> CImageProc like below:
>>
>> CImageProc::Processing(){
>> 	...
>> 	//the next line is what I want to do or something like that
>> 	m_motor.move(..);//This is just a pseudo code
>> }
> ****
> Why should the image function know about moving motors?  What it should do is tell the
> document to move the motor.  The document does whatever it has to in order to move the
> motor, but the very existence of CMotionControl should be invisible.  Nobody outside the
> document should care in the slightest how the document effects motion.
> ****
>> But As we know, CImageProc could not access CMotionControl class 
>> directly, So, It should Add a Pointer to CMotionControl As it's member.
> ****
> No.  See above.  It shouldn't know this class exists.  I think you have really confused
> what is going on by trying to lump these all together in the mainframe.  Virtually NOTHING
> of interest goes in the mainframe, except in MDI the functions that create new views, or
> new doc/view pairs.  But think of it this way: if it deals with the logic of managing
> windows, it goes into the mainframe.  If it deals with the logic of the embedded device,
> it goes into the document; If it deals with the logic of displaying data or responding to
> user input, it goes into the view.  All other decisions are based on that model, and at NO
> time does the frame know anything about views or documents except at the most abstract
> level (it would never know about a view or document method unique to your app, for
> example); the view never knows about how a document is implemented, only the abstract
> interface to your document class for effecting document changes, etc.
> 
> As long as you keep thinking in the model that these go into the mainframe, you will be
> confused, because you're really trying to program in C, not C++, and are forcing
> antiquated C-style ideas into an OO model.
> ****
>> class CImageProc{
>> ...
>> 	CMotionControl *m_pMotor;
>> }
> ****
> Bad idea.  It should have no concept that a CMotionControl object exists.  
> ****
>> You can imagine that things become more complicated while all these 
>> Classes will Call other class's function. Each Class should maintain 
>> several Pointers pointing to other classes.
> ****
> And that's where this whole thing turns into spaghetti.  If every class can call every
> other class, you have a class C-style mush of "flat" objects, every object knows the
> internals of every other object, this is just flat-out WRONG in the OO domain.
> 
> If something involves updating the display, because the motion control has now effected a
> change and wishes the view to update, it will call UpdateAllViews with an lHint/pHint
> combination that says "I did the following".  The views will tell the CImageProc to do
> something to change the display.  No document, no motion control, will ever know that a
> CImageProc class exists, or what it does.  They will only know to tell views to update
> themselves, period.  What the view does to effect that is entirely the business of the
> view, and not the mainframe, and not the document.
> ****
>> I thinks this is what my puzzle come from and I can't find the way to 
>> solve it. Especially When the Objects or instances number becomes larger 
>> and larger...
> ****
> How can you have more instances?  You have only one instance, in the mainframe.  
> 
> Note: I've done embedded HVAC controllers, mass spectrometers, liquid CO2 chromatographs,
> and a variety of other apps like this where we had views and controllers, and not once did
> I put any knowledge of any of these classes into a mainframe.  It wouldn't even occur to
> me to CONSIDER a solution in which (a) anything for these appeared in the mainframe and
> (b) any class had a pointer to any other class.  So I consider the whole design very
> confused, and I think you need to reconsider it.  
> 
> Think MDI.  What would happen if tomorrow your client came to you and said "We want MDI"?
> What would have to change?  What if you had MDI with two or more views per document?
> Perhaps a graph view (e.g., as I have done, of temperature trends) and a controller view
> (what parameters affect the device).  Then this structure of
> everything-pointing-to-everything begins to disintegrate.  Think structure FIRST, worry
> about trivial concepts such as pointers ONLY after your design is solid.  This does not
> strike me as a particularly solid design.  Anything that lumps device control and image
> processing into the mainframe (which handles neither views nor documents) has too many
> problems already.
> 
> Rethink it.  
> 				joe
> ****
>> Thanks for reading my post.
>>
>>
>>
>>
>>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
Thank you Joseph for pointing out many wrong ideaes.
The reason I put all these "component" in CMainFrame came from the wrong 
design structure Two years ago. When I bought a digital camera, I use 
sample code attached with it's SDK as my project's design Framework. But 
this sample code was a SDI MFC code WITHOUT Document/View support. They 
just put the wrapped classes such as CCamera and CImageProc in 
CMainFrame for simplicity.

So, After about two years, I was still doing coding on CImageProc and 
never consider it's wrong.(I'm a standalone programmer and do the whole 
thing in my project). When more and more functions(CMotionControl and 
CNetwork...) were added to my project, I always get confused on how to 
add these CLASSES to my project. I have no project experience before and 
It's really a tough and stressful and time-waste work.

I will take time to rethink the whole idea and try to redesign my 
project with doc/view support. I really gain many good ideas and 
knowledges from your answers( not this post, you answers several times 
before) I'd appreciate very much.
0
Asmwarrior (75)
5/24/2008 2:33:58 AM
See below...
On Sat, 24 May 2008 00:31:28 +0200, "Giovanni Dicanio" <giovanni.dicanio@invalid.com>
wrote:

>
>"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
>news:tg9e349fvatfknqpf9a90a5or3a2vj3uqb@4ax.com...
>
>>I think the REAL problem is that you are answering the question he asked, 
>>instead of
>> answering the question he SHOULD have asked, which is "does this 
>> organization make any
>> sense?".
>
>I think that I don't have enough elements to judge if the OP's design is 
>good or not...
****
From the description, I think I do, and it sounds like a really bad design.  I've spent
years rewriting code that looks like this design description.  I've seen too much of it,
and this pattern matches one of my antipatterns.
****
>
>Yes, I was just trying to answer his original question, proposing a possible 
>solution in C++.
>
>Note that in my post I did not write about CMainFrame, etc.
>I "abstracted" from that, and I suggested to put the OP's "component" 
>classes (CMotionControl, CImageProc, etc.) into a common "container" (I 
>called that CSystemCore), instead of putting everything in CMainFrame.
>
>I don't know if for OP's design CSystemCore should be a singleton, or 
>something related to a particular document, or something different...
>I think that to understand these things one need to communicate with the 
>designers, understand the problem, the requirements, the analysis...
****
I've a pretty good idea it wasn't thought out carefully.  I once got a program where the
interrupt handling code and the menu code were in the same module, one of the four modules
(each about 40K lines) that comprised the source.

When I was done, there were nearly 500 modules in the source tree.  The excuse given was
"fewer files compile faster" but even on a 500MHz machine, the whole thing compiled, from
scratch, in VC1.52C, in under 1 minute.  The last time I compiled it on a 2GHz machine, it
compiled in 25 seconds.  So the excuse that more files make slower compilation is
inoperative.  It had many of the features the OP described, with masses of objects
pointing to other objects so the whole thing was interconnected (this original software is
commemorated in my Dr. Seuss spoof)
****
>
>
>> As soon as
>> classes start getting complicated pointer schemes, it's probably a serious 
>> design error.
>
>I agree that the KISS (Keep It Simple Stupid - or something like this...) 
>rule is a good rule to follow. And I do agree that the simpler the design, 
>the better.
>However, again, I don't know details of OP's original problem, so I assume 
>that he simply wanted to do that (kind of several classes that need pointers 
>to each others).
****
I suspect not.  Image and motion classes in the mainframe don't make sense, in SDI or MDI.
****
>
>
>> I think the effort should concentrate on a good design, not some minor and 
>> trivial detail
>> of pointer management.
>
>100% agree that design is *number one* thing. Implementation and coding come 
>after design.
>I just assumed the OP's design as an input "fixed" datum, kind of a 
>constraint, and tried to propose a solution in C++.
****
I generally take as given that a complex design proposal like this is probably flawed. The
logic of the decomposition doesn't make sense, and once the classes are moved to where
they belong (views and documents) the pointers don't make any sense.  Too many years of
building, maintaining, and teaching software...I just hear some design like this, and I
get nervous.  
				joe
****
>
>Giovanni
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
5/24/2008 4:21:15 AM
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
news:mc5f34d05qj3rgrpk5qinroujkgq39rq7g@4ax.com...

> [...] with masses of objects
> pointing to other objects so the whole thing was interconnected (this 
> original software is
> commemorated in my Dr. Seuss spoof)

:-)

Giovanni


0
5/24/2008 9:58:15 AM
Giovanni Dicanio wrote:
> "asm23" <asmwarrior@gmail.com> ha scritto nel messaggio 
> news:g16fr2$2ak$1@aioe.org...
> 
>> Thank you very much. I'd change my project structure to  fit this method.
> 
> You're welcome.
> 
> 
>> By the way, I think they are some ideas which I can't learned from C++ 
>> books  nor books talk about MFC or windows programming. ( I want to 
>> improve my programming ability...) Are there any books cover topics such 
>> as how to designed your program structure? Maybe, they are only exist in 
>> experience.
> 
> Frankly speaking, I think that experience, and reading code written by 
> people more expert than us, are the best things.
> 
> I bought a book about Design Patterns some years ago (I don't recall the 
> author's names, but they were nicknamed like the "Gang of Four", IIRC), but 
> I learnt much more from experience and from code written by people more 
> expert than me, than from that book (I did not read that book entirely).
> 
> I would suggest also to read this newsgroup.
> In fact, there are people here with very long quality experience in software 
> development, like Tom, Joe, David-s, etc. (I think that Joe was in computer 
> programming since the era of the punched cards!): you can learn a lot from 
> them.
> 
> Giovanni
> 
> 
Yes, I do agree with you. I think reading other expert's code can gain a 
lot of knowledge and also, there are many experts in this news groups 
include you. Thank you very much, they can really teaching me and 
helping me.
0
Asmwarrior (75)
5/24/2008 1:22:51 PM
Reply:

Similar Artilces:

GWES: Window scaling
Hello, on two of our devices with different display sizes (3,5" and 5,7") which both have a resolution of 320x240, the same windows application is displayed in a different way. The application has got a window bigger than the display, i.e. not the whole window is visible. On the 3,5" dispay, the visible part of the window is smaller than on the 5,7" display. Why is it like this and how can I configure the 3,5" device to display windows the same way the 5,7" device does? I compared registry settings of display driver and GWES but they are the...

Windows 7 reinstall Outlook 2010 query
Before resinstalling my windows 7 64bit system I backed up all my outlook files. These consited of archive.pst archive1.pst, archive2.pst, archive3.pst, archive4.pst, also outlook.pst, outlook1.pst, outlook2.pst, outlook3.pst, outlook4.pst. After reinstalling outlook I then clicked on open then browsed to where the above file were and chose the 2 newest and largest and opened these. The newest and largest showed all my sent emails back to 2005 as I hoped for, the inbox however only had a bout a dozen entries. Why shouldn't this also show all my mail in since 2005, and is there a wa...

View -> Sized With Window (for Excel charts): I want it back, plea
While I appreciate that not every function survives from one version to the next, this is one I sorely miss ! I use Excel 2003 at work, and 2007 at home. I can stand the constant bleating about compatability. I can even (barely) tolerate the highlight colors not matching. But this? Why oh why was it removed? Can you at least recommend a macro / VBA script patch to reurn this functionality to the program ? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" b...

repost help windows error
I have uninstalled reinstalled three times - different directories - complete shutdown and restarts to no avail --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Program Files\Microsoft Money\System\msmoney.exe abnormal program termination --------------------------- OK --------------------------- You can keep posting at 12 hour intervals and it will not make anybody more likely to know an answer to your issue. Note also that neither of your posts ever pose a question. This is not a common issue with a simple ans...

Referencing other Office programs in a Excel VBA App
I din't like the way my previous post sounded, so i'm reposting... All, My Excel VBA programming is decent enough when I'm only working with Excel. However, I'm trying to expand my knowledge base and frequently I wish I could better interact with other Office programs, such as Outlook, in my Excel VBA apps. To better illustrate my question, here's a piece of code that works great (it populates a user form list with Outlook addresses) but I don't fully understand. Private Sub UserForm_Activate() Dim x As Integer Set objOL = CreateObject("...

html page in excel-Open new window
Hi everyone I'm trying to build an html page in excel and it's quite easy. I have several links to reports on that page but is it possibel to "say somewhere" that when i open those links it must be in a new window? Tks in advance Hi Pedro, Hold the Shift key down while clicking on the link. Don't know of any other way from Excel itself. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Pedro" <pcc...

modal popup window
I'm sure this has been asked a million times. I remember it being tricky and somewhat complicated when it comes to modal dialog boxes. I guess what I'm trying to do is create a tooltip kind of window. It shows up, is topmost, and automatically hides when it's done. I am not using MFC and don't want to subclass from any existing control. I registered my own windows class with its own WndProc. The class is CTip. It's created like this by the parent: if (bError) { CTip* p = new CTip; p->m_bAutoDelete = TRUE; p->Create(m_hWnd, _T("An error occurred...

how to stop popup windows while my appn is running..
HI How to stop popup windows (e.g. messenger popups, x-popups,warning system messages) while running my MFC application ..?? i cud stop screensavers launch by using SystemParametersInfo() API. any help wud be thanked in advance. Neel maybe you can use a WM_SHELL hook, then you can know is a window is created (HSHELL_WINDOWCREATED), and stop his creation ... but this is not MFC programming see SetWindowsHookEx ...

How to set program to view hyperlink?
When I make a hyperlink in Excel 2000, I cannot change which program opens it. Where is the set file associations setting? I am hyperlinking to jpgs. It opens my paint program (PSP) instead of my clipart viewer (ACDSee). I have disassociated PSP with jpg - jpeg. Associated ACDSee with jpg -jpeg. Set Windows Explorer\Tools\Folder Options\File Types to open jpg - jpeg extensions with ACDSee. This was working, now all a sudden it has changed. Any ideas? Thanks, Carol Hi any chance your Windows settings have been changed?. >-----Original Message----- >When I make a hyperlink in Excel 2...

re: printer driver install on Windows 7 x64
I managed to get self-extracting exe to invoke the "Add Printer" wizard by starting a 64-bit executable that calls rundll32 and passes the "printui.dll,PrintUIEntry" command line. Unfortunately, after the driver is installed, the Windows "Program Compatibility Assistant" pops up a dialog box that says "The program might not have installed correctly". I did some research on MSDN regarding the PCA (Program compatibility assistant) and I quote: "The best option to exclude a program from PCA is to include, with the program, an applicatio...

Unable to get TextBoxes property of Worksheet Class Error
I have posted elsewhere to try and get resolution on my issue and decided to ask for help here as well. I have an issue that is driving me crazy. I have a workbook that has multiple sheets and some of these sheets have Textboxes (from the drawing tool) on the sheet with standard naming (i.e. TextBox 1, TextBox 2, etc.) I have a button that executes code that takes and builds an external file with the data from the worksheets, including the TextBoxes. During that process I am checking to see if those worksheets with TextBoxes have anything entered before attempting to grab the...

Windows 7
I installed Money Deluxe 2008 on my Windows 7 RC1 machine. When I launch it, I see the splash screen for a second, then it's gone and it won't start. Any thoughts? Works great with Windows 7 for me. Did you reboot? If that doesn't work, reinstall Money. "Scott Friedman" <scott.friedman@bluecoat.com> wrote in message news:C652905A.B180%scott.friedman@bluecoat.com... > I installed Money Deluxe 2008 on my Windows 7 RC1 machine. > When I launch it, I see the splash screen for a second, then it's gone and > it won't start. > > Any thoughts?...

Opening an alternate PDK window (Dexterity)
Dear all, I have created an alternate window to the PDK Switch Company form to display the names of virtual companies based on user id logging in ( I have only added 1 string field to the original window to do this). I have created 2 scripts to retrieve the company name from a table and populate the string. l_result = Trigger_RegisterFocus(anonymous(form Login), TRIGGER_FOCUS_POST, TRIGGER_AFTER_ORIGINAL, script Login_check); if l_result <> SY_NOERR then warning "Procedure trigger registration failed."; end if; l_result = Trigger_RegisterFocus(anonymous(form 'Switch ...

Default Data/Log Folder for a SQL Instance?
I know that the default data and log folders for an instance are stored in the registry. I know how to obtain a list of all available SQL Instances on the network using the SqlDataSourceEnumerator static class. But is there a .NET way of getting the default data/log folders for any of the returned instances without accessing the registry of the server the instance resides on? "Joe Cool" <joecool1969@live.com> wrote in message news:da54313f-4aba-4fd7-9390-9b30e58b8422@c36g2000yqm.googlegroups.com... >I know that the default data and log folders for an instance ...

Windows Services #4
Hi all, I have a small program which I need to start as the user logged into machine. I have kept that prog. in start up. My friend suggested me to make it windows service so that it can start as soon as machine is booted. can anybody help me to find beginners material on windows services- how to write and how to use? Please! I need to write that service in vc++ 6.0 not in .Net. Bye On Wed, 9 Nov 2005 10:45:41 UTC, "Suriya" <aktersuriya@gmail.com> wrote: > Hi all, > I have a small program which I need to start as the user logged into > machine. I have kept that p...

Problem with a drop down window for a ccomboboxex
Hello Everyone, I'm facing a problem with a CComboBoxEx.... I've implemented a deskband & i want to include a feature like the auto-suggest feature as in the google toolbar. My problem is that when some strings are populated in the drop down & I do a show drop down, my edit control in loses focus. I'm adding strings in my function (which is called in response to a CBN_EDITCHANGE message). After populating the strings, I call CMyCombobox->ShowDropDown (TRUE); But then, my edit box loses focus. If I do an immediate SetFocus (), my drop down window disappears. Any Idea ...

windows mail
How do I get into windows mail as opposed to windows live mail? -- Randy Are you using Windows Vista? -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "Shagnasty McNutt" <mrberger2@comcast.net(nospam)> wrote in message news:5C1E6ECC-DD4B-4C3A-9D16-18F309AB1CA4@microsoft.com... > How do I get into windows mail as opposed to windows live mail? > -- > Randy I'm running Windows 7. -- Randy "Bruce Hagen" wrote: > Are you using Windows Vista? > -- > Bruce Hagen > ...

Can't modify table style
I'm flabbergasted after spending over 30 minutes trying to trouble shoot a table of contents, so I deleted it and tried to create a new table of contents formatted like the one I had before (font properties wise). So I select the table of contents tab on the ribbon (Word 2007), then I select "Insert a tabel of contents..." under the automatic and manual table images above and I want to "modify" the "formal" format, since it's pretty close to what I want except for the font color, type and size. I also want to change the "options&quo...

Sales Documents
Hi All. We have a "situation" .. lol. Seems the wrong departments are printing picking tickets, which causes problems in packing/shipping when new p/t have "reprint" stamped on them. These wrong departments still have to print sales orders, so I cannot lock them out of the window(s) entirely. Does anyone have any creative suggestions for limiting their access within these windows? We do not own Field Level Security (which I believe would accomplish this). Thx for suggestions. M. Maria, Well, I am so tempted to say something like "you have to train them better&qu...

Comment window size
It is possible to change the default size of the comment window? You cannot change the size of the default comment but you can use a macro to create a comment and change its size: Sub NewComment() On Error Resume Next With ActiveCell.AddComment.Shape .Width = 100 .Height = 60 .Visible = msoTrue .Select End With End Sub -- Jim Rech Excel MVP "Eddie" <anonymous@discussions.microsoft.com> wrote in message news:13e701c53091$8d6eb0c0$a601280a@phx.gbl... | It is possible to change the default size of the comment | window? ...

Serializing "Type" class
Hi All, Was anybody able to serialize the "Type" class properly using XmlSerializer().... Want to serialize and deserialze the Type in a string form, but can this be done ? myobj.Type = typeof(System.String) as <type>System.String</type> thanks a ton. Maersa wrote: > Was anybody able to serialize the "Type" class properly using > XmlSerializer().... AFAIK that's impossible due to security reasons. -- Oleg Tkachenko XML Insider http://www.tkachenko.com/blog If all you want is the type name, can you use a buddy member that depends on the actua...

How to re-insert Windows Mail in the top of the Start Menu list?
Thinking AOL web-mail would be used as the E-mail client on this system, to avoid confusion, Windows Mail was removed from the Start Menu list. The program remains on the system, and it has been possible to place an icon on the desktop to access it, but it would be good if it could be restored to its rightful place at the top (under the Internet Explorer link) of the Start menu (what you get when clicking on the encircled Microsoft symbol in the lower left corner of the screen). How should that be done? AOL web-mail has lost out to Windows Mail as the preferred e-mail client, ...

New Computer Window 7
Where is the send and receive option? It's it not available on window live. I really miss that option. "joyce" <joyce@discussions.microsoft.com> wrote in message news:F80EEC6C-F30C-4EA8-B2E4-534CEDF23606@microsoft.com... > Where is the send and receive option? It's it not available on window > live. > I really miss that option. It's called "Synchronize" AFAIK. The easiest option is to press F5. When looking at Mail - F5 will send/receive all mail (synchronize). When in Newsgroups - F5 will sync all newsgroups. Colin Bro...

Hyperlinks, Pop-up Windows & Graphics
I have a question! I've seen websites in the past where you can make sections of a picture where they had both a mouseover pop-up window (to tell you what the section will link you to) AND a hyperlink. SO far I've figured out to turn a section of a picture (the same picture) into either a hyperlink OR a pop-up window but not both. I need the pop-up to come up and then allow an option to go to the link or not but so far, after about 10 hours of trial and error, I haven't figured it out yet. Anyone have any suggestions on how to do this? "ladyimmortal&quo...

Window Live Mail
I signed in with my user ID and password and now I can't find how to sign out . Help ! Help ! I lost all my contacts when I signed in to Windows Live Mail and the only way I can get everything back is to sign out. Thanks, Linda Tools (ALT+T), Options, Connections, Stop Signing In -- Mike - http://TechHelp.Santovec.us "Linda H" <Linda H@discussions.microsoft.com> wrote in message news:4D8B3431-F009-4685-9C23-F63F7D670A0B@microsoft.com... > I signed in with my user ID and password and now I can't find how to > sign out . > > He...