Click here to Skip to main content
15,895,283 members
Articles / Programming Languages / C#

Using the Windows 2000/XP Object Selection Dialog

Rate me:
Please Sign up or sign in to vote.
4.92/5 (29 votes)
21 Nov 2005CPOL14 min read 251.5K   4.5K   57  
This article describes how to use the "Select Users or Groups" system dialog.
/*
	$Workfile:$
	$Header:$

	Copyright � 2003 Friedrich Brunzema.
	All rights reserved.

	@doc
	@module SelectUsersOrGroups.cpp - Our application class |

	

	Revision History:
	$Log$ 
*/

#include "stdafx.h"
#include "SelectUsersOrGroups.h"
#include "SelectUsersOrGroupsDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSelectUsersOrGroupsApp

BEGIN_MESSAGE_MAP(CSelectUsersOrGroupsApp, CWinApp)
	//{{AFX_MSG_MAP(CSelectUsersOrGroupsApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSelectUsersOrGroupsApp construction

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

/////////////////////////////////////////////////////////////////////////////
// The one and only CSelectUsersOrGroupsApp object

CSelectUsersOrGroupsApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CSelectUsersOrGroupsApp initialization

BOOL CSelectUsersOrGroupsApp::InitInstance()
{

	AfxEnableControlContainer();
	AfxOleInit();

	CSelectUsersOrGroupsDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

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) AB SCIEX
Canada Canada
I was born and grew up in Northern Germany grew up in Quebec in a French Language environment. I finished High School in Fergus, Ontario. After a 4 year training as a Pipe Organ Builder in Germany, I returned to Canada to get a B.Sc. in Computer Science. I'm currently working for a company called AB SCIEX working on Mass Spectrometer Software, am married, and have three often wonderful children. What you believe in matters - I am a follower of Jesus Christ - we attend a German-Lutheran congregation in downtown Toronto.

Comments and Discussions