Click here to Skip to main content
15,896,606 members
Articles / Desktop Programming / MFC

The Practical Guide to Multithreading - Part 2

Rate me:
Please Sign up or sign in to vote.
4.96/5 (119 votes)
12 Apr 2010CPOL43 min read 150.7K   5K   316  
More of practical situations to use multithreading!
#pragma once
#include "afxwin.h"
#include "afxcmn.h"

#include "common.h"


class CRelationalSearchPage : public CPropertyPage
{
	DECLARE_DYNAMIC(CRelationalSearchPage)

public:

	int m_nThreadCount, m_nThreadFinishedCount;

	// MUST be MANUAL - since all running threads need to know
	// of cancellation request. If we make it as auto-reset event
	// it would only cause first search-thread to receive the event, and
	// only one thread would terminate itself.
	// See CRelationalSearchPage constructor, where it is being set as Manual.
	CEvent m_cCancelEvent;

	CRelationalSearchPage();
	virtual ~CRelationalSearchPage();

	void EnableControls(bool bEnable);

	int OnInitDialog();

// Dialog Data
	enum { IDD = IDD_RELATIONAL_SEARCH };

//	std::vector<ItemData> ItemDataVector;

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	CComboBox m_cRelationalOperatorCombo;
	afx_msg void OnBnClickedOk();
	LRESULT OnSearchReplyMessage(WPARAM, LPARAM);
	CListCtrl m_cSearchResult;
	CStatic m_cStatus;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
India India
Started programming with GwBasic back in 1996 (Those lovely days!). Found the hidden talent!

Touched COBOL and Quick Basic for a while.

Finally learned C and C++ entirely on my own, and fell in love with C++, still in love! Began with Turbo C 2.0/3.0, then to VC6 for 4 years! Finally on VC2008/2010.

I enjoy programming, mostly the system programming, but the UI is always on top of MFC! Quite experienced on other environments and platforms, but I prefer Visual C++. Zeal to learn, and to share!

Comments and Discussions