亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? clidlg.cpp

?? Windows多線程編碼隨書源碼
?? CPP
字號:
/*
 * CliDlg.cpp : implementation file
 *
 * Sample code for "Multithreading Applications in Win32"
 * This is from Chapter 17
 *
 * Communicates to a FreeThreaded COM Object
 */

#include "stdafx.h"
#include "MfcCli.h"
#include "CliDlg.h"

//
// Include the interface definition from the ComDemo.DLL
//
#define IID_DEFINED
#include "..\ComDemo_i.c"

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

/////////////////////////////////////////////////////////////////////////////
// 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)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMfcCliDlg dialog

// Registered Window Messages for notifying when threads are done.
UINT g_msgSlowThreadDone = RegisterWindowMessage("SlowThreadDone");
UINT g_msgFastThreadDone = RegisterWindowMessage("FastThreadDone");

CMfcCliDlg::CMfcCliDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMfcCliDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMfcCliDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	m_pAutoIncr = NULL;
	m_iSlowThreadCount = 0;
	m_iFastThreadCount = 0;
}

void CMfcCliDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMfcCliDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMfcCliDlg, CDialog)
	//{{AFX_MSG_MAP(CMfcCliDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BK_FAST, OnBkFast)
	ON_BN_CLICKED(IDC_BK_SLOW, OnBkSlow)
	ON_BN_CLICKED(IDC_UI_FAST, OnUiFast)
	ON_BN_CLICKED(IDC_UI_SLOW, OnUiSlow)
	ON_BN_CLICKED(IDC_ABOUT, OnAbout)
	ON_WM_CLOSE()
	ON_REGISTERED_MESSAGE(g_msgSlowThreadDone, OnSlowThreadDone)
	ON_REGISTERED_MESSAGE(g_msgFastThreadDone, OnFastThreadDone)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMfcCliDlg message handlers

BOOL CMfcCliDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	CString strAboutMenu;
	strAboutMenu.LoadString(IDS_ABOUTBOX);
	if (!strAboutMenu.IsEmpty())
	{
		pSysMenu->AppendMenu(MF_SEPARATOR);
		pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	//
	// Create the CLSID_CAutoIncr COM object
	//
	m_pAutoIncr = CreateAutoIncr();
	if (!m_pAutoIncr)
	{
		TRACE(_T("Failed to create m_pAutoIncr!\n"));
	}
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CMfcCliDlg::OnClose() 
{	//
	// Release the COM object created in OnInitDialog()
	//
	if (m_pAutoIncr)
		m_pAutoIncr->Release();
	
	CDialog::OnClose();
}

void CMfcCliDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CMfcCliDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMfcCliDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

//
// Bring up the About Dialog Box when the button is pressed.
//
void CMfcCliDlg::OnAbout() 
{
	CAboutDlg dlg;
	dlg.DoModal();
}


//
// This function will create a CLSID_CAutoIncr COM object and return 
// an IAutoIncr interface to the object
// 
IAutoIncr* CMfcCliDlg::CreateAutoIncr() 
{
	// Create the object and get a IUnknown* to the object
	TRACE(_T("\nSTARTING\n=============================\n"));
	TRACE(_T("Calling CoCreateInstance()...\n"));
	IUnknown* pUnk = NULL;
	HRESULT hRes = CoCreateInstance(CLSID_CAutoIncr, NULL, CLSCTX_ALL,
		IID_IUnknown, (void**)&pUnk);
	if (FAILED(hRes))
	{
		TRACE(_T("Failed to create CLSID_CAutoIncr\n"));
		return NULL;
	}
	TRACE(_T("Object created\n"));

	// Use QueryInterface() to get the IAutoIncr interface
	IAutoIncr* pCom = NULL;
	hRes = pUnk->QueryInterface(IID_IAutoIncr, (LPVOID*)&pCom);
	pUnk->Release();
	if (FAILED(hRes))
	{
		TRACE(_T("QueryInterface() for IID_IAutoIncr failed\n"));
		return NULL;
	}

	return pCom;
}

void CMfcCliDlg::OnUiFast() 
{	// Get the FastCounter property in the UI thread
	// Shows an hourglass since no other user input is allowed until we finish

	CWaitCursor wait;	// Show an hourglass

	if (m_pAutoIncr)
	{
		WORD value;
		m_pAutoIncr->get_FastCounter(&value);
		SetDlgItemInt(IDC_EDIT_FAST_COUNTER, value);
	}	// end if
}

void CMfcCliDlg::OnUiSlow() 
{	// Get the SlowCounter property in the UI thread
	// Shows an hourglass since no other user input is allowed until we finish

	CWaitCursor wait;	// Show an hourglass

	if (m_pAutoIncr)
	{
		WORD value;
		m_pAutoIncr->get_SlowCounter(&value);
		SetDlgItemInt(IDC_EDIT_SLOW_COUNTER, value);
	}	// end if
}

UINT CMfcCliDlg::FastCounterThreadFunc( LPVOID pParam )
{	// Thread Functions for background thread that will get FastCounter
	CThreadInfo* pInfo = (CThreadInfo*) pParam;

	// Initializes the thread for multi-threaded object concurrency
	HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);

	if (pInfo->m_pAutoIncr)
	{
		// Get Property Value of COM Object
		WORD value;
		pInfo->m_pAutoIncr->get_FastCounter(&value);

		// Show value in specified control window
		CString szText; szText.Format("%d", value);
		::SendMessage(pInfo->m_hwndCtrl, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) szText);

		// Tell Dialog that thread is done
		::SendMessage(pInfo->m_hwndDlg, g_msgFastThreadDone, 0, 0);
	}	// end if

	// Free data structure passed to this thread
	if (pInfo)
		delete pInfo;

	return 0;
}

UINT CMfcCliDlg::SlowCounterThreadFunc( LPVOID pParam )
{	// Thread Functions for background thread that will get SlowCounter
	CThreadInfo* pInfo = (CThreadInfo*) pParam;

	// Initializes the thread for multi-threaded object concurrency
	HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);

	if (pInfo->m_pAutoIncr)
	{
		// Get Property Value of COM Object
		WORD value;
		pInfo->m_pAutoIncr->get_SlowCounter(&value);

		// Show value in specified control window
		CString szText; szText.Format("%d", value);
		::SendMessage(pInfo->m_hwndCtrl, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) szText);

		// Tell Dialog that thread is done
		::SendMessage(pInfo->m_hwndDlg, g_msgSlowThreadDone, 0, 0);
	}	// end if

	// Free data structure passed to this thread
	if (pInfo)
		delete pInfo;

	return 0;
}

void CMfcCliDlg::OnBkFast() 
{	// Get the FastCounter property in a background worker thread
	// User can still do anything with the UI!
	CThreadInfo* pInfo = new CThreadInfo(m_pAutoIncr, 
		GetSafeHwnd(), 
		GetDlgItem(IDC_EDIT_FAST_COUNTER)->GetSafeHwnd());

	if (AfxBeginThread(&CMfcCliDlg::FastCounterThreadFunc, (LPVOID) pInfo))
	{	// Thread created successfully, so update count
		m_iFastThreadCount++;
		SetDlgItemInt(IDC_EDIT_FAST_THREADS, m_iFastThreadCount);
	}	// end if
}

void CMfcCliDlg::OnBkSlow() 
{	// Get the SlowCounter property in a background worker thread
	// User can still do anything with the UI!
	CThreadInfo* pInfo = new CThreadInfo(m_pAutoIncr, 
		GetSafeHwnd(), 
		GetDlgItem(IDC_EDIT_SLOW_COUNTER)->GetSafeHwnd());

	if (AfxBeginThread(&CMfcCliDlg::SlowCounterThreadFunc, (LPVOID) pInfo))
	{	// Thread created successfully, so update count
		m_iSlowThreadCount++;
		SetDlgItemInt(IDC_EDIT_SLOW_THREADS, m_iSlowThreadCount);
	}	// end if
}


LRESULT CMfcCliDlg::OnFastThreadDone(WPARAM wParam, LPARAM lParam)
{	// A Fast background thread has finished, so update count
	m_iFastThreadCount--;
	SetDlgItemInt(IDC_EDIT_FAST_THREADS, m_iFastThreadCount);
	return 0;
}

LRESULT CMfcCliDlg::OnSlowThreadDone(WPARAM wParam, LPARAM lParam)
{	// A Slow background thread has finished, so update count
	m_iSlowThreadCount--;
	SetDlgItemInt(IDC_EDIT_SLOW_THREADS, m_iSlowThreadCount);
	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品在线播放免费| 久久99精品久久久| 国产日本欧洲亚洲| 欧美日韩在线播放一区| 国产一区二区三区观看| 亚洲一区二区三区四区五区中文| 精品国产91乱码一区二区三区| 色综合久久久久| 国产尤物一区二区在线| 亚洲第一主播视频| 136国产福利精品导航| 精品久久国产字幕高潮| 在线日韩一区二区| 成人激情午夜影院| 美女尤物国产一区| 午夜伊人狠狠久久| 悠悠色在线精品| 国产精品免费久久| 亚洲精品在线免费播放| 777久久久精品| 欧美亚洲综合在线| 91视频一区二区| 岛国精品在线播放| 国产一区不卡视频| 蜜桃av一区二区| 日韩成人一区二区| 天天色图综合网| 亚洲国产精品久久人人爱蜜臀| 亚洲欧洲日产国码二区| 国产女人18水真多18精品一级做| 日韩精品一区国产麻豆| 欧美高清视频一二三区| 欧美日韩在线播| 欧美视频在线播放| 欧美日韩精品一区二区在线播放| 91在线一区二区| 91在线小视频| 91福利社在线观看| 欧美在线观看一区| 色婷婷一区二区三区四区| 91丨porny丨最新| 色偷偷成人一区二区三区91 | 奇米一区二区三区| 天堂av在线一区| 久久精品亚洲乱码伦伦中文| 久久综合九色综合97婷婷女人 | www激情久久| 精品国产一区二区三区久久影院| 精品日产卡一卡二卡麻豆| 日韩欧美国产三级电影视频| 精品国产乱码久久久久久浪潮| 精品99一区二区三区| 久久综合九色欧美综合狠狠| 国产亚洲va综合人人澡精品| 国产日韩v精品一区二区| 国产精品视频在线看| 国产精品成人午夜| 亚洲精品乱码久久久久久久久 | 成人欧美一区二区三区视频网页 | 宅男噜噜噜66一区二区66| 日韩一区二区三区观看| 欧美成人伊人久久综合网| 久久伊99综合婷婷久久伊| 欧美激情综合在线| 亚洲色图另类专区| 五月天网站亚洲| 国产在线播放一区三区四| 成人亚洲一区二区一| 色婷婷一区二区三区四区| 91麻豆精品国产91久久久久久久久| 日韩三区在线观看| 国产日产欧美一区二区三区| 18涩涩午夜精品.www| 日韩不卡一区二区| 夫妻av一区二区| 欧美日韩一区二区三区四区五区| 宅男噜噜噜66一区二区66| 国产三级精品视频| 亚洲主播在线观看| 国产乱码精品一区二区三| av午夜一区麻豆| 8v天堂国产在线一区二区| 国产亚洲短视频| 亚洲综合色成人| 国产剧情一区二区| 在线视频亚洲一区| 亚洲精品一区二区三区影院| 亚洲欧洲三级电影| 久久99国产精品久久99果冻传媒| 99精品国产热久久91蜜凸| 7777精品伊人久久久大香线蕉的 | 欧美一卡二卡三卡四卡| 中文字幕av一区二区三区高| 亚洲动漫第一页| 成人在线综合网| 日韩视频一区二区| 亚洲伦理在线精品| 国产精品一区二区不卡| 欧美日韩在线播放一区| 国产精品视频看| 久久精品国产99国产| 91国偷自产一区二区使用方法| www国产成人| 天堂在线一区二区| 一本色道久久综合狠狠躁的推荐| 日韩免费一区二区三区在线播放| 亚洲人成在线播放网站岛国| 精品一区二区三区日韩| 欧美日韩亚洲国产综合| 国产精品久线在线观看| 激情五月婷婷综合网| 欧美精品久久久久久久久老牛影院 | 色婷婷综合久久久久中文一区二区| 国产夜色精品一区二区av| 五月激情综合色| 色94色欧美sute亚洲线路一ni| 久久久久亚洲综合| 青青青伊人色综合久久| 欧美性受xxxx黑人xyx性爽| 国产精品女同一区二区三区| 韩国午夜理伦三级不卡影院| 欧美日韩在线免费视频| 亚洲欧美日韩中文字幕一区二区三区| 国内成人自拍视频| 精品国产91亚洲一区二区三区婷婷| 午夜精品久久久久影视| 91麻豆免费看| 亚洲欧美日韩久久| 成年人午夜久久久| 国产欧美中文在线| 国产精品996| 久久日韩粉嫩一区二区三区| 麻豆91在线播放免费| 91精品欧美一区二区三区综合在| 成人免费高清在线观看| 久久久久9999亚洲精品| 国模大尺度一区二区三区| 欧美成人女星排行榜| 美女精品自拍一二三四| 日韩一二三区视频| 免费日本视频一区| 日韩欧美成人一区| 久久精品久久久精品美女| 日韩精品中文字幕在线不卡尤物| 美国三级日本三级久久99| 91麻豆精品国产| 日本91福利区| 精品国产一区二区三区忘忧草| 激情偷乱视频一区二区三区| 久久人人超碰精品| 国产精品一区三区| 国产精品女人毛片| 日本电影亚洲天堂一区| 亚洲一区二区黄色| 91精品国产一区二区三区香蕉| 日韩激情一二三区| 亚洲精品在线观看视频| 成人激情图片网| 一区二区三区国产豹纹内裤在线| 欧美性猛交一区二区三区精品| 午夜久久久久久电影| 日韩三级视频在线看| 国产成人在线视频网站| 专区另类欧美日韩| 欧美伦理电影网| 黄网站免费久久| 亚洲同性同志一二三专区| 91黄视频在线观看| 蜜臀久久99精品久久久久久9| 久久亚洲二区三区| 91丨porny丨最新| 日韩成人一级大片| 中文字幕不卡在线观看| 欧美日韩精品一区视频| 国产乱理伦片在线观看夜一区 | 亚洲美腿欧美偷拍| 91精品国产91久久久久久最新毛片| 国产综合色产在线精品| 国产精品全国免费观看高清| 欧美在线观看一二区| 国产一区二区三区| 一区二区三区四区乱视频| 日韩精品一区二区在线观看| 99在线精品观看| 九色综合狠狠综合久久| 亚洲欧洲国产日本综合| 欧美一级电影网站| 成人av集中营| 美女视频网站黄色亚洲| 中文字幕在线视频一区| 欧美一卡2卡三卡4卡5免费| 99视频有精品| 美女精品自拍一二三四| 亚洲精品国产a| 久久综合久久99| 欧美日韩日日骚| 暴力调教一区二区三区| 免费成人在线视频观看| 亚洲免费在线视频| 久久女同性恋中文字幕|