home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Shareware / Programare / skincraft / SkinCrafter_v1.4.12_Demo.msi / _49E29CB9A65AABBF653C1037E1AA74B6 / _43C8F31F5F7440DCAF1E313B49B881CB < prev    next >
Encoding:
Text File  |  2004-06-30  |  4.6 KB  |  199 lines

  1. /******************************************************************
  2. $Archive: $
  3. $Workfile: $
  4. $Author: $
  5. $Date: $
  6. $Revision: $
  7. *******************************************************************/
  8.  
  9. #include "StdAfx.h"
  10. #include "resource.h"
  11. #include "MyPropertyPage1.h"
  12. #include "Controls.h"
  13.  
  14. #ifdef _DEBUG
  15. #undef THIS_FILE
  16. static char BASED_CODE THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19. IMPLEMENT_DYNCREATE(CMyPropertyPage1, CPropertyPage)
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CMyPropertyPage1 property page
  23.  
  24. CMyPropertyPage1::CMyPropertyPage1() : CPropertyPage(CMyPropertyPage1::IDD)
  25. {
  26.     //{{AFX_DATA_INIT(CMyPropertyPage1)
  27.     m_nCombo1 = 0;
  28.     m_nCombo3 = 0;
  29.     m_edit2 = 0;
  30.     //}}AFX_DATA_INIT
  31.     m_psp.dwFlags &= ~PSH_HASHELP;
  32. }
  33.  
  34. CMyPropertyPage1::~CMyPropertyPage1()
  35. {
  36. }
  37.  
  38. void CMyPropertyPage1::DoDataExchange(CDataExchange* pDX)
  39. {
  40.     CPropertyPage::DoDataExchange(pDX);
  41.     //{{AFX_DATA_MAP(CMyPropertyPage1)
  42.     DDX_Control(pDX, IDC_PROGRESS1, m_progress1);
  43.     DDX_Control(pDX, IDC_LIST1, m_listBox);
  44.     DDX_CBIndex(pDX, IDC_COMBO3, m_nCombo3);
  45.     DDX_Text(pDX, IDC_EDIT2, m_edit2);
  46.     //}}AFX_DATA_MAP
  47. }
  48.  
  49. BEGIN_MESSAGE_MAP(CMyPropertyPage1, CPropertyPage)
  50.     //{{AFX_MSG_MAP(CMyPropertyPage1)
  51.     ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
  52.     //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54.  
  55. BOOL CMyPropertyPage1::OnInitDialog()
  56. {
  57.     CPropertyPage::OnInitDialog();
  58.  
  59.     m_listBox.AddString("Hispanic");
  60.     m_listBox.AddString("White");
  61.     m_listBox.AddString("American Indian");
  62.     m_listBox.AddString("Black/African American");
  63.     m_listBox.AddString("Chicano/Mexican American");
  64.     m_listBox.AddString("Asian");
  65.     m_listBox.AddString("Latino");
  66.     m_listBox.AddString("Puerto Rican");
  67.     m_listBox.AddString("Caucasian");
  68.     m_listBox.AddString("Multi-Racial");
  69.     m_listBox.AddString("Other");
  70.  
  71.     m_progress1.SetRange( 0, 100 );
  72.     m_edit2 = 25;
  73.     m_progress1.SetPos( m_edit2 );
  74.  
  75.     UpdateData(FALSE);
  76.  
  77.     return TRUE;
  78. }
  79.  
  80. /*static int __stdcall BrowseProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
  81. {
  82.     switch(uMsg)
  83.     {
  84.     case BFFM_INITIALIZED:
  85.         {
  86.  
  87.             HKEY hk; 
  88.             DWORD dwData; 
  89.  
  90.             if (RegCreateKey(HKEY_LOCAL_MACHINE, 
  91.                     "Software\\SkinCrafter\\SkinCrafter Demo", &hk)) 
  92.                 int err = 1; 
  93.  
  94.             char skinPath[_MAX_PATH] = "";
  95.             RegQueryValueEx(hk,"SkinPath",NULL,NULL,(LPBYTE)skinPath,&dwData);
  96.                 
  97.  
  98.             RegCloseKey(hk);
  99.  
  100.             SHFILEINFO shinfo;
  101.             DWORD dw = SHGetFileInfo( skinPath, NULL,
  102.                            &shinfo,
  103.                            sizeof(shinfo),
  104.                            SHGFI_DISPLAYNAME );
  105.             if(dw == 0 || skinPath[0] == 0)
  106.                 strcpy(skinPath,theApp.m_ExePath.GetBuffer(theApp.m_ExePath.GetLength()));
  107.  
  108.             SendMessage(hWnd,BFFM_SETSELECTION,TRUE,(LPARAM)skinPath);
  109.             theApp.m_ExePath.ReleaseBuffer();
  110.             break;
  111.         }
  112.     default:
  113.         break;
  114.     }
  115.     return 0;
  116. }*/
  117.  
  118. /*void CMyPropertyPage1::OnButton2()
  119. {
  120.     BROWSEINFO bi;
  121.     char foldername[MAX_PATH];
  122.     ZeroMemory(&bi,sizeof(bi));
  123.     bi.pszDisplayName=foldername;
  124.     bi.hwndOwner=m_hWnd;
  125.     bi.lpfn=(BFFCALLBACK)BrowseProc;
  126.  
  127.     CString title("Select Skin Directory");
  128.     bi.lpszTitle=title;
  129.     
  130.     bi.ulFlags=BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
  131.     LPITEMIDLIST lpid= SHBrowseForFolder(&bi);
  132.     if(lpid)
  133.     {    IMalloc* pMalloc;
  134.         SHGetPathFromIDList(lpid,foldername);
  135.         SHGetMalloc(&pMalloc);
  136.         pMalloc->Free((void*) lpid);
  137.         pMalloc->Release();
  138.         CEdit * m_folder=(CEdit*)GetDlgItem(IDC_EDIT_SKIN);
  139.         m_folder->SetWindowText(foldername);
  140.         m_strSkinDir.Format("%s",foldername);
  141.     }
  142.     FillSkinCombo();
  143. }*/
  144.  
  145. /*void CMyPropertyPage1::FillSkinCombo()
  146. {
  147.     CFileFind findFile;
  148.     m_strSkinDir+="\\*.skf";
  149.     BOOL bWorking(findFile.FindFile(m_strSkinDir));
  150.     ((CComboBox*)GetDlgItem(IDC_COMBO_SKIN))->ResetContent();
  151.     int count = 0;
  152.     m_comboMap.RemoveAll();
  153.     while (bWorking)
  154.     {
  155.         bWorking = findFile.FindNextFile();
  156.         if (findFile.IsDots() || findFile.IsDirectory())// skip . and .. files; otherwise, we'd recur infinitely!
  157.             continue;
  158.         
  159.         CString filepath= findFile.GetFilePath();
  160.         CString filename = findFile.GetFileName();
  161.         BSTR a, n, e, d;
  162.         theApp.m_pSkin.GetSkinCopyRight(filepath,&n,&a,&d,&e);
  163.  
  164.         CString key;
  165.         key.Format("%d",count);
  166.         m_comboMap.SetAt(key,filepath);
  167.  
  168.         if(a)
  169.             SysFreeString(a);
  170.         if(d)
  171.             SysFreeString(d);
  172.         if(e)
  173.             SysFreeString(e);
  174.  
  175.         if(n)
  176.         {
  177.             CString name(n);
  178.             SysFreeString(n);
  179.             ((CComboBox*)GetDlgItem(IDC_COMBO_SKIN))->InsertString(count,name);
  180.         }
  181.         else
  182.             ((CComboBox*)GetDlgItem(IDC_COMBO_SKIN))->InsertString(count,filename);
  183.         count++;
  184.     }
  185.     findFile.Close();
  186.  
  187. }*/
  188.  
  189.  
  190. void CMyPropertyPage1::OnChangeEdit2() 
  191. {
  192.     if (m_edit2!=0)
  193.     {
  194.         UpdateData(TRUE);
  195.         m_progress1.SetPos( m_edit2 );
  196.         UpdateData(FALSE);
  197.     }
  198. }
  199.