Mercurial > vba-clojure
view src/win32/Associate.cpp @ 3:b05d00f19d80
fix some formatting
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:33:11 -0600 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
1 // Associate.cpp : implementation file2 //4 #include "stdafx.h"5 #include "resource.h"6 #include "Associate.h"7 #include "Reg.h"9 /////////////////////////////////////////////////////////////////////////////10 // Associate dialog12 Associate::Associate(CWnd*pParent /*=NULL*/)13 : CDialog(Associate::IDD, pParent)14 {15 //{{AFX_DATA_INIT(Associate)16 m_agb = FALSE;17 m_bin = FALSE;18 m_cgb = FALSE;19 m_gb = FALSE;20 m_gba = FALSE;21 m_gbc = FALSE;22 m_sgb = FALSE;23 //}}AFX_DATA_INIT24 }26 void Associate::DoDataExchange(CDataExchange*pDX)27 {28 CDialog::DoDataExchange(pDX);29 //{{AFX_DATA_MAP(Associate)30 DDX_Check(pDX, IDC_AGB, m_agb);31 DDX_Check(pDX, IDC_BIN, m_bin);32 DDX_Check(pDX, IDC_CGB, m_cgb);33 DDX_Check(pDX, IDC_GB, m_gb);34 DDX_Check(pDX, IDC_GBA, m_gba);35 DDX_Check(pDX, IDC_GBC, m_gbc);36 DDX_Check(pDX, IDC_SGB, m_sgb);37 //}}AFX_DATA_MAP38 }40 BEGIN_MESSAGE_MAP(Associate, CDialog)41 //{{AFX_MSG_MAP(Associate)42 ON_BN_CLICKED(ID_CANCEL, OnCancel)43 ON_BN_CLICKED(ID_OK, OnOk)44 //}}AFX_MSG_MAP45 END_MESSAGE_MAP()47 /////////////////////////////////////////////////////////////////////////////48 // Associate message handlers50 BOOL Associate::OnInitDialog()51 {52 CDialog::OnInitDialog();54 CenterWindow();56 return TRUE; // return TRUE unless you set the focus to a control57 // EXCEPTION: OCX Property Pages should return FALSE58 }60 void Associate::OnCancel()61 {62 EndDialog(FALSE);63 }65 void Associate::OnOk()66 {67 UpdateData();69 int mask = 0;70 if (m_gb)71 mask |= 1;72 if (m_sgb)73 mask |= 2;74 if (m_cgb)75 mask |= 4;76 if (m_gbc)77 mask |= 8;78 if (m_gba)79 mask |= 16;80 if (m_agb)81 mask |= 32;82 if (m_bin)83 mask |= 64;84 if (mask)85 {86 char applicationPath[2048];87 CString commandPath;88 LPCTSTR types[] = { ".gb", ".sgb", ".cgb", ".gbc", ".gba", ".agb", ".bin" };89 GetModuleFileName(NULL, applicationPath, 2048);90 commandPath.Format("\"%s\" \"%%1\"", applicationPath);91 regAssociateType("VisualBoyAdvance.Binary",92 "Binary",93 commandPath);95 for (int i = 0; i < 7; i++)96 {97 if (mask & (1<<i))98 {99 regCreateFileType(types[i], "VisualBoyAdvance.Binary");100 }101 }102 }103 EndDialog(TRUE);104 }