We help IT Professionals succeed at work.

Spinner class  ... multitasking ...

meow00
meow00 asked
on
474 Views
Last Modified: 2010-04-01
Hi Experts,

    This is actually a following up question of
 https://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20886870.html
 https://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20887204.html

    I have got suggestions from experts, but I am still unable to make the code work after a lot of struggling !!! (even though it is successfully compiled). If it runs successfully, we should see a wheel spinning ......

    Anyway, I post all the header and source files of this project : "Tasking" as follows. I would appreciate if anyone can take a look, let me know how to fix it and make it work !!!

    Thanks very very much !!!
--------------------------------------
 Project : Tasking
  Source files : Tasking.cpp   Tasking.rc    TaskingDoc.cpp   TaskingView.cpp  Spinner.cpp MainFrm.cpp StdAfx.cpp

 Header files : Tasking.h Resource.h TaskingDoc.h TaskingView.h Spinner.h MainFrm.h StdAfx.h
--------------------------------------
 // Tasking.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "Tasking.h"

#include "MainFrm.h"
#include "TaskingDoc.h"
#include "TaskingView.h"
#include "Spinner.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTaskingApp

BEGIN_MESSAGE_MAP(CTaskingApp, CWinApp)
      //{{AFX_MSG_MAP(CTaskingApp)
      ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
            // NOTE - the ClassWizard will add and remove mapping macros here.
            //    DO NOT EDIT what you see in these blocks of generated code!
      //}}AFX_MSG_MAP
      // Standard file based document commands
      ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
      ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTaskingApp construction

CTaskingApp::CTaskingApp()
{
      // TODO: add construction code here,
      // Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CTaskingApp object

CTaskingApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CTaskingApp initialization

BOOL CTaskingApp::InitInstance()
{
      // Standard initialization
      // If you are not using these features and wish to reduce the size
      //  of your final executable, you should remove from the following
      //  the specific initialization routines you do not need.

#ifdef _AFXDLL
      Enable3dControls();                  // Call this when using MFC in a shared DLL
#else
      Enable3dControlsStatic();      // Call this when linking to MFC statically
#endif

      // Change the registry key under which our settings are stored.
      // TODO: You should modify this string to be something appropriate
      // such as the name of your company or organization.
      SetRegistryKey(_T("Local AppWizard-Generated Applications"));

      LoadStdProfileSettings();  // Load standard INI file options (including MRU)

      // Register the application's document templates.  Document templates
      //  serve as the connection between documents, frame windows and views.

      CSingleDocTemplate* pDocTemplate;
      pDocTemplate = new CSingleDocTemplate(
            IDR_MAINFRAME,
            RUNTIME_CLASS(CTaskingDoc),
            RUNTIME_CLASS(CMainFrame),       // main SDI frame window
            RUNTIME_CLASS(CTaskingView));
      AddDocTemplate(pDocTemplate);

      // Parse command line for standard shell commands, DDE, file open
      CCommandLineInfo cmdInfo;
      ParseCommandLine(cmdInfo);

      // Dispatch commands specified on the command line
      if (!ProcessShellCommand(cmdInfo))
            return FALSE;

      // The one and only window has been initialized, so show and update it.
      m_pMainWnd->ShowWindow(SW_SHOW);
      m_pMainWnd->UpdateWindow();

      return TRUE;
}


/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
      CAboutDlg();

// Dialog Data
      //{{AFX_DATA(CAboutDlg)
      enum { IDD = IDD_ABOUTBOX };
      //}}AFX_DATA

      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CAboutDlg)
      protected:
      virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
      //}}AFX_VIRTUAL

// Implementation
protected:
      //{{AFX_MSG(CAboutDlg)
            // No message handlers
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
      //{{AFX_DATA_INIT(CAboutDlg)
      //}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
      CDialog::DoDataExchange(pDX);
      //{{AFX_DATA_MAP(CAboutDlg)
      //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
      //{{AFX_MSG_MAP(CAboutDlg)
            // No message handlers
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

// App command to run the dialog
void CTaskingApp::OnAppAbout()
{
      CAboutDlg aboutDlg;
      aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CTaskingApp message handlers


BOOL CTaskingApp::OnIdle(LONG lCount)
{
      // TODO: Add your specialized code here and/or call the base class
      POSITION pos = GetFirstDocTemplatePosition() ;
      if(pos)
      {
            CDocTemplate* pDocTemp = GetNextDocTemplate(pos) ;
            if(pDocTemp)
            {
                  POSITION dPos = pDocTemp -> GetFirstDocPosition() ;
                  if(dPos)
                  {
                        CTaskingDoc* pDocWnd =
                        (CTaskingDoc*)pDocTemp -> GetNextDoc(dPos) ;

                        if(pDocWnd)
                        {
                              POSITION vPos = pDocWnd -> GetFirstViewPosition() ;

                              if(vPos)
                              {
                                    CTaskingView* pView =
                                          (CTaskingView*)pDocWnd -> GetNextView(vPos) ;

                                    if(pView)
                                    {
                                          if(pView-> m_bOnIdle1)
                                                pDocWnd -> DoSpin(0) ;
                                          if(pView-> m_bOnIdle2)
                                                pDocWnd -> DoSpin(2) ;
                                    }
                              }
                        }
                  }
                  
            }
      }

      return CWinApp::OnIdle(lCount);
}
------------------------------------------------------
// TaskingDoc.cpp : implementation of the CTaskingDoc class
//

#include "stdafx.h"
#include "Tasking.h"

#include "Spinner.h"
#include "TaskingDoc.h"
#include "TaskingView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTaskingDoc

IMPLEMENT_DYNCREATE(CTaskingDoc, CDocument)

BEGIN_MESSAGE_MAP(CTaskingDoc, CDocument)
      //{{AFX_MSG_MAP(CTaskingDoc)
            // NOTE - the ClassWizard will add and remove mapping macros here.
            //    DO NOT EDIT what you see in these blocks of generated code!
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTaskingDoc construction/destruction

CTaskingDoc::CTaskingDoc()
{
      // TODO: add one-time construction code here
   
}

CTaskingDoc::~CTaskingDoc()
{
}

BOOL CTaskingDoc::OnNewDocument()
{
      if (!CDocument::OnNewDocument())
            return FALSE;

      // TODO: add reinitialization code here
      // (SDI documents will reuse this document)
    InitSpinners() ;
      return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CTaskingDoc serialization

void CTaskingDoc::Serialize(CArchive& ar)
{
      if (ar.IsStoring())
      {
            // TODO: add storing code here
      }
      else
      {
            // TODO: add loading code here
      }
}

/////////////////////////////////////////////////////////////////////////////
// CTaskingDoc diagnostics

#ifdef _DEBUG
void CTaskingDoc::AssertValid() const
{
      CDocument::AssertValid();
}

void CTaskingDoc::Dump(CDumpContext& dc) const
{
      CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTaskingDoc commands

void CTaskingDoc::CalcPoint(int nID, CSpinner *pSpin)
{
    RECT lWndRect ;
      CPoint pPos ;
      int iLength ;
      CTaskingView *pWnd ;

      pWnd = (CTaskingView*)pSpin -> GetViewWnd() ;
      pWnd -> GetClientRect(&lWndRect) ;

      iLength = lWndRect.right/6 ;
      
      switch(nID)
      {
      case 0:
            pPos.x = (lWndRect.right/4)-iLength ;
            pPos.y = (lWndRect.bottom/4) - iLength ;
            break ;

      case 1:
            pPos.x = ((lWndRect.right/4)*3) - iLength ;
            pPos.y = (lWndRect.bottom/4) - iLength ;
        break ;

      case 2:
            pPos.x = (lWndRect.right/4) - iLength ;
            pPos.y = ((lWndRect.bottom/4)*3) -(long)(iLength*1.25) ;
            break ;

      case 3:
            pPos.x = ((lWndRect.right/4)*3) - iLength ;
            pPos.y = ((lWndRect.bottom/4)*3) - (long)(iLength*1.25) ;
            break ;
      }

      pSpin -> SetLength(iLength) ;
      pSpin -> SetPoint(pPos) ;

}

void CTaskingDoc::InitSpinners()
{
   int i;
   POSITION pos = GetFirstViewPosition() ;

   if(pos!= NULL)
   {
         CView* pView = GetNextView(pos) ;

         for(i=0; i<4; i++)
         {
               m_cSpin[i].SetViewWnd(pView) ;
               m_cSpin[i].SetContinue(NULL) ;

               switch(i)
               {
               case 1:
              m_cSpin[i].SetContinue(&((CTaskingView*)pView) -> m_bThread1) ;
                    break ;

               case 3:
                    m_cSpin[i].SetContinue(&((CTaskingView*)pView) -> m_bThread2) ;
                    break ;
               }

               CalcPoint(i, &m_cSpin[i]) ;
         }
   }
}


void CTaskingDoc::DoSpin(int Index)
{
      m_cSpin[nIndex].Draw() ;

}
----------------------------------------------------
// TaskingView.cpp : implementation of the CTaskingView class
//

#include "stdafx.h"
#include "Tasking.h"

#include "Spinner.h"
#include "TaskingDoc.h"
#include "TaskingView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTaskingView

IMPLEMENT_DYNCREATE(CTaskingView, CFormView)

BEGIN_MESSAGE_MAP(CTaskingView, CFormView)
      //{{AFX_MSG_MAP(CTaskingView)
      ON_BN_CLICKED(IDC_CBONIDLE1, OnCbonidle1)
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTaskingView construction/destruction

CTaskingView::CTaskingView()
      : CFormView(CTaskingView::IDD)
{
      //{{AFX_DATA_INIT(CTaskingView)
      m_bOnIdle1 = FALSE;
      m_bOnIdle2 = FALSE;
      m_bThread1 = FALSE;
      m_bThread2 = FALSE;
      //}}AFX_DATA_INIT
      // TODO: add construction code here

}

CTaskingView::~CTaskingView()
{
}

void CTaskingView::DoDataExchange(CDataExchange* pDX)
{
      CFormView::DoDataExchange(pDX);
      //{{AFX_DATA_MAP(CTaskingView)
      DDX_Check(pDX, IDC_CBONIDLE1, m_bOnIdle1);
      DDX_Check(pDX, IDC_CBONIDLE2, m_bOnIdle2);
      DDX_Check(pDX, IDC_CBTHREAD1, m_bThread1);
      DDX_Check(pDX, IDC_CBTHREAD2, m_bThread2);
      //}}AFX_DATA_MAP
}

BOOL CTaskingView::PreCreateWindow(CREATESTRUCT& cs)
{
      // TODO: Modify the Window class or styles here by modifying
      //  the CREATESTRUCT cs

      return CFormView::PreCreateWindow(cs);
}

void CTaskingView::OnInitialUpdate()
{
      CFormView::OnInitialUpdate();
      GetParentFrame()->RecalcLayout();
      ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CTaskingView diagnostics

#ifdef _DEBUG
void CTaskingView::AssertValid() const
{
      CFormView::AssertValid();
}

void CTaskingView::Dump(CDumpContext& dc) const
{
      CFormView::Dump(dc);
}

CTaskingDoc* CTaskingView::GetDocument() // non-debug version is inline
{
      ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTaskingDoc)));
      return (CTaskingDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTaskingView message handlers

void CTaskingView::OnCbonidle1()
{
      // TODO: Add your control notification handler code here
      UpdateData(TRUE) ;
}
--------------------------------------------------
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "Tasking.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
      //{{AFX_MSG_MAP(CMainFrame)
            // NOTE - the ClassWizard will add and remove mapping macros here.
            //    DO NOT EDIT what you see in these blocks of generated code !
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
      // TODO: add member initialization code here
      
}

CMainFrame::~CMainFrame()
{
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
      if( !CFrameWnd::PreCreateWindow(cs) )
            return FALSE;
      // TODO: Modify the Window class or styles here by modifying
      //  the CREATESTRUCT cs

      return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
      CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
      CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

-----------------------------------------------------------------
// Spinner.cpp: implementation of the CSpinner class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include <math.h>
#include "Tasking.h"
#include "Spinner.h"

#include "TaskingView.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

COLORREF CSpinner::m_crColors[8] ={
      RGB(0,0,0),
      RGB(0,0,255),
      RGB(0,255,0),
      RGB(0,255,255),
      RGB(255,0,0),
      RGB(255,0,255),
      RGB(255,255,0),
      RGB(255,255,255)
} ;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSpinner::CSpinner()
{
      m_iRadius = 0 ;
      m_nMinute = 0 ;
      m_crColor = 0 ;
      m_pViewWnd = NULL ;
      m_bContinue = NULL ;

}

CSpinner::~CSpinner()
{

}

void CSpinner::Draw()
{  
 
//      CTaskingView* pView = NULL ;
//  this->SetViewWnd(pView) ;
//      m_pViewWnd -> SetViewWnd() ;
    CDC *pDC = m_pViewWnd->GetDC() ;
      pDC-> SetMapMode(MM_LOENGLISH) ;
      CPoint org = m_pCenter ;
      CPoint pStartPoint ;

      pStartPoint.x = (m_iRadius /2) ;
      pStartPoint.y = (m_iRadius /2 ) ;

      org.x = m_pCenter.x + (m_iRadius/2) ;
      org.y = m_pCenter.y + m_iRadius ;
      pDC-> SetViewportOrg(org.x, org.y) ;

      CPoint pEndPoint ;
      double nRadians = (double) (m_nMinute*6) * 0.174532932 ;

      pEndPoint.x = (int)(m_iRadius * sin(nRadians)) ;
      pEndPoint.y = (int)(m_iRadius * cos(nRadians)) ;

      CPen pen(PS_SOLID, 0, m_crColors[m_crColor]) ;
      CPen* pOldPen = pDC -> SelectObject(&pen) ;

      pDC->MoveTo(pEndPoint) ;
      pDC->LineTo(pStartPoint) ;
    pDC->SelectObject(&pOldPen) ;

      m_pViewWnd->ReleaseDC(pDC) ;

      if(++m_nMinute == 60)
      {
            m_nMinute = 0 ;
            if(++m_crColor == 8)  m_crColor = 0 ;
    }
}
----------------------------------
// stdafx.cpp : source file that includes just the standard includes
//      Tasking.pch will be the pre-compiled header
//      stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
------------------------------------------------------
-------------------------------------------------------
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__AEB7B57B_AFED_4072_8249_C4D998A44188__INCLUDED_)
#define AFX_MAINFRM_H__AEB7B57B_AFED_4072_8249_C4D998A44188__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CMainFrame : public CFrameWnd
{
      
protected: // create from serialization only
      CMainFrame();
      DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CMainFrame)
      virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
      //}}AFX_VIRTUAL

// Implementation
public:
      virtual ~CMainFrame();
#ifdef _DEBUG
      virtual void AssertValid() const;
      virtual void Dump(CDumpContext& dc) const;
#endif

// Generated message map functions
protected:
      //{{AFX_MSG(CMainFrame)
            // NOTE - the ClassWizard will add and remove member functions here.
            //    DO NOT EDIT what you see in these blocks of generated code!
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINFRM_H__AEB7B57B_AFED_4072_8249_C4D998A44188__INCLUDED_)
------------------------------
// Resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Tasking.rc
//
#define IDD_ABOUTBOX                    100
#define IDD_TASKING_FORM                101
#define IDR_MAINFRAME                   128
#define IDR_TASKINTYPE                  129
#define IDC_CBONIDLE1                   1000
#define IDC_CBTHREAD1                   1001
#define IDC_CBONIDLE2                   1002
#define IDC_CBTHREAD2                   1003

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS                     1
#define _APS_NEXT_RESOURCE_VALUE        130
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1004
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
----------------------------
// Spinner.h: interface for the CSpinner class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SPINNER_H__BE690C80_FBEB_4D2B_8FA0_3652C4AF0B86__INCLUDED_)
#define AFX_SPINNER_H__BE690C80_FBEB_4D2B_8FA0_3652C4AF0B86__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CSpinner : public CObject  
{
public:
      void Draw();
    BOOL* GetContinue(){ return m_bContinue ;}
    void SetContinue(BOOL* bContinue){ m_bContinue = bContinue ;}
      CWnd* GetViewWnd() { return m_pViewWnd ;}
    void SetViewWnd(CWnd* pWnd){ m_pViewWnd = pWnd ;}
      void SetLength(int iLength) {m_iRadius = iLength ;}
      void SetPoint(CPoint pPoint){m_pCenter = pPoint ;}

      CSpinner();
      virtual ~CSpinner();

private:
      BOOL* m_bContinue;
public:
      CWnd* m_pViewWnd;
private:
      static COLORREF m_crColors[8];
      CPoint m_pCenter;
      int m_iRadius;
      int m_nMinute;
      int m_crColor;
};

#endif // !defined(AFX_SPINNER_H__BE690C80_FBEB_4D2B_8FA0_3652C4AF0B86__INCLUDED_)
----------------------------
// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__D418A5AC_2FC7_46F4_9329_AA7DB3DAF6E6__INCLUDED_)
#define AFX_STDAFX_H__D418A5AC_2FC7_46F4_9329_AA7DB3DAF6E6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers

#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdtctl.h>            // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>                  // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__D418A5AC_2FC7_46F4_9329_AA7DB3DAF6E6__INCLUDED_)
---------------------------------
// Tasking.h : main header file for the TASKING application
//

#if !defined(AFX_TASKING_H__E2949A92_3A5A_4AFE_A8F6_A337CB773091__INCLUDED_)
#define AFX_TASKING_H__E2949A92_3A5A_4AFE_A8F6_A337CB773091__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
      #error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CTaskingApp:
// See Tasking.cpp for the implementation of this class
//

class CTaskingApp : public CWinApp
{
public:
      CTaskingApp();

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CTaskingApp)
      public:
      virtual BOOL InitInstance();
      virtual BOOL OnIdle(LONG lCount);
      //}}AFX_VIRTUAL

// Implementation
      //{{AFX_MSG(CTaskingApp)
      afx_msg void OnAppAbout();
            // NOTE - the ClassWizard will add and remove member functions here.
            //    DO NOT EDIT what you see in these blocks of generated code !
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TASKING_H__E2949A92_3A5A_4AFE_A8F6_A337CB773091__INCLUDED_)

-----------------
// TaskingDoc.h : interface of the CTaskingDoc class
//
/////////////////////////////////////////////////////////////////////////////

#include "Spinner.h"

#if !defined(AFX_TASKINGDOC_H__AE6B262B_212D_4A77_8B09_B05BD6B73007__INCLUDED_)
#define AFX_TASKINGDOC_H__AE6B262B_212D_4A77_8B09_B05BD6B73007__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CTaskingDoc : public CDocument
{
protected: // create from serialization only
      CTaskingDoc();
      DECLARE_DYNCREATE(CTaskingDoc)

// Attributes
public:

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CTaskingDoc)
      public:
      virtual BOOL OnNewDocument();
      virtual void Serialize(CArchive& ar);
      //}}AFX_VIRTUAL

// Implementation
public:
      void DoSpin(int Index);
      virtual ~CTaskingDoc();
#ifdef _DEBUG
      virtual void AssertValid() const;
      virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
      //{{AFX_MSG(CTaskingDoc)
            // NOTE - the ClassWizard will add and remove member functions here.
            //    DO NOT EDIT what you see in these blocks of generated code !
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
private:
      int nIndex;
      CSpinner m_cSpin[4];
      void InitSpinners();
      void CalcPoint(int nID, CSpinner *pSpin);
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TASKINGDOC_H__AE6B262B_212D_4A77_8B09_B05BD6B73007__INCLUDED_)
---------------------
// TaskingView.h : interface of the CTaskingView class
//
/////////////////////////////////////////////////////////////////////////////

#include "TaskingDoc.h"

#if !defined(AFX_TASKINGVIEW_H__A3EB23A0_DD4D_494D_92BB_27B1F7685AEE__INCLUDED_)
#define AFX_TASKINGVIEW_H__A3EB23A0_DD4D_494D_92BB_27B1F7685AEE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CTaskingView : public CFormView
{
protected: // create from serialization only
      CTaskingView();
      DECLARE_DYNCREATE(CTaskingView)

public:
      //{{AFX_DATA(CTaskingView)
      enum { IDD = IDD_TASKING_FORM };
      BOOL      m_bOnIdle1;
      BOOL      m_bOnIdle2;
      BOOL      m_bThread1;
      BOOL      m_bThread2;
      //}}AFX_DATA

// Attributes
public:
      CTaskingDoc* GetDocument();

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CTaskingView)
      public:
      virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
      protected:
      virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
      virtual void OnInitialUpdate(); // called first time after construct
      //}}AFX_VIRTUAL

// Implementation
public:
      virtual ~CTaskingView();
#ifdef _DEBUG
      virtual void AssertValid() const;
      virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
      //{{AFX_MSG(CTaskingView)
      afx_msg void OnCbonidle1();
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in TaskingView.cpp
inline CTaskingDoc* CTaskingView::GetDocument()
   { return (CTaskingDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TASKINGVIEW_H__A3EB23A0_DD4D_494D_92BB_27B1F7685AEE__INCLUDED_)
Comment
Watch Question

Commented:
meow00

It would be so much easier if you posted a link to the VC++ project that you would upload, then people could download it and play with it straight away.

If you could do that please then it will help everyone a lot !

Cheers.
Hi meow00,
If you don't mind please send me the zipped source code to lakshmanan_ce@yahoo.co.in
Regards,
Lakshman

Commented:
>> If you don't mind please send me the zipped source code to lakshmanan_ce@yahoo.co.in

That is against EE policy.
Hi mrwad99,
I am sorry for my earlier comment.
I am not aware that it is against EE policy.
Thanks,
Lakshman

Commented:
No problem.  It is just that it is fairer no everyone if the questioner posts a link to his code then anyone can downloasd it you see :)

Author

Commented:

 Hi Experts,

    The zip file of the whole project is now at :

 http://www.geocities.com/hello_meow00/

    Any help is highly appreciated !!!

 meow .......

Commented:
Heh, nice one.  You might actually want to strip all of the stuff out of the debug folder and just put the source files there; people on slower connections will appreciate it more :)
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks drelectro !!! It really helps !
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.