home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / urlpad / fileopen.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  2.2 KB  |  77 lines

  1. //=------------------------------------------------------------------------=
  2. // FileOpen.Cpp
  3. //=------------------------------------------------------------------------=
  4. // Copyright 1992-1996 Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // CModFileDialog implementation
  13. //
  14.  
  15. #include "stdafx.h"
  16. #include "resource.h"
  17. #include "Fileopen.h"
  18.  
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CModFileDialog
  27.  
  28. IMPLEMENT_DYNAMIC(CModFileDialog, CFileDialog)
  29.  
  30. CModFileDialog::CModFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
  31.         DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
  32.         CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
  33. {
  34.             m_urlflag=FALSE;
  35. }
  36.  
  37.  
  38. BEGIN_MESSAGE_MAP(CModFileDialog, CFileDialog)
  39.     //{{AFX_MSG_MAP(CModFileDialog)
  40.     ON_BN_CLICKED(url, Onurl)
  41.     //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43.  
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // OnUrl
  47. // This function enables and disables the various controls on the FileOpen
  48. // Dialog box depending on the type of file to be opened.
  49.  
  50. void CModFileDialog::Onurl() 
  51. {
  52.     m_urlflag=!m_urlflag;
  53.  
  54.     // URL FILE
  55.     if (m_urlflag)
  56.     {
  57.         SetDlgItemText(stc3,"URL");
  58.         SetDlgItemText(edt1,"http://www.microsoft.com/default.htm");
  59.         GetDlgItem(lst1)->EnableWindow(FALSE);
  60.         GetDlgItem(lst2)->EnableWindow(FALSE);
  61.         GetDlgItem(cmb1)->EnableWindow(FALSE);
  62.         GetDlgItem(cmb2)->EnableWindow(FALSE);
  63.         GetDlgItem(psh14)->EnableWindow(FALSE);
  64.     }
  65.     // Ordinary File
  66.     else
  67.     {
  68.         SetDlgItemText(stc3,"FileName");
  69.         SetDlgItemText(edt1,"*.*");
  70.         GetDlgItem(lst1)->EnableWindow(TRUE);
  71.         GetDlgItem(lst2)->EnableWindow(TRUE);
  72.         GetDlgItem(cmb1)->EnableWindow(TRUE);
  73.         GetDlgItem(cmb2)->EnableWindow(TRUE);
  74.         GetDlgItem(psh14)->EnableWindow(TRUE);
  75.     }
  76. }
  77.