HeaderPane
Main
Hide
Share Link
Print

DataInput Sample (C++)

This sample illustrates a multi-column control used for data input.

The source code is located at C:\Program Files (x86)\Softelvdm\SftBox OCX 6.0\Samples\VC++\DataInput\DataInputDlg.cpp.

// DataInputDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DataInput.h"
#include "DataInputDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDataInputDlg dialog

CDataInputDlg::CDataInputDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDataInputDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDataInputDlg)
		// 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);
}

void CDataInputDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDataInputDlg)
	DDX_Control(pDX, IDC_COMPANYLIST, m_CompanyList);
	DDX_Control(pDX, IDC_COUNTRYLIST, m_CountryList);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDataInputDlg, CDialog)
	//{{AFX_MSG_MAP(CDataInputDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDataInputDlg message handlers

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

    SftDarkMode_ApplyToDialog(m_hWnd);
    for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd != NULL; pWnd = pWnd->GetWindow(GW_HWNDNEXT)) {
        ISftBoxPtr pBox(pWnd->GetControlUnknown());
        if (pBox != NULL) {
            pBox->DarkMode = darkSftBoxAuto;                       // follow the Windows dark mode setting
            pBox->HighContrastMode = highContrastSftBoxAuto;      // follow the Windows High Contrast setting
        }
    }

	// 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

    ISftBoxPtr vCompanyList = m_CompanyList.GetControlUnknown();

    vCompanyList->PutFont(NULL); // use the form's default font
    vCompanyList->Headers->PutFont(NULL);
    vCompanyList->Edit->PutFont(NULL);

    // make a bold font
    IFontPtr pFont = vCompanyList->GetFont();;
    IFontPtr pFontNew;
	HRESULT hr = pFont->Clone(&pFontNew);
    ASSERT(SUCCEEDED(hr));
    pFontNew->QueryInterface(IID_IFontDisp, (void**) &m_pBoldFont);
    pFontNew->put_Bold(TRUE);

    // Load the bullet bitmap
    PICTDESC PictDesc;
    PictDesc.cbSizeofstruct = sizeof(PICTDESC);
    PictDesc.picType = PICTYPE_BITMAP;
    PictDesc.bmp.hbitmap = LoadBitmap(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDB_BULLET));
    PictDesc.bmp.hpal = NULL;
    hr = OleCreatePictureIndirect(&PictDesc, IID_IPictureDisp, TRUE, (void**)&m_pIPictureDispBullet);
    ASSERT(SUCCEEDED(hr));

    vCompanyList->BulkUpdate = VARIANT_TRUE;

    AddCompany(_T("Softel vdm, Inc."), _T(""), _T(""), _T("5401 S Kirkman Rd, Ste 310"), _T("Orlando"), _T("FL"), _T("32819"), _T("United States"), _T("(941) 505-8600"), _T("(941) 444-6100"));

    AddCompany(_T("Alfreds Futterkiste"), _T("Maria Anders"), _T("Sales Representative"), _T("Obere Str. 57"), _T("Berlin"), _T(""), _T("12209"), _T("Germany"), _T("030-0074321"), _T("030-0076545"));
    AddCompany(_T("Ana Trujillo Emparedados y helados"), _T("Ana Trujillo"), _T("Owner"), _T("Avda. de la Constituci�n 2222"), _T("M�xico D.F."), _T(""), _T("05021"), _T("Mexico"), _T("(5) 555-4729"), _T("(5) 555-3745"));
    AddCompany(_T("Antonio Moreno Taquer�a"), _T("Antonio Moreno"), _T("Owner"), _T("Mataderos  2312"), _T("M�xico D.F."), _T(""), _T("05023"), _T("Mexico"), _T("(5) 555-3932"), _T(""));
    AddCompany(_T("Around the Horn"), _T("Thomas Hardy"), _T("Sales Representative"), _T("120 Hanover Sq."), _T("London"), _T(""), _T("WA1 1DP"), _T("UK"), _T("(171) 555-7788"), _T("(171) 555-6750"));
    AddCompany(_T("Berglunds snabbk�p"), _T("Christina Berglund"), _T("Order Administrator"), _T("Berguvsv�gen  8"), _T("Lule�"), _T(""), _T("S-958 22"), _T("Sweden"), _T("0921-12 34 65"), _T("0921-12 34 67"));
    AddCompany(_T("Blauer See Delikatessen"), _T("Hanna Moos"), _T("Sales Representative"), _T("Forsterstr. 57"), _T("Mannheim"), _T(""), _T("68306"), _T("Germany"), _T("0621-08460"), _T("0621-08924"));
    AddCompany(_T("Blondel p�re et fils"), _T("Fr�d�rique Citeaux"), _T("Marketing Manager"), _T("24, place Kl�ber"), _T("Strasbourg"), _T(""), _T("67000"), _T("France"), _T("88.60.15.31"), _T("88.60.15.32"));
    AddCompany(_T("B�lido Comidas preparadas"), _T("Mart�n Sommer"), _T("Owner"), _T("C/ Araquil, 67"), _T("Madrid"), _T(""), _T("28023"), _T("Spain"), _T("(91) 555 22 82"), _T("(91) 555 91 99"));
    AddCompany(_T("Bon app'"), _T("Laurence Lebihan"), _T("Owner"), _T("12, rue des Bouchers"), _T("Marseille"), _T(""), _T("13008"), _T("France"), _T("91.24.45.40"), _T("91.24.45.41"));
    AddCompany(_T("Bottom-Dollar Markets"), _T("Elizabeth Lincoln"), _T("Accounting Manager"), _T("23 Tsawassen Blvd."), _T("Tsawassen"), _T("BC"), _T("T2F 8M4"), _T("Canada"), _T("(604) 555-4729"), _T("(604) 555-3745"));
    AddCompany(_T("B's Beverages"), _T("Victoria Ashworth"), _T("Sales Representative"), _T("Fauntleroy Circus"), _T("London"), _T(""), _T("EC2 5NT"), _T("UK"), _T("(171) 555-1212"), _T(""));
    AddCompany(_T("Cactus Comidas para llevar"), _T("Patricio Simpson"), _T("Sales Agent"), _T("Cerrito 333"), _T("Buenos Aires"), _T(""), _T("1010"), _T("Argentina"), _T("(1) 135-5555"), _T("(1) 135-4892"));
    AddCompany(_T("Centro comercial Moctezuma"), _T("Francisco Chang"), _T("Marketing Manager"), _T("Sierras de Granada 9993"), _T("M�xico D.F."), _T(""), _T("05022"), _T("Mexico"), _T("(5) 555-3392"), _T("(5) 555-7293"));
    AddCompany(_T("Chop-suey Chinese"), _T("Yang Wang"), _T("Owner"), _T("Hauptstr. 29"), _T("Bern"), _T(""), _T("3012"), _T("Switzerland"), _T("0452-076545"), _T(""));
    AddCompany(_T("Com�rcio Mineiro"), _T("Pedro Afonso"), _T("Sales Associate"), _T("Av. dos Lus�adas, 23"), _T("S�o Paulo"), _T("SP"), _T("05432-043"), _T("Brazil"), _T("(11) 555-7647"), _T(""));
    AddCompany(_T("Consolidated Holdings"), _T("Elizabeth Brown"), _T("Sales Representative"), _T("Berkeley Gardens 12  Brewery "), _T("London"), _T(""), _T("WX1 6LT"), _T("UK"), _T("(171) 555-2282"), _T("(171) 555-9199"));
    AddCompany(_T("Drachenblut Delikatessen"), _T("Sven Ottlieb"), _T("Order Administrator"), _T("Walserweg 21"), _T("Aachen"), _T(""), _T("52066"), _T("Germany"), _T("0241-039123"), _T("0241-059428"));
    AddCompany(_T("Du monde entier"), _T("Janine Labrune"), _T("Owner"), _T("67, rue des Cinquante Otages"), _T("Nantes"), _T(""), _T("44000"), _T("France"), _T("40.67.88.88"), _T("40.67.89.89"));
    AddCompany(_T("Eastern Connection"), _T("Ann Devon"), _T("Sales Agent"), _T("35 King George"), _T("London"), _T(""), _T("WX3 6FW"), _T("UK"), _T("(171) 555-0297"), _T("(171) 555-3373"));
    AddCompany(_T("Ernst Handel"), _T("Roland Mendel"), _T("Sales Manager"), _T("Kirchgasse 6"), _T("Graz"), _T(""), _T("8010"), _T("Austria"), _T("7675-3425"), _T("7675-3426"));
    AddCompany(_T("Familia Arquibaldo"), _T("Aria Cruz"), _T("Marketing Assistant"), _T("Rua Or�s, 92"), _T("S�o Paulo"), _T("SP"), _T("05442-030"), _T("Brazil"), _T("(11) 555-9857"), _T(""));
    AddCompany(_T("FISSA Fabrica Inter. Salchichas S.A."), _T("Diego Roel"), _T("Accounting Manager"), _T("C/ Moralzarzal, 86"), _T("Madrid"), _T(""), _T("28034"), _T("Spain"), _T("(91) 555 94 44"), _T("(91) 555 55 93"));
    AddCompany(_T("Folies gourmandes"), _T("Martine Ranc�"), _T("Assistant Sales Agent"), _T("184, chauss�e de Tournai"), _T("Lille"), _T(""), _T("59000"), _T("France"), _T("20.16.10.16"), _T("20.16.10.17"));
    AddCompany(_T("Folk och f� HB"), _T("Maria Larsson"), _T("Owner"), _T("�kergatan 24"), _T("Br�cke"), _T(""), _T("S-844 67"), _T("Sweden"), _T("0695-34 67 21"), _T(""));
    AddCompany(_T("Frankenversand"), _T("Peter Franken"), _T("Marketing Manager"), _T("Berliner Platz 43"), _T("M�nchen"), _T(""), _T("80805"), _T("Germany"), _T("089-0877310"), _T("089-0877451"));
    AddCompany(_T("France restauration"), _T("Carine Schmitt"), _T("Marketing Manager"), _T("54, rue Royale"), _T("Nantes"), _T(""), _T("44000"), _T("France"), _T("40.32.21.21"), _T("40.32.21.20"));
    AddCompany(_T("Franchi S.p.A."), _T("Paolo Accorti"), _T("Sales Representative"), _T("Via Monte Bianco 34"), _T("Torino"), _T(""), _T("10100"), _T("Italy"), _T("011-4988260"), _T("011-4988261"));
    AddCompany(_T("Furia Bacalhau e Frutos do Mar"), _T("Lino Rodriguez "), _T("Sales Manager"), _T("Jardim das rosas n. 32"), _T("Lisboa"), _T(""), _T("1675"), _T("Portugal"), _T("(1) 354-2534"), _T("(1) 354-2535"));
    AddCompany(_T("Galer�a del gastr�nomo"), _T("Eduardo Saavedra"), _T("Marketing Manager"), _T("Rambla de Catalu�a, 23"), _T("Barcelona"), _T(""), _T("08022"), _T("Spain"), _T("(93) 203 4560"), _T("(93) 203 4561"));
    AddCompany(_T("Godos Cocina T�pica"), _T("Jos� Pedro Freyre"), _T("Sales Manager"), _T("C/ Romero, 33"), _T("Sevilla"), _T(""), _T("41101"), _T("Spain"), _T("(95) 555 82 82"), _T(""));
    AddCompany(_T("Gourmet Lanchonetes"), _T("Andr� Fonseca"), _T("Sales Associate"), _T("Av. Brasil, 442"), _T("Campinas"), _T("SP"), _T("04876-786"), _T("Brazil"), _T("(11) 555-9482"), _T(""));
    AddCompany(_T("Great Lakes Food Market"), _T("Howard Snyder"), _T("Marketing Manager"), _T("2732 Baker Blvd."), _T("Eugene"), _T("OR"), _T("97403"), _T("United States"), _T("(503) 555-7555"), _T(""));
    AddCompany(_T("GROSELLA-Restaurante"), _T("Manuel Pereira"), _T("Owner"), _T("5� Ave. Los Palos Grandes"), _T("Caracas"), _T("DF"), _T("1081"), _T("Venezuela"), _T("(2) 283-2951"), _T("(2) 283-3397"));
    AddCompany(_T("Hanari Carnes"), _T("Mario Pontes"), _T("Accounting Manager"), _T("Rua do Pa�o, 67"), _T("Rio de Janeiro"), _T("RJ"), _T("05454-876"), _T("Brazil"), _T("(21) 555-0091"), _T("(21) 555-8765"));
    AddCompany(_T("HILARI�N-Abastos"), _T("Carlos Hern�ndez"), _T("Sales Representative"), _T("Carrera 22 con Ave. Carlos Soublette #8-35"), _T("San Crist�bal"), _T("T�chira"), _T("5022"), _T("Venezuela"), _T("(5) 555-1340"), _T("(5) 555-1948"));
    AddCompany(_T("Hungry Coyote Import Store"), _T("Yoshi Latimer"), _T("Sales Representative"), _T("City Center Plaza 516 Main St."), _T("Elgin"), _T("OR"), _T("97827"), _T("United States"), _T("(503) 555-6874"), _T("(503) 555-2376"));
    AddCompany(_T("Hungry Owl All-Night Grocers"), _T("Patricia McKenna"), _T("Sales Associate"), _T("8 Johnstown Road"), _T("Cork"), _T("Co. Cork"), _T(""), _T("Ireland"), _T("2967 542"), _T("2967 3333"));
    AddCompany(_T("Island Trading"), _T("Helen Bennett"), _T("Marketing Manager"), _T("Garden House Crowther Way"), _T("Cowes"), _T("Isle of Wight"), _T("PO31 7PJ"), _T("UK"), _T("(198) 555-8888"), _T(""));
    AddCompany(_T("K�niglich Essen"), _T("Philip Cramer"), _T("Sales Associate"), _T("Maubelstr. 90"), _T("Brandenburg"), _T(""), _T("14776"), _T("Germany"), _T("0555-09876"), _T(""));
    AddCompany(_T("La corne d'abondance"), _T("Daniel Tonini"), _T("Sales Representative"), _T("67, avenue de l'Europe"), _T("Versailles"), _T(""), _T("78000"), _T("France"), _T("30.59.84.10"), _T("30.59.85.11"));
    AddCompany(_T("La maison d'Asie"), _T("Annette Roulet"), _T("Sales Manager"), _T("1 rue Alsace-Lorraine"), _T("Toulouse"), _T(""), _T("31000"), _T("France"), _T("61.77.61.10"), _T("61.77.61.11"));
    AddCompany(_T("Laughing Bacchus Wine Cellars"), _T("Yoshi Tannamuri"), _T("Marketing Assistant"), _T("1900 Oak St."), _T("Vancouver"), _T("BC"), _T("V3F 2K1"), _T("Canada"), _T("(604) 555-3392"), _T("(604) 555-7293"));
    AddCompany(_T("Lazy K Kountry Store"), _T("John Steel"), _T("Marketing Manager"), _T("12 Orchestra Terrace"), _T("Walla Walla"), _T("WA"), _T("99362"), _T("United States"), _T("(509) 555-7969"), _T("(509) 555-6221"));
    AddCompany(_T("Lehmanns Marktstand"), _T("Renate Messner"), _T("Sales Representative"), _T("Magazinweg 7"), _T("Frankfurt a.M. "), _T(""), _T("60528"), _T("Germany"), _T("069-0245984"), _T("069-0245874"));
    AddCompany(_T("Let's Stop N Shop"), _T("Jaime Yorres"), _T("Owner"), _T("87 Polk St. Suite 5"), _T("San Francisco"), _T("CA"), _T("94117"), _T("United States"), _T("(415) 555-5938"), _T(""));
    AddCompany(_T("LILA-Supermercado"), _T("Carlos Gonz�lez"), _T("Accounting Manager"), _T("Carrera 52 con Ave. Bol�var #65-98 Llano Largo"), _T("Barquisimeto"), _T("Lara"), _T("3508"), _T("Venezuela"), _T("(9) 331-6954"), _T("(9) 331-7256"));
    AddCompany(_T("LINO-Delicateses"), _T("Felipe Izquierdo"), _T("Owner"), _T("Ave. 5 de Mayo Porlamar"), _T("I. de Margarita"), _T("Nueva Esparta"), _T("4980"), _T("Venezuela"), _T("(8) 34-56-12"), _T("(8) 34-93-93"));
    AddCompany(_T("Lonesome Pine Restaurant"), _T("Fran Wilson"), _T("Sales Manager"), _T("89 Chiaroscuro Rd."), _T("Portland"), _T("OR"), _T("97219"), _T("United States"), _T("(503) 555-9573"), _T("(503) 555-9646"));
    AddCompany(_T("Magazzini Alimentari Riuniti"), _T("Giovanni Rovelli"), _T("Marketing Manager"), _T("Via Ludovico il Moro 22"), _T("Bergamo"), _T(""), _T("24100"), _T("Italy"), _T("035-640230"), _T("035-640231"));
    AddCompany(_T("Maison Dewey"), _T("Catherine Dewey"), _T("Sales Agent"), _T("Rue Joseph-Bens 532"), _T("Bruxelles"), _T(""), _T("B-1180"), _T("Belgium"), _T("(02) 201 24 67"), _T("(02) 201 24 68"));
    AddCompany(_T("M�re Paillarde"), _T("Jean Fresni�re"), _T("Marketing Assistant"), _T("43 rue St. Laurent"), _T("Montr�al"), _T("Qu�bec"), _T("H1J 1C3"), _T("Canada"), _T("(514) 555-8054"), _T("(514) 555-8055"));
    AddCompany(_T("Morgenstern Gesundkost"), _T("Alexander Feuer"), _T("Marketing Assistant"), _T("Heerstr. 22"), _T("Leipzig"), _T(""), _T("04179"), _T("Germany"), _T("0342-023176"), _T(""));
    AddCompany(_T("North/South"), _T("Simon Crowther"), _T("Sales Associate"), _T("South House 300 Queensbridge"), _T("London"), _T(""), _T("SW7 1RZ"), _T("UK"), _T("(171) 555-7733"), _T("(171) 555-2530"));
    AddCompany(_T("Oc�ano Atl�ntico Ltda."), _T("Yvonne Moncada"), _T("Sales Agent"), _T("Ing. Gustavo Moncada 8585 Piso 20-A"), _T("Buenos Aires"), _T(""), _T("1010"), _T("Argentina"), _T("(1) 135-5333"), _T("(1) 135-5535"));
    AddCompany(_T("Old World Delicatessen"), _T("Rene Phillips"), _T("Sales Representative"), _T("2743 Bering St."), _T("Anchorage"), _T("AK"), _T("99508"), _T("United States"), _T("(907) 555-7584"), _T("(907) 555-2880"));
    AddCompany(_T("Ottilies K�seladen"), _T("Henriette Pfalzheim"), _T("Owner"), _T("Mehrheimerstr. 369"), _T("K�ln"), _T(""), _T("50739"), _T("Germany"), _T("0221-0644327"), _T("0221-0765721"));
    AddCompany(_T("Paris sp�cialit�s"), _T("Marie Bertrand"), _T("Owner"), _T("265, boulevard Charonne"), _T("Paris"), _T(""), _T("75012"), _T("France"), _T("(1) 42.34.22.66"), _T("(1) 42.34.22.77"));
    AddCompany(_T("Pericles Comidas cl�sicas"), _T("Guillermo Fern�ndez"), _T("Sales Representative"), _T("Calle Dr. Jorge Cash 321"), _T("M�xico D.F."), _T(""), _T("05033"), _T("Mexico"), _T("(5) 552-3745"), _T("(5) 545-3745"));
    AddCompany(_T("Piccolo und mehr"), _T("Georg Pipps"), _T("Sales Manager"), _T("Geislweg 14"), _T("Salzburg"), _T(""), _T("5020"), _T("Austria"), _T("6562-9722"), _T("6562-9723"));
    AddCompany(_T("Princesa Isabel Vinhos"), _T("Isabel de Castro"), _T("Sales Representative"), _T("Estrada da sa�de n. 58"), _T("Lisboa"), _T(""), _T("1756"), _T("Portugal"), _T("(1) 356-5634"), _T(""));
    AddCompany(_T("Que Del�cia"), _T("Bernardo Batista"), _T("Accounting Manager"), _T("Rua da Panificadora, 12"), _T("Rio de Janeiro"), _T("RJ"), _T("02389-673"), _T("Brazil"), _T("(21) 555-4252"), _T("(21) 555-4545"));
    AddCompany(_T("Queen Cozinha"), _T("L�cia Carvalho"), _T("Marketing Assistant"), _T("Alameda dos Can�rios, 891"), _T("S�o Paulo"), _T("SP"), _T("05487-020"), _T("Brazil"), _T("(11) 555-1189"), _T(""));
    AddCompany(_T("QUICK-Stop"), _T("Horst Kloss"), _T("Accounting Manager"), _T("Taucherstra�e 10"), _T("Cunewalde"), _T(""), _T("01307"), _T("Germany"), _T("0372-035188"), _T(""));
    AddCompany(_T("Rancho grande"), _T("Sergio Guti�rrez"), _T("Sales Representative"), _T("Av. del Libertador 900"), _T("Buenos Aires"), _T(""), _T("1010"), _T("Argentina"), _T("(1) 123-5555"), _T("(1) 123-5556"));
    AddCompany(_T("Rattlesnake Canyon Grocery"), _T("Paula Wilson"), _T("Assistant Sales Representative"), _T("2817 Milton Dr."), _T("Albuquerque"), _T("NM"), _T("87110"), _T("United States"), _T("(505) 555-5939"), _T("(505) 555-3620"));
    AddCompany(_T("Reggiani Caseifici"), _T("Maurizio Moroni"), _T("Sales Associate"), _T("Strada Provinciale 124"), _T("Reggio Emilia"), _T(""), _T("42100"), _T("Italy"), _T("0522-556721"), _T("0522-556722"));
    AddCompany(_T("Ricardo Adocicados"), _T("Janete Limeira"), _T("Assistant Sales Agent"), _T("Av. Copacabana, 267"), _T("Rio de Janeiro"), _T("RJ"), _T("02389-890"), _T("Brazil"), _T("(21) 555-3412"), _T(""));
    AddCompany(_T("Richter Supermarkt"), _T("Michael Holz"), _T("Sales Manager"), _T("Grenzacherweg 237"), _T("Gen�ve"), _T(""), _T("1203"), _T("Switzerland"), _T("0897-034214"), _T(""));
    AddCompany(_T("Romero y tomillo"), _T("Alejandra Camino"), _T("Accounting Manager"), _T("Gran V�a, 1"), _T("Madrid"), _T(""), _T("28001"), _T("Spain"), _T("(91) 745 6200"), _T("(91) 745 6210"));
    AddCompany(_T("Sant� Gourmet"), _T("Jonas Bergulfsen"), _T("Owner"), _T("Erling Skakkes gate 78"), _T("Stavern"), _T(""), _T("4110"), _T("Norway"), _T("07-98 92 35"), _T("07-98 92 47"));
    AddCompany(_T("Save-a-lot Markets"), _T("Jose Pavarotti"), _T("Sales Representative"), _T("187 Suffolk Ln."), _T("Boise"), _T("ID"), _T("83720"), _T("United States"), _T("(208) 555-8097"), _T(""));
    AddCompany(_T("Seven Seas Imports"), _T("Hari Kumar"), _T("Sales Manager"), _T("90 Wadhurst Rd."), _T("London"), _T(""), _T("OX15 4NB"), _T("UK"), _T("(171) 555-1717"), _T("(171) 555-5646"));
    AddCompany(_T("Simons bistro"), _T("Jytte Petersen"), _T("Owner"), _T("Vinb�ltet 34"), _T("K�benhavn"), _T(""), _T("1734"), _T("Denmark"), _T("31 12 34 56"), _T("31 13 35 57"));
    AddCompany(_T("Sp�cialit�s du monde"), _T("Dominique Perrier"), _T("Marketing Manager"), _T("25, rue Lauriston"), _T("Paris"), _T(""), _T("75016"), _T("France"), _T("(1) 47.55.60.10"), _T("(1) 47.55.60.20"));
    AddCompany(_T("Split Rail Beer & Ale"), _T("Art Braunschweiger"), _T("Sales Manager"), _T("P.O. Box 555"), _T("Lander"), _T("WY"), _T("82520"), _T("United States"), _T("(307) 555-4680"), _T("(307) 555-6525"));
    AddCompany(_T("Supr�mes d�lices"), _T("Pascale Cartrain"), _T("Accounting Manager"), _T("Boulevard Tirou, 255"), _T("Charleroi"), _T(""), _T("B-6000"), _T("Belgium"), _T("(071) 23 67 22 20"), _T("(071) 23 67 22 21"));
    AddCompany(_T("The Big Cheese"), _T("Liz Nixon"), _T("Marketing Manager"), _T("89 Jefferson Way Suite 2"), _T("Portland"), _T("OR"), _T("97201"), _T("United States"), _T("(503) 555-3612"), _T(""));
    AddCompany(_T("The Cracker Box"), _T("Liu Wong"), _T("Marketing Assistant"), _T("55 Grizzly Peak Rd."), _T("Butte"), _T("MT"), _T("59801"), _T("United States"), _T("(406) 555-5834"), _T("(406) 555-8083"));
    AddCompany(_T("Toms Spezialit�ten"), _T("Karin Josephs"), _T("Marketing Manager"), _T("Luisenstr. 48"), _T("M�nster"), _T(""), _T("44087"), _T("Germany"), _T("0251-031259"), _T("0251-035695"));
    AddCompany(_T("Tortuga Restaurante"), _T("Miguel Angel Paolino"), _T("Owner"), _T("Avda. Azteca 123"), _T("M�xico D.F."), _T(""), _T("05033"), _T("Mexico"), _T("(5) 555-2933"), _T(""));
    AddCompany(_T("Tradi��o Hipermercados"), _T("Anabela Domingues"), _T("Sales Representative"), _T("Av. In�s de Castro, 414"), _T("S�o Paulo"), _T("SP"), _T("05634-030"), _T("Brazil"), _T("(11) 555-2167"), _T("(11) 555-2168"));
    AddCompany(_T("Trail's Head Gourmet Provisioners"), _T("Helvetius Nagy"), _T("Sales Associate"), _T("722 DaVinci Blvd."), _T("Kirkland"), _T("WA"), _T("98034"), _T("United States"), _T("(206) 555-8257"), _T("(206) 555-2174"));
    AddCompany(_T("Vaffeljernet"), _T("Palle Ibsen"), _T("Sales Manager"), _T("Smagsl�get 45"), _T("�rhus"), _T(""), _T("8200"), _T("Denmark"), _T("86 21 32 43"), _T("86 22 33 44"));
    AddCompany(_T("Victuailles en stock"), _T("Mary Saveley"), _T("Sales Agent"), _T("2, rue du Commerce"), _T("Lyon"), _T(""), _T("69004"), _T("France"), _T("78.32.54.86"), _T("78.32.54.87"));
    AddCompany(_T("Vins et alcools Chevalier"), _T("Paul Henriot"), _T("Accounting Manager"), _T("59 rue de l'Abbaye"), _T("Reims"), _T(""), _T("51100"), _T("France"), _T("26.47.15.10"), _T("26.47.15.11"));
    AddCompany(_T("Die Wandernde Kuh"), _T("Rita M�ller"), _T("Sales Representative"), _T("Adenauerallee 900"), _T("Stuttgart"), _T(""), _T("70563"), _T("Germany"), _T("0711-020361"), _T("0711-035428"));
    AddCompany(_T("Wartian Herkku"), _T("Pirkko Koskitalo"), _T("Accounting Manager"), _T("Torikatu 38"), _T("Oulu"), _T(""), _T("90110"), _T("Finland"), _T("981-443655"), _T("981-443655"));
    AddCompany(_T("Wellington Importadora"), _T("Paula Parente"), _T("Sales Manager"), _T("Rua do Mercado, 12"), _T("Resende"), _T("SP"), _T("08737-363"), _T("Brazil"), _T("(14) 555-8122"), _T(""));
    AddCompany(_T("White Clover Markets"), _T("Karl Jablonski"), _T("Owner"), _T("305 - 14th Ave. S. Suite 3B"), _T("Seattle"), _T("WA"), _T("98128"), _T("United States"), _T("(206) 555-4112"), _T("(206) 555-4115"));
    AddCompany(_T("Wilman Kala"), _T("Matti Karttunen"), _T("Owner/Marketing Assistant"), _T("Keskuskatu 45"), _T("Helsinki"), _T(""), _T("21240"), _T("Finland"), _T("90-224 8858"), _T("90-224 8858"));
    AddCompany(_T("Wolski  Zajazd"), _T("Zbyszek Piestrzeniewicz"), _T("Owner"), _T("ul. Filtrowa 68"), _T("Warszawa"), _T(""), _T("01-012"), _T("Poland"), _T("(26) 642-7012"), _T("(26) 642-7012"));
    vCompanyList->BulkUpdate = VARIANT_FALSE;

    vCompanyList->Columns->MakeOptimal(0);
    vCompanyList->Items->RecalcHorizontalExtent(0);
    PerformSort(0, sortSftBoxAscending);
    // Adjust horizontal extent so we can scroll to the right edge of the header
    CRect rect;
    m_CompanyList.GetClientRect(&rect);
    vCompanyList->Items->HorizontalExtent = vCompanyList->Items->HorizontalExtent + rect.Width();
    vCompanyList->Items->Select(_T("Softel vdm, Inc."), 0, 0, VARIANT_FALSE, VARIANT_TRUE, VARIANT_FALSE);

    ISftBoxPtr vCountryList = m_CountryList.GetControlUnknown();

    vCountryList->PutFont(NULL);
    vCountryList->Edit->PutFont(NULL);
    vCountryList->Items->Add(_T("Austria"));
    vCountryList->Items->Add(_T("Australia"));
    vCountryList->Items->Add(_T("Belgium"));
    vCountryList->Items->Add(_T("Canada"));
    vCountryList->Items->Add(_T("Switzerland"));
    vCountryList->Items->Add(_T("Chile"));
    vCountryList->Items->Add(_T("China"));
    vCountryList->Items->Add(_T("Costa Rica"));
    vCountryList->Items->Add(_T("Cuba"));
    vCountryList->Items->Add(_T("Germany"));
    vCountryList->Items->Add(_T("Denmark"));
    vCountryList->Items->Add(_T("Egypt"));
    vCountryList->Items->Add(_T("Spain"));
    vCountryList->Items->Add(_T("Finland"));
    vCountryList->Items->Add(_T("France"));
    vCountryList->Items->Add(_T("Great Britain"));
    vCountryList->Items->Add(_T("Greenland"));
    vCountryList->Items->Add(_T("Greece"));
    vCountryList->Items->Add(_T("Hong Kong"));
    vCountryList->Items->Add(_T("Ireland"));
    vCountryList->Items->Add(_T("Israel"));
    vCountryList->Items->Add(_T("Iceland"));
    vCountryList->Items->Add(_T("Italy"));
    vCountryList->Items->Add(_T("Japan"));
    vCountryList->Items->Add(_T("South Korea"));
    vCountryList->Items->Add(_T("Liechtenstein"));
    vCountryList->Items->Add(_T("Lithuania"));
    vCountryList->Items->Add(_T("Luxembourg"));
    vCountryList->Items->Add(_T("Mexico"));
    vCountryList->Items->Add(_T("Netherlands"));
    vCountryList->Items->Add(_T("The Netherlands"));
    vCountryList->Items->Add(_T("Norway"));
    vCountryList->Items->Add(_T("New Zealand"));
    vCountryList->Items->Add(_T("Puerto Rico"));
    vCountryList->Items->Add(_T("Portugal"));
    vCountryList->Items->Add(_T("Russia"));
    vCountryList->Items->Add(_T("Sweden"));
    vCountryList->Items->Add(_T("Singapore"));
    vCountryList->Items->Add(_T("United Kingdom"));
    vCountryList->Items->Add(_T("Yugoslavia"));
    vCountryList->Items->Add(_T("South Africa"));
    vCountryList->Items->Sort(-1, 0, sortSftBoxAscending);
    vCountryList->Items->Insert(_T("United States"), 0);
    vCountryList->Items->Selection = 0;

    vCountryList->Columns->MakeOptimal(0);
    vCountryList->Items->RecalcHorizontalExtent(0);

	return TRUE;  // return TRUE  unless you set the focus to a control
}

// 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 CDataInputDlg::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 CDataInputDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CDataInputDlg::AddCompany(LPCTSTR CompName, LPCTSTR NotUsed1, LPCTSTR NotUsed2, LPCTSTR Address, LPCTSTR City, LPCTSTR State, LPCTSTR ZIP, LPCTSTR Country, LPCTSTR Phone, LPCTSTR Fax)
{
    long index;

    ISftBoxPtr vCompanyList = m_CompanyList.GetControlUnknown();
    index = vCompanyList->Items->Add(CompName);
    if (lstrcmp(Country, _T("United States")) == 0) {
        vCompanyList->Cell[index][0]->putref_Font(m_pBoldFont);
        vCompanyList->Cell[index][0]->Image->PutRefPicture(m_pIPictureDispBullet);
        vCompanyList->Cell[index][0]->ImageHAlign = halignSftBoxRight;
    }
    vCompanyList->Cell[index][1]->Text = Address;
    vCompanyList->Cell[index][2]->Text = City;
    vCompanyList->Cell[index][3]->Text = State;
    vCompanyList->Cell[index][4]->Text = ZIP;
    vCompanyList->Cell[index][5]->Text = Country;
    vCompanyList->Cell[index][6]->Text = Phone;
    vCompanyList->Cell[index][7]->Text = Fax;
}

void CDataInputDlg::PerformSort(short column, SftBoxSortConstants dir)
{
    m_sortDirection = dir;
    m_sortedColumn = column;

    ISftBoxPtr vCompanyList = m_CompanyList.GetControlUnknown();
    vCompanyList->Headers->ClearImages();
    if (m_sortDirection == sortSftBoxAscending)
        vCompanyList->Header[column]->Image->Appearance = sftImageSortAsc;
    else
        vCompanyList->Header[column]->Image->Appearance = sftImageSortDesc;
    vCompanyList->Items->Sort(-1, m_sortedColumn, m_sortDirection);
}

void CDataInputDlg::OnItemClickCompanylist(long Part, long AreaType, long ItemIndex, short ColNum, short Button, short Shift)
{
    if (AreaType == areaSftBoxColumn) {
        if (m_sortedColumn != ColNum || m_sortDirection != sortSftBoxAscending)
            PerformSort(ColNum, sortSftBoxAscending);
        else
            PerformSort(ColNum, sortSftBoxDescending);
    }
}

void CDataInputDlg::OnItemDblClkCompanylist(long Part, long AreaType, long ItemIndex, short ColNum, short Button, short Shift)
{
    if (AreaType == areaSftBoxColumn) {
        if (m_sortedColumn != ColNum || m_sortDirection != sortSftBoxAscending)
            PerformSort(ColNum, sortSftBoxAscending);
        else
            PerformSort(ColNum, sortSftBoxDescending);
    } else if (AreaType == areaSftBoxColumnRes) {
        ISftBoxPtr vCompanyList = m_CompanyList.GetControlUnknown();
        vCompanyList->Column[ColNum]->MakeOptimal(0);
        vCompanyList->Items->RecalcHorizontalExtent(0);
        // Adjust horizontal extent so we can scroll to the right edge of the header
        CRect rect;
        m_CompanyList.GetClientRect(&rect);
        vCompanyList->Items->HorizontalExtent = vCompanyList->Items->HorizontalExtent + rect.Width();
    }
}

BEGIN_EVENTSINK_MAP(CDataInputDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CDataInputDlg)
	ON_EVENT(CDataInputDlg, IDC_COMPANYLIST, 8 /* ItemClick */, OnItemClickCompanylist, VTS_I4 VTS_I4 VTS_I4 VTS_I2 VTS_I2 VTS_I2)
	ON_EVENT(CDataInputDlg, IDC_COMPANYLIST, 9 /* ItemDblClk */, OnItemDblClkCompanylist, VTS_I4 VTS_I4 VTS_I4 VTS_I2 VTS_I2 VTS_I2)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()


BOOL CDataInputDlg::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
    INT_PTR dmResult;
    if (SftDarkMode_HandleDialogMessage(m_hWnd, message, wParam, lParam, &dmResult)) {
        if (pResult) *pResult = dmResult;
        return TRUE;
    }
    return CDialog::OnWndMsg(message, wParam, lParam, pResult);
}

Last Updated 11/22/2026 - (email)
© 2026 Softel vdm, Inc.