home *** CD-ROM | disk | FTP | other *** search
- // flistdem.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "vbxdemo.h"
- #include "flistdem.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CFlistDemo dialog
-
-
- CFlistDemo::CFlistDemo(CWnd* pParent /*=NULL*/)
- : CDialog(CFlistDemo::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CFlistDemo)
- m_szDir = "";
- m_szFile = "";
- m_pDirList = NULL;
- m_pFilesList = NULL;
- //}}AFX_DATA_INIT
- }
-
- void CFlistDemo::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CFlistDemo)
- DDX_VBText(pDX, IDC_TEXTDIR, 20, m_szDir);
- DDX_VBText(pDX, IDC_TEXTFILE, 20, m_szFile);
- DDX_VBFList(pDX, IDC_VBFLIST1, m_pDirList);
- DDX_VBFList(pDX, IDC_VBFLIST2, m_pFilesList);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CFlistDemo, CDialog)
- //{{AFX_MSG_MAP(CFlistDemo)
- ON_WM_DESTROY()
- ON_BN_CLICKED(IDHELP, OnHelp)
- ON_VBXEVENT(VBN_DBLCLICK, IDC_VBFLIST1, OnDblclickVbflist1)
- ON_VBXEVENT(VBN_SELCHANGE, IDC_VBFLIST2, OnSelchangeVbflist2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CFlistDemo message handlers
-
- void CFlistDemo::OnDestroy()
- {
- CDialog::OnDestroy();
-
- ::WinHelp( m_hWnd, "VBXSTD12.HLP", HELP_QUIT, NULL );
-
- }
-
- BOOL CFlistDemo::OnInitDialog()
- {
- // ------------------------------------------------------------
- // To select the current directory, use String Studio functions:
- // 1/ Count the number of slashs in the current directory,
- // 2/ Set the selection on this number,
- // that' s all!
- // ------------------------------------------------------------
-
- CDialog::OnInitDialog();
- m_pDirList->SetSel2( )= 0L;
- m_szDir = m_pDirList->OutValue();
- m_pFilesList->SetSel2( )= 0L;
- m_szFile = m_pFilesList->ListString( 0 );
-
- UpdateData( FALSE );
- if ( !IsHlpHere() )
- GetDlgItem( IDHELP )->EnableWindow( FALSE );
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
-
- void CFlistDemo::OnHelp()
- {
- CString FAR szWinDir, szName, szMsg;
- GetSystemDirectory( szWinDir.GetBuffer(250), 248 );
- szWinDir.ReleaseBuffer();
- if ( szWinDir.GetLength() > 3 )
- szWinDir += "\\";
- szName = szWinDir;
- szName += "VBXSTD12.HLP";
- if ( !IsHlpHere() )
- return;
- ::WinHelp( m_hWnd, szName, HELP_KEY, (long)"VBFList" );
- }
-
- void CFlistDemo::OnDblclickVbflist1(UINT, int, CWnd*, LPVOID)
- {
- m_szDir = (CString)m_pDirList->OutValue();
- m_pFilesList->InValue() = (CString)m_pDirList->OutValue();
- m_pFilesList->SetSel2() = 0L;
- if ( m_pFilesList->ListCount( ) )
- m_szFile = m_pFilesList->ListString( 0 );
- else
- m_szFile = "<None>";
- UpdateData( FALSE );
- }
-
- void CFlistDemo::OnSelchangeVbflist2(UINT, int, CWnd*, LPVOID lp)
- {
- if ( m_pFilesList->ListCount( ) )
- m_szFile = m_pFilesList->ListString( m_pFilesList->EventSelChangeID( lp ) );
- else
- m_szFile = "<None>";
- UpdateData( FALSE );
- }
-