OSDN Git Service

・ MBCS->Unicode対応
authorseraphy <seraphy@seraphyware.com>
Sat, 15 Aug 2015 03:06:14 +0000 (12:06 +0900)
committerseraphy <seraphy@seraphyware.com>
Sun, 16 Aug 2015 15:01:41 +0000 (00:01 +0900)
・ ポインタの64ビット化対応
・ スクリーンサイズの調整(Luna以降)

52 files changed:
.gitignore
CComEnumDynaVARIANT.h [new file with mode: 0644]
CommDialog.cpp
CommDialog.h
Control.cpp
Control.h
Draw.cpp
Draw.h
Event.cpp
Event.h
Form.cpp
Form.h
Instance.cpp
Instance.h
Layer.cpp
Layer.h
ObjectMap.cpp
ObjectMap.h
ObjectVector.cpp
ObjectVector.h
OverlappedWindow.cpp
OverlappedWindow.h
PrivateProfile.cpp
PrivateProfile.h
ProfileSection.cpp
ProfileSection.h
SeraphyScriptTools.cpp
SeraphyScriptTools.h
SeraphyScriptTools.idl
SeraphyScriptTools.rc
SeraphyScriptTools.sln
SeraphyScriptTools.vcxproj
SeraphyScriptTools.vcxproj.filters
SeraphyScriptToolsCP.h
Shell.cpp
Shell.h
StdAfx.h
TestScript/class2.vbs
TestScript/clip1.vbs
TestScript/draw1.vbs
TestScript/form1.vbs
TestScript/form2.vbs
TestScript/frame1.vbs
TestScript/key.vbs
TestScript/pro1.vbs
TestScript/pro3err.vbs [new file with mode: 0644]
TestScript/tree_list.vbs
TreeItem.cpp
TreeItem.h
generic.cpp
generic.h
resource.h

index 408e84e..fc92797 100644 (file)
@@ -1,9 +1,9 @@
 /Debug
 /ipch
-/MBCS Debug
-/MBCS Release
-/Unicode Debug
-/Unicode Release
+/MBCSDebug
+/MBCSRelease
+/UnicodeDebug
+/UnicodeRelease
 /x64
 SeraphyScriptTools.sdf
 dlldata.c
@@ -13,4 +13,5 @@ SeraphyScriptTools_p.c
 SeraphyScriptTools.vcxproj.user
 SeraphyScriptTools.v12.suo
 SeraphyScriptTools.opensdf
+SeraphyScriptTools.aps
 help/seraphyscripttools.chm
diff --git a/CComEnumDynaVARIANT.h b/CComEnumDynaVARIANT.h
new file mode 100644 (file)
index 0000000..0adda8f
--- /dev/null
@@ -0,0 +1,108 @@
+#pragma once
+
+#include <atlbase.h>
+#include <atlcom.h>
+
+// \92l\82ð\83R\83s\81[\82·\82é\83o\83\8a\83A\83\93\83g\97ñ\8b\93\8c^
+typedef CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > CComEnumVARIANT;
+
+// \93®\93I\82È\83o\83\8a\83A\83\93\83g\97ñ\8b\93\8c^
+template <class T>
+class CComEnumDynaVARIANT :public IEnumVARIANT, public CComObjectRootEx<CComSingleThreadModel>
+{
+public:
+       BEGIN_COM_MAP(CComEnumDynaVARIANT)
+               COM_INTERFACE_ENTRY(IEnumVARIANT)
+               COM_INTERFACE_ENTRY(IUnknown)
+       END_COM_MAP()
+
+       CComEnumDynaVARIANT()
+       {
+               m_current = 0;
+               m_pObj = NULL;
+       }
+       STDMETHODIMP Next(unsigned long celt, VARIANT FAR* rgvar, unsigned long FAR* pceltFetched);
+       STDMETHODIMP Skip(unsigned long celt);
+       STDMETHODIMP Reset();
+       STDMETHODIMP Clone(IEnumVARIANT FAR* FAR* ppenum);
+       void FinalRelease()
+       {
+               if (m_pObj) {
+                       m_pObj->Release();
+                       m_pObj = NULL;
+               }
+               ATLTRACE("CComEnumDynaVARINAT::FinalRelease\r\n");
+       }
+       void Init(T* pObj, unsigned long current)
+       {
+               m_current = current;
+               m_pObj = pObj;
+               if (m_pObj) {
+                       m_pObj->AddRef();
+               }
+       }
+protected:
+       unsigned long m_current;
+       T* m_pObj;
+};
+
+template<class T>
+STDMETHODIMP CComEnumDynaVARIANT<T>::Next(unsigned long celt, VARIANT FAR* rgvar, unsigned long FAR* pceltFetched)
+{
+       // \96ß\82·\94z\97ñ\82Ì\92l\82ð\8f\89\8aú\89»
+       if (!m_pObj) {
+               return S_FALSE;
+       }
+
+       for (unsigned long i = 0; i < celt; i++) {
+               ::VariantInit(&rgvar[i]);
+       }
+
+       unsigned long cnt = 0;
+       unsigned long mx = 0;
+       m_pObj->get_Count((long*)&mx);
+       while (cnt < celt  && m_current < mx) {
+               CComVariant varIdx((long)m_current);
+               m_pObj->get_Value(varIdx, &rgvar[cnt]);
+               m_current++;
+               celt--;
+               cnt++;
+       }
+
+       // \8eÀ\8dÛ\82É\8f\91\82«\96ß\82µ\82½\92l\82ð\8f\89\8aú\89»\82·\82é
+       if (pceltFetched) {
+               *pceltFetched = cnt;
+       }
+       return (celt > cnt) ? S_FALSE : S_OK;
+}
+
+template<class T>
+STDMETHODIMP CComEnumDynaVARIANT<T>::Skip(unsigned long celt)
+{
+       if (m_pObj) {
+               unsigned long mx = 0;
+               m_pObj->get_Count((long*)&mx);
+               if (m_current + celt < mx) {
+                       m_current += celt;
+                       return S_OK;
+               }
+       }
+       return S_FALSE;
+}
+
+template<class T>
+STDMETHODIMP CComEnumDynaVARIANT<T>::Reset()
+{
+       m_current = 0;
+       return S_OK;
+}
+
+template<class T>
+STDMETHODIMP CComEnumDynaVARIANT<T>::Clone(IEnumVARIANT FAR* FAR* ppenum)
+{
+       CComObject< CComEnumDynaVARIANT<T> >* pClone = NULL;
+       pClone->CreateInstance(&pClone);
+       pClone->Init(m_pObj, m_current);
+       pClone->QueryInterface(IID_IEnumVARIANT, (void**)ppenum);
+       return S_OK;
+}
index 391a645..896a8a9 100644 (file)
@@ -18,7 +18,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
        ATL::CString szPathName;
        {
                CComVariant path;
-               if (path.ChangeType(VT_BSTR, &varPathName) == S_OK) {
+               if (SUCCEEDED(path.ChangeType(VT_BSTR, &varPathName))) {
                        // \83t\83@\83C\83\8b\96¼\82Ì\8eæ\82è\8fo\82µ
                        szPathName = path.bstrVal;
                }
@@ -27,9 +27,9 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
        ATL::CString szFilter;
        {
                CComVariant filter;
-               if (filter.ChangeType(VT_BSTR, &varFilter) == S_OK) {
+               if (SUCCEEDED(filter.ChangeType(VT_BSTR, &varFilter))) {
                        // \83t\83B\83\8b\83^\8ew\92è\82ª\82 \82é
-                       szFilter = varFilter.bstrVal;
+                       szFilter = filter.bstrVal;
                }
        }
 
@@ -54,7 +54,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
                }
                pExt = szDefExtention.GetBuffer();
                while (*pExt) {
-                       if (*pExt == ';'){
+                       if (*pExt == ';') {
                                *pExt = 0; // \8dÅ\8f\89\82Ì\8ag\92£\8eq\82Å\8fI\97¹\82³\82¹\82é
                                break;
                        }
@@ -65,7 +65,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
        ATL::CString szInitialDir;
        if (m_bstr_InitialDir.length() > 0) {
                // \8f\89\8aú\83f\83B\83\8c\83N\83g\83\8a
-               szInitialDir = (LPCWSTR) m_bstr_InitialDir;
+               szInitialDir = (LPCWSTR)m_bstr_InitialDir;
        }
 
        ATL::CString strFile(szPathName);
@@ -75,17 +75,17 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
        OPENFILENAME ofn = {0};
        ofn.lStructSize = sizeof(OPENFILENAME);
        ofn.lpstrFilter = szFilter;
-       ofn.lpstrFile   = pStrFileBuf;
-       ofn.nMaxFile    = MAXBUFSIZ;
+       ofn.lpstrFile = pStrFileBuf;
+       ofn.nMaxFile = MAXBUFSIZ;
        ofn.lpstrDefExt = szDefExtention;
-       ofn.Flags       = flag;
-       ofn.hwndOwner   = GetMainWindow();
+       ofn.Flags = flag;
+       ofn.hwndOwner = GetMainWindow();
 
        if (!szInitialDir.IsEmpty()) {
                ofn.lpstrInitialDir = szInitialDir;
        }
 
-       if(m_bNoDereferenceLinks){
+       if (m_bNoDereferenceLinks) {
                // \83V\83\87\81[\83g\83J\83b\83g\82ð\81A\82»\82Ì\82Ü\82Ü\8eæ\82é\81B
                ofn.Flags |= OFN_NODEREFERENCELINKS;
        }
@@ -96,7 +96,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
                // \8aJ\82­\83_\83C\83A\83\8d\83O
                ofn.Flags |= (m_bReadonly) ? OFN_READONLY : 0;
                if (m_bstr_OpenFileCaption.length() > 0) {
-                       szCaption = (LPCWSTR) m_bstr_OpenFileCaption;
+                       szCaption = (LPCWSTR)m_bstr_OpenFileCaption;
                        ofn.lpstrTitle = szCaption;
                }
                result = GetOpenFileName(&ofn);
@@ -104,10 +104,10 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
                        m_bReadonly = (ofn.Flags & OFN_READONLY) ? true : false;
                }
        }
-       else{
+       else {
                // \95Û\91\83_\83C\83A\83\8d\83O
                if (m_bstr_SaveFileCaption.length() > 0) {
-                       szCaption = (LPCWSTR) m_bstr_SaveFileCaption;
+                       szCaption = (LPCWSTR)m_bstr_SaveFileCaption;
                        ofn.lpstrTitle = szCaption;
                }
                result = GetSaveFileName(&ofn);
@@ -120,7 +120,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
                        retpath = ofn.lpstrFile;
                        retpath.Detach(pvarReturn);
                }
-               else{
+               else {
                        // \95¡\90\94\83t\83@\83C\83\8b\91I\91ð(\83_\83u\83\8b\83k\83\8b\8fI\92[)
                        // \95Ô\82³\82ê\82½\83t\83@\83C\83\8b\90\94\82ð\8cv\90\94\82·\82é
                        int cnt = 0;
@@ -150,7 +150,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
                                // \96\96\94ö\82ª\83t\83H\83\8b\83_\83v\83\8c\83C\83X\82ª\8fI\82í\82Á\82Ä\82È\82¯\82ê\82Î\92Ç\89Á\82·\82é
                                LPCWSTR wp = dirname;
                                while (*wp) wp++;
-                               if (wp - 1 > (LPCWSTR) dirname && *(wp - 1) != '\\') {
+                               if (wp - 1 > (LPCWSTR)dirname && *(wp - 1) != '\\') {
                                        dirname += L"\\";
                                }
 
@@ -160,8 +160,8 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
                                while (*p) {
                                        _bstr_t name = p;
                                        _bstr_t path = dirname + name;
-                                       
-                                       CComVariant tmp((LPCWSTR) path);
+
+                                       CComVariant tmp((LPCWSTR)path);
                                        SafeArrayPutElement(pArray, &indx, &tmp);
                                        while (*p++);
                                        indx++;
@@ -170,7 +170,7 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
 
                        // SAFEARRAY\82ª\8dì\90¬\82³\82ê\82Ä\82¢\82ê\82Î
                        if (pArray) {
-                               pvarReturn->vt     = VT_ARRAY | VT_VARIANT;
+                               pvarReturn->vt = VT_ARRAY | VT_VARIANT;
                                pvarReturn->parray = pArray;
                        }
                }// Single or Multi
@@ -180,26 +180,26 @@ void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIA
 /////////////////////////////////
 // \83C\83\93\83^\81[\83t\83F\83C\83X\95\94
 
-STDMETHODIMP CCommDialog::OpenFileDialog(VARIANT varPathName,VARIANT varFilter,VARIANT* pvarReturn)
+STDMETHODIMP CCommDialog::OpenFileDialog(VARIANT varPathName, VARIANT varFilter, VARIANT* pvarReturn)
 {
-       DWORD flags =   (m_bEnableCreatePrompt ? OFN_CREATEPROMPT : OFN_FILEMUSTEXIST)
-                                 +     (m_bEnableReadonly     ? 0                : OFN_HIDEREADONLY );
-       CommFileDialog(pvarReturn,varPathName,varFilter,true,flags|OFN_ENABLESIZING);
+       DWORD flags = (m_bEnableCreatePrompt ? OFN_CREATEPROMPT : OFN_FILEMUSTEXIST)
+               + (m_bEnableReadonly ? 0 : OFN_HIDEREADONLY);
+       CommFileDialog(pvarReturn, varPathName, varFilter, true, flags | OFN_ENABLESIZING);
        return S_OK;
 }
 
 STDMETHODIMP CCommDialog::SaveFileDialog(VARIANT varPathName, VARIANT varFilter, VARIANT* pvarReturn)
 {
-       CommFileDialog(pvarReturn,varPathName,varFilter,false,OFN_ENABLESIZING|OFN_OVERWRITEPROMPT);
+       CommFileDialog(pvarReturn, varPathName, varFilter, false, OFN_ENABLESIZING | OFN_OVERWRITEPROMPT);
        return S_OK;
 }
 
 
-STDMETHODIMP CCommDialog::MultiOpenFileDialog(VARIANT varMulti,VARIANT varFilter,VARIANT* pvarReturn)
+STDMETHODIMP CCommDialog::MultiOpenFileDialog(VARIANT varMulti, VARIANT varFilter, VARIANT* pvarReturn)
 {
-       DWORD flags =   (m_bEnableCreatePrompt ? OFN_CREATEPROMPT : OFN_FILEMUSTEXIST)
-                                 +     (m_bEnableReadonly     ? 0                : OFN_HIDEREADONLY );
-       CommFileDialog(pvarReturn,varMulti,varFilter,true,flags|OFN_ALLOWMULTISELECT|OFN_EXPLORER|OFN_ENABLESIZING);
+       DWORD flags = (m_bEnableCreatePrompt ? OFN_CREATEPROMPT : OFN_FILEMUSTEXIST)
+               + (m_bEnableReadonly ? 0 : OFN_HIDEREADONLY);
+       CommFileDialog(pvarReturn, varMulti, varFilter, true, flags | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_ENABLESIZING);
        return S_OK;
 }
 
@@ -229,7 +229,7 @@ STDMETHODIMP CCommDialog::put_SaveFileCaption(BSTR newVal)
 
 STDMETHODIMP CCommDialog::get_EnableCreatePrompt(BOOL *pVal)
 {
-       *pVal = m_bEnableCreatePrompt?VB_TRUE:VB_FALSE;
+       *pVal = m_bEnableCreatePrompt ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -241,7 +241,7 @@ STDMETHODIMP CCommDialog::put_EnableCreatePrompt(BOOL newVal)
 
 STDMETHODIMP CCommDialog::get_EnableReadOnly(BOOL *pVal)
 {
-       *pVal = m_bEnableReadonly?VB_TRUE:VB_FALSE;
+       *pVal = m_bEnableReadonly ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -253,7 +253,7 @@ STDMETHODIMP CCommDialog::put_EnableReadOnly(BOOL newVal)
 
 STDMETHODIMP CCommDialog::get_ReadOnly(BOOL *pVal)
 {
-       *pVal = m_bReadonly?VB_TRUE:VB_FALSE;
+       *pVal = m_bReadonly ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -296,7 +296,7 @@ STDMETHODIMP CCommDialog::get_HWND(long *pVal)
 STDMETHODIMP CCommDialog::put_HWND(long newVal)
 {
        m_hStaticMainWindow = (HWND)newVal;
-       if(m_pMainWindow){
+       if (m_pMainWindow) {
                m_pMainWindow->Release();
                m_pMainWindow = NULL;
        }
@@ -321,12 +321,12 @@ STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption, VARIANT varDir, VA
 
        // \83L\83\83\83v\83V\83\87\83\93\82Ì\90Ý\92è
        CComVariant caption;
-       if(varCaption.vt != VT_ERROR && varCaption.vt != VT_NULL && varCaption.vt != VT_EMPTY &&
-               caption.ChangeType(VT_BSTR, &varCaption) == S_OK) {
+       if (varCaption.vt != VT_ERROR && varCaption.vt != VT_NULL && varCaption.vt != VT_EMPTY &&
+               SUCCEEDED(caption.ChangeType(VT_BSTR, &varCaption))) {
                put_BrowseForFolderCaption(caption.bstrVal);
        }
 
-       BROWSEINFO binfo = { 0 };
+       BROWSEINFO binfo = {0};
        binfo.hwndOwner = GetMainWindow();
 
        ATL::CString szTitle;
@@ -340,7 +340,7 @@ STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption, VARIANT varDir, VA
        ATL::CString szDirName;
        {
                CComVariant path;
-               if (path.ChangeType(VT_BSTR, &varDir) == S_OK){
+               if (SUCCEEDED(path.ChangeType(VT_BSTR, &varDir))) {
                        // \83t\83@\83C\83\8b\96¼\82Ì\8eæ\82è\8fo\82µ
                        szDirName = path.bstrVal;
                }
@@ -349,33 +349,32 @@ STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption, VARIANT varDir, VA
 
        int mode = 0;
        CComVariant varTmp;
-       if(varTmp.ChangeType(VT_I4,&varMode) == S_OK){
+       if (SUCCEEDED(varTmp.ChangeType(VT_I4, &varMode))) {
                mode = varTmp.lVal;
        }
 
        binfo.ulFlags = 0;//BIF_NEWDIALOGSTYLE; // BIF_USENEWUI
-       switch(mode & 0x0f)
-       {
-       case 0:
-       default:
+       switch (mode & 0x0f) {
+               case 0:
+               default:
                binfo.ulFlags |= BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
-               binfo.lpfn           = BrowseCallbackProc;
-               binfo.lParam         = (LPARAM)(LPCTSTR)szDirName;
+               binfo.lpfn = BrowseCallbackProc;
+               binfo.lParam = (LPARAM)(LPCTSTR)szDirName;
                break;
-       
-       case 1:
+
+               case 1:
                binfo.ulFlags |= BIF_BROWSEFORCOMPUTER;
                break;
-       
-       case 2:
+
+               case 2:
                binfo.ulFlags |= BIF_BROWSEFORPRINTER;
                break;
-       
-       case 3:
+
+               case 3:
                binfo.ulFlags |= BIF_RETURNFSANCESTORS;
                break;
        }
-       
+
        if (mode & 0x10) {
                binfo.ulFlags |= BIF_BROWSEINCLUDEFILES;
        }
@@ -410,19 +409,18 @@ STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption, VARIANT varDir, VA
 
 int CALLBACK CCommDialog::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
 {
-       switch(uMsg)
-       {
-       case BFFM_INITIALIZED:
-               SendMessage(hwnd,BFFM_SETSELECTION,true,lpData);
+       switch (uMsg) {
+               case BFFM_INITIALIZED:
+               SendMessage(hwnd, BFFM_SETSELECTION, true, lpData);
                break;
-       case BFFM_SELCHANGED:
+               case BFFM_SELCHANGED:
                {
                        TCHAR szBuf[MAX_PATH];
-                       BOOL bResult = SHGetPathFromIDList((LPITEMIDLIST)lParam,szBuf);
-                       SendMessage(hwnd,BFFM_ENABLEOK,0,bResult);
+                       BOOL bResult = SHGetPathFromIDList((LPITEMIDLIST)lParam, szBuf);
+                       SendMessage(hwnd, BFFM_ENABLEOK, 0, bResult);
                }
                break;
-       case BFFM_VALIDATEFAILED:
+               case BFFM_VALIDATEFAILED:
                break;
        }
        return 0;
@@ -431,7 +429,7 @@ int CALLBACK CCommDialog::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam
 HWND CCommDialog::GetMainWindow()
 {
        HWND hWnd = m_hStaticMainWindow;
-       if(m_pMainWindow){
+       if (m_pMainWindow) {
                m_pMainWindow->get_HWND((long*)&hWnd);
        }
        return hWnd;
@@ -440,16 +438,14 @@ HWND CCommDialog::GetMainWindow()
 STDMETHODIMP CCommDialog::SetMainWindow(VARIANT varUnk)
 {
        // \8aù\91\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\89ð\95ú
-       if(m_pMainWindow){
+       if (m_pMainWindow) {
                m_pMainWindow->Release();
                m_pMainWindow = NULL;
        }
        // \83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8eæ\93¾
        CComVariant tmp;
-       if(tmp.ChangeType(VT_UNKNOWN,&varUnk) == S_OK){
-               if(tmp.punkVal->QueryInterface(IID_IOverlappedWindow,(void**)&m_pMainWindow) == S_OK){
-                       return S_OK;
-               }
+       if (SUCCEEDED(tmp.ChangeType(VT_UNKNOWN, &varUnk))) {
+               return tmp.punkVal->QueryInterface(IID_IOverlappedWindow, (void**)&m_pMainWindow);
        }
        return DISP_E_UNKNOWNINTERFACE;
 }
@@ -460,85 +456,82 @@ STDMETHODIMP CCommDialog::MessageBox(VARIANT mes, VARIANT typ, VARIANT icon, VAR
 
        ATL::CString msg;
        CComVariant varMes;
-       if (varMes.ChangeType(VT_BSTR,&mes) == S_OK) {
-               msg = mes.bstrVal;
+       if (SUCCEEDED(varMes.ChangeType(VT_BSTR, &mes))) {
+               msg = varMes.bstrVal;
        }
 
        UINT mode = MB_OK;
-       CComVariant varType,varIcon;
-       if (varType.ChangeType(VT_I2, &typ) == S_OK) {
+       CComVariant varType, varIcon;
+       if (SUCCEEDED(varType.ChangeType(VT_I2, &typ))) {
                if (varType.iVal / 10) {
                        mode = MB_DEFBUTTON2;
                }
 
-               switch(varType.iVal % 10)
-               {
-               case 0:
-               default:
+               switch (varType.iVal % 10) {
+                       case 0:
+                       default:
                        mode |= MB_OK;
                        break;
 
-               case 1:
+                       case 1:
                        mode |= MB_OKCANCEL;
                        break;
 
-               case 2:
+                       case 2:
                        mode |= MB_YESNO;
                        break;
 
-               case 3:
+                       case 3:
                        mode |= MB_YESNOCANCEL;
                        break;
 
-               case 4:
+                       case 4:
                        mode |= MB_RETRYCANCEL;
                        break;
 
-               case 5:
+                       case 5:
                        mode |= MB_ABORTRETRYIGNORE;
                        break;
                }
        }
 
-       if (varIcon.ChangeType(VT_I2,&icon) == S_OK) {
-               switch(varIcon.iVal)
-               {
-               case 0:
-               default:
+       if (SUCCEEDED(varIcon.ChangeType(VT_I2, &icon))) {
+               switch (varIcon.iVal) {
+                       case 0:
+                       default:
                        break;
 
-               case 1:
+                       case 1:
                        mode |= MB_ICONERROR;
                        break;
 
-               case 2:
+                       case 2:
                        mode |= MB_ICONWARNING;
                        break;
 
-               case 3:
+                       case 3:
                        mode |= MB_ICONINFORMATION;
                        break;
 
-               case 4:
+                       case 4:
                        mode |= MB_ICONQUESTION;
                        break;
                }
        }
 
-       int md = ::MessageBox(GetMainWindow(), msg, GetMainCaption(),mode);
-       switch(md)
-       {
-       case IDOK:
-       case IDYES:
-       case IDRETRY:
+       int md = ::MessageBox(GetMainWindow(), msg, GetMainCaption(), mode);
+       switch (md) {
+               case IDOK:
+               case IDYES:
+               case IDRETRY:
                ret = (short)1;
                break;
-       case IDCANCEL:
-       case IDABORT:
+               case IDCANCEL:
+               case IDABORT:
                ret = (short)-1;
                break;
-       case IDNO:
-       case IDIGNORE:
+               case IDNO:
+               case IDIGNORE:
                ret = (short)0;
                break;
        }
@@ -575,8 +568,8 @@ STDMETHODIMP CCommDialog::ColorDialog(VARIANT *pcolorVal)
 {
        ::VariantInit(pcolorVal);
        m_color.hwndOwner = GetMainWindow();
-       if(ChooseColor(&m_color)){
-               pcolorVal->vt   = VT_I4;
+       if (ChooseColor(&m_color)) {
+               pcolorVal->vt = VT_I4;
                pcolorVal->lVal = (long)m_color.rgbResult;
        }
        return S_OK;
index a1f3b75..7c18657 100644 (file)
@@ -1,8 +1,7 @@
-       
+
 // CommDialog.h : Declaration of the CCommDialog
 
-#ifndef __COMMDIALOG_H_
-#define __COMMDIALOG_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include <atlctl.h>
@@ -10,7 +9,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 // CCommDialog
-class ATL_NO_VTABLE CCommDialog : 
+class ATL_NO_VTABLE CCommDialog :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CStockPropImpl<CCommDialog, ICommDialog, &IID_ICommDialog, &LIBID_SERAPHYSCRIPTTOOLSLib>,
        public CComControl<CCommDialog>,
@@ -36,75 +35,75 @@ public:
                m_pUnkMarshaler = NULL;
                // \83J\83\89\81[\8d\\91¢\91Ì
                int i;
-               for(i=0;i<16;i++){
+               for (i = 0; i < 16; i++) {
                        m_colors[i] = COLORREF(0xC0C0C0);
                }
-               ZeroMemory(&m_color,sizeof(CHOOSECOLOR));
-               m_color.lStructSize  = sizeof(CHOOSECOLOR);
+               ZeroMemory(&m_color, sizeof(CHOOSECOLOR));
+               m_color.lStructSize = sizeof(CHOOSECOLOR);
                m_color.lpCustColors = m_colors;
-               m_color.Flags        = CC_FULLOPEN | CC_SOLIDCOLOR;
+               m_color.Flags = CC_FULLOPEN | CC_SOLIDCOLOR;
                //
                m_bEnableCreatePrompt = false;
-               m_bEnableReadonly         = false;
-               m_bReadonly                       = false;
+               m_bEnableReadonly = false;
+               m_bReadonly = false;
                m_bNoDereferenceLinks = false;
-               m_hStaticMainWindow   = NULL;  // \83C\83\93\83^\81[\83t\83F\83C\83X\82æ\82è\97D\90æ\82µ\82Ä\8eg\97p\82³\82ê\82é
+               m_hStaticMainWindow = NULL;  // \83C\83\93\83^\81[\83t\83F\83C\83X\82æ\82è\97D\90æ\82µ\82Ä\8eg\97p\82³\82ê\82é
                // \83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8f\89\8aú\89»
                m_pMainWindow = NULL;
        }
 
-DECLARE_GET_CONTROLLING_UNKNOWN()
-DECLARE_REGISTRY_RESOURCEID(IDR_COMMDIALOG)
-
-DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-BEGIN_COM_MAP(CCommDialog)
-       COM_INTERFACE_ENTRY(ICommDialog)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(IViewObjectEx)
-       COM_INTERFACE_ENTRY(IViewObject2)
-       COM_INTERFACE_ENTRY(IViewObject)
-       COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceObject)
-       COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
-       COM_INTERFACE_ENTRY(IOleControl)
-       COM_INTERFACE_ENTRY(IOleObject)
-       COM_INTERFACE_ENTRY(IPersistStreamInit)
-       COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-       COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
-       COM_INTERFACE_ENTRY(IQuickActivate)
-       COM_INTERFACE_ENTRY(IPersistStorage)
-       COM_INTERFACE_ENTRY(IDataObject)
-       COM_INTERFACE_ENTRY(IProvideClassInfo)
-       COM_INTERFACE_ENTRY(IProvideClassInfo2)
-       COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
-       COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
-END_COM_MAP()
-
-BEGIN_PROP_MAP(CCommDialog)
-       PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
-       PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
-       PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
-       // Example entries
-       // PROP_ENTRY("Property Description", dispid, clsid)
-       // PROP_PAGE(CLSID_StockColorPage)
-END_PROP_MAP()
-
-BEGIN_CONNECTION_POINT_MAP(CCommDialog)
-       CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
-END_CONNECTION_POINT_MAP()
-
-BEGIN_MSG_MAP(CCommDialog)
-       CHAIN_MSG_MAP(CComControl<CCommDialog>)
-       DEFAULT_REFLECTION_HANDLER()
-END_MSG_MAP()
-// Handler prototypes:
-//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
-//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
+       DECLARE_GET_CONTROLLING_UNKNOWN()
+       DECLARE_REGISTRY_RESOURCEID(IDR_COMMDIALOG)
+
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+       BEGIN_COM_MAP(CCommDialog)
+               COM_INTERFACE_ENTRY(ICommDialog)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(IViewObjectEx)
+               COM_INTERFACE_ENTRY(IViewObject2)
+               COM_INTERFACE_ENTRY(IViewObject)
+               COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
+               COM_INTERFACE_ENTRY(IOleInPlaceObject)
+               COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
+               COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
+               COM_INTERFACE_ENTRY(IOleControl)
+               COM_INTERFACE_ENTRY(IOleObject)
+               COM_INTERFACE_ENTRY(IPersistStreamInit)
+               COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+               COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
+               COM_INTERFACE_ENTRY(IQuickActivate)
+               COM_INTERFACE_ENTRY(IPersistStorage)
+               COM_INTERFACE_ENTRY(IDataObject)
+               COM_INTERFACE_ENTRY(IProvideClassInfo)
+               COM_INTERFACE_ENTRY(IProvideClassInfo2)
+               COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
+               COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
+       END_COM_MAP()
+
+       BEGIN_PROP_MAP(CCommDialog)
+               PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
+               PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
+               PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
+               // Example entries
+               // PROP_ENTRY("Property Description", dispid, clsid)
+               // PROP_PAGE(CLSID_StockColorPage)
+       END_PROP_MAP()
+
+       BEGIN_CONNECTION_POINT_MAP(CCommDialog)
+               CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
+       END_CONNECTION_POINT_MAP()
+
+       BEGIN_MSG_MAP(CCommDialog)
+               CHAIN_MSG_MAP(CComControl<CCommDialog>)
+               DEFAULT_REFLECTION_HANDLER()
+       END_MSG_MAP()
+       // Handler prototypes:
+       //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+       //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+       //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
 
 
 
@@ -118,7 +117,7 @@ END_MSG_MAP()
        {
                ATLTRACE("CommonDialog::FinalRelease\r\n");
                // \83\81\83C\83\93\83E\83B\83\93\83h\83E\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\89ð\95ú
-               if(m_pMainWindow){
+               if (m_pMainWindow) {
                        m_pMainWindow->Release();
                        m_pMainWindow = NULL;
                }
@@ -127,25 +126,24 @@ END_MSG_MAP()
 
        CComPtr<IUnknown> m_pUnkMarshaler;
 
-// ISupportsErrorInfo
+       // ISupportsErrorInfo
        STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
        {
-               static const IID* arr[] = 
+               static const IID* arr[] =
                {
                        &IID_ICommDialog,
                };
-               for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
-               {
+               for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) {
                        if (IsEqualGUID(*arr[i], riid))
                                return S_OK;
                }
                return S_FALSE;
        }
 
-// IViewObjectEx
+       // IViewObjectEx
        DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
 
-       static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData );
+       static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
        _bstr_t m_bstr_BrowseForFolderCaption;
        STDMETHOD(get_BrowseForFolderCaption)(/*[out, retval]*/ BSTR *pVal);
        STDMETHOD(put_BrowseForFolderCaption)(/*[in]*/ BSTR newVal);
@@ -176,21 +174,21 @@ END_MSG_MAP()
        STDMETHOD(SaveFileDialog)(/*[in,optional]*/VARIANT varPathName,/*[in,optional]*/VARIANT varFilter,/*[out,retval]*/VARIANT* pvarReturn);
        STDMETHOD(OpenFileDialog)(/*[in,optional]*/VARIANT varPathName,/*[in,optional]*/VARIANT varFilter,/*[out,retval]*/VARIANT* pvarReturn);
        STDMETHOD(MultiOpenFileDialog)(/*[in,optional]*/VARIANT varMulti,/*[in,optional]*/VARIANT varFilter,/*[out,retval]*/VARIANT* pvarResult);
-       void CommFileDialog(VARIANT* pvarResult,VARIANT varPathName,VARIANT varFilter,BOOL bMode,DWORD flags);
+       void CommFileDialog(VARIANT* pvarResult, VARIANT varPathName, VARIANT varFilter, BOOL bMode, DWORD flags);
 
-// ICommDialog
+       // ICommDialog
 public:
        HRESULT OnDraw(ATL_DRAWINFO& di)
        {
                RECT& rc = *(RECT*)di.prcBounds;
                Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
 
-               SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
+               SetTextAlign(di.hdcDraw, TA_CENTER | TA_BASELINE);
                LPCTSTR pszText = _T("ATL 3.0 : CommDialog");
-               TextOut(di.hdcDraw, 
-                       (rc.left + rc.right) / 2, 
-                       (rc.top + rc.bottom) / 2, 
-                       pszText, 
+               TextOut(di.hdcDraw,
+                       (rc.left + rc.right) / 2,
+                       (rc.top + rc.bottom) / 2,
+                       pszText,
                        lstrlen(pszText));
 
                return S_OK;
@@ -213,5 +211,3 @@ protected:
        IOverlappedWindow* m_pMainWindow;
        CComBSTR m_bstr_MessageCaption;
 };
-
-#endif //__COMMDIALOG_H_
index cc2a052..f49da13 100644 (file)
@@ -1,10 +1,13 @@
 // Control.cpp : CControl \82Ì\83C\83\93\83v\83\8a\83\81\83\93\83e\81[\83V\83\87\83\93
 #include "stdafx.h"
+
 #include "SeraphyScriptTools.h"
 #include "Control.h"
 #include "treeitem.h"
-#include "generic.h"
+
 #include "objectmap.h"
+#include "CComEnumDynaVARIANT.h"
+
 #include <list>
 #include <vector>
 
@@ -13,20 +16,6 @@ using namespace std;
 /////////////////////////////////////////////////////////////////////////////
 // CControl
 
-STDMETHODIMP CControl::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_IControl
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 STDMETHODIMP CControl::get_Text(BSTR *pVal)
 {
        if (!m_hParent || !m_hWnd) {
@@ -34,7 +23,7 @@ STDMETHODIMP CControl::get_Text(BSTR *pVal)
        }
 
        DWORD siz = ::GetWindowTextLength(m_hWnd);
-       
+
        ATL::CString tmp;
        LPTSTR pMes = tmp.GetBufferSetLength(siz + 1);
        GetWindowText(m_hWnd, pMes, siz + 1);
@@ -47,10 +36,10 @@ STDMETHODIMP CControl::get_Text(BSTR *pVal)
 
 STDMETHODIMP CControl::put_Text(BSTR newVal)
 {
-       if(!m_hParent || !m_hWnd){
+       if (!m_hParent || !m_hWnd) {
                return Error(IDS_ERR_DESTROYED);
        }
-       
+
        ATL::CString tmp(newVal);
        ::SetWindowText(m_hWnd, tmp);
        return S_OK;
@@ -59,7 +48,7 @@ STDMETHODIMP CControl::put_Text(BSTR newVal)
 STDMETHODIMP CControl::get_ID(short *pVal)
 {
        if (m_hWnd) {
-               m_nID = (int)GetWindowLong(m_hWnd,GWL_ID);
+               m_nID = (int)GetWindowLong(m_hWnd, GWL_ID);
        }
        *pVal = m_nID;
        return S_OK;
@@ -70,10 +59,10 @@ STDMETHODIMP CControl::put_ID(short newVal)
        m_nID = newVal;
        if (m_hWnd) {
                SetWindowLong(m_hWnd, GWL_ID, newVal);
-               if((m_nID == IDOK) && !lstrcmp(m_classname, _TEXT("BUTTON"))) {
+               if ((m_nID == IDOK) && !lstrcmp(m_classname, _TEXT("BUTTON"))) {
                        // IDOK\82È\82ç\83|\83b\83V\83\85\83{\83^\83\93\8c^\82ð\83f\83B\83t\83H\83\8b\83g\83{\83^\83\93\82É\95Ï\89»\82³\82¹\82é
-                       DWORD m_style = ::GetWindowLong(m_hWnd,GWL_STYLE);
-                       m_style |=  BS_DEFPUSHBUTTON;
+                       DWORD m_style = ::GetWindowLong(m_hWnd, GWL_STYLE);
+                       m_style |= BS_DEFPUSHBUTTON;
                        ::SetWindowLong(m_hWnd, GWL_STYLE, m_style);
                }
        }
@@ -119,14 +108,14 @@ STDMETHODIMP CControl::put_Enable(BOOL newVal)
        if (!m_hParent || !m_hWnd) {
                return Error(IDS_ERR_DESTROYED);
        }
-       ::EnableWindow(m_hWnd,newVal);
+       ::EnableWindow(m_hWnd, newVal);
        return S_OK;
 }
 
 STDMETHODIMP CControl::get_CheckState(short *pVal)
 {
-       if(m_hWnd){
-               m_bChecked = (short)::SendMessage(m_hWnd,BM_GETCHECK,0,0);
+       if (m_hWnd) {
+               m_bChecked = (short)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0);
        }
        *pVal = m_bChecked;
        return S_OK;
@@ -144,68 +133,71 @@ STDMETHODIMP CControl::put_CheckState(short newVal)
 
 BOOL CControl::Create(HWND hParent)
 {
-       // << \83f\83B\83t\83H\83\8b\83g\82Ì\83v\83b\83V\83\85\83{\83^\83\93\82É\95Ï\89»\82³\82¹\82é\83N\83\8d\96\82\8fp >>
+       // << \83f\83t\83H\83\8b\83g\82Ì\83v\83b\83V\83\85\83{\83^\83\93\82É\95Ï\89»\82³\82¹\82é\83N\83\8d\96\82\8fp >>
        if ((m_nID == IDOK) && !lstrcmp(m_classname, _TEXT("BUTTON"))) {
                // IDOK\82È\82ç\95Ï\8dX\82·\82é
-               m_style |=  BS_DEFPUSHBUTTON;
+               m_style |= BS_DEFPUSHBUTTON;
        }
 
        //\81@\83R\83\93\83g\83\8d\81[\83\8b\82Ì\90\90¬
        ATLASSERT(m_hParent == NULL);
        m_hParent = hParent;
-       m_hWnd = ::CreateWindowEx(m_exstyle,m_classname,m_caption
-               ,m_style | WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS
-               ,m_x,m_y,m_w,m_h
-               ,hParent
-               ,NULL
-               ,_Module.m_hInst
-               ,NULL);
+       m_hWnd = ::CreateWindowEx(m_exstyle, m_classname, m_caption,
+               m_style | WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,
+               m_x, m_y, m_w, m_h,
+               hParent,
+               NULL,
+               _Module.m_hInst,
+               NULL);
        ::SetWindowLongPtr(m_hWnd, GWLP_ID, m_nID);
        ::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR) this);
-       ::SetWindowText(m_hWnd,m_caption);
+       ::SetWindowText(m_hWnd, m_caption);
 
        // \90e\82ª\83f\83B\83Z\81[\83u\83\8b\82È\82ç\8eq\82à\83f\83B\83Z\81[\83u\83\8b\8fó\91Ô\82Å\8dì\90¬\82·\82é
-       if(!::IsWindowEnabled(m_hParent)){
-               ::EnableWindow(m_hWnd,false);
+       if (!::IsWindowEnabled(m_hParent)) {
+               ::EnableWindow(m_hWnd, false);
        }
 
        //////////////////////////
        // \8e\96\91O\8fó\91Ô\82Ì\90Ý\92è
        if (!lstrcmp(m_classname, _TEXT("BUTTON"))) {
                // \83{\83^\83\93\82È\82ç\83`\83F\83b\83N\8fó\91Ô\82Ì\83Z\83b\83g
-               if(m_bChecked){
-                       ::SendMessage(m_hWnd,BM_SETCHECK,1,0);
+               if (m_bChecked) {
+                       ::SendMessage(m_hWnd, BM_SETCHECK, 1, 0);
                }
        }
-       else if(!lstrcmp(m_classname,WC_LISTVIEW)){
+       else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82È\82ç\83J\83\89\83\80\82Ì\90Ý\92è\82ð\8ds\82¤
-               TCHAR szColumn[MAX_PATH];
                LPCTSTR p = m_caption;
                m_nColumnCount = 0;
                // \83E\83B\83\93\83h\83E\83L\83\83\83v\83V\83\87\83\93\82©\82ç\97ñ\8c©\8fo\82µ\82ð\8dì\90¬\82·\82é
-               while(*p){
-                       LPCTSTR d = p;
-                       while(*p && *p != ',' && *p != ':'){
+               while (*p) {
+                       LPCTSTR st = p;
+                       while (*p && *p != ',' && *p != ':') {
                                p = CharNext(p);
                        }
-                       int sz = p - d;
-                       if(sz >= MAX_PATH) sz = MAX_PATH - 1;
-                       CopyMemory(szColumn,d,p - d);
-                       szColumn[p-d] = 0;
+
+                       int sz = p - st;
+                       TCHAR szColumn[MAX_PATH] = {0};
+                       _tcsncpy_s(szColumn, MAX_PATH, st, sz);
+
                        LVCOLUMN col = {0};
-                       col.mask    = LVCF_TEXT | LVCF_WIDTH;
+                       col.mask = LVCF_TEXT | LVCF_WIDTH;
                        col.pszText = szColumn;
-                       col.cx      = ListView_GetStringWidth(m_hWnd,szColumn) + 16;
-                       ListView_InsertColumn(m_hWnd,m_nColumnCount,&col);
-                       if(*p == ',' || *p == ':') p++;
+                       col.cx = ListView_GetStringWidth(m_hWnd, szColumn) + 16;
+                       ListView_InsertColumn(m_hWnd, m_nColumnCount, &col);
+
+                       if (*p == ',' || *p == ':') {
+                               p++;
+                       }
                        m_nColumnCount++;
                }
-               if(m_afterstyle){
-                       ListView_SetExtendedListViewStyle(m_hWnd,m_afterstyle);
+               if (m_afterstyle) {
+                       ListView_SetExtendedListViewStyle(m_hWnd, m_afterstyle);
                }
        }
-       else if(!lstrcmp(m_classname,WC_TREEVIEW)){
-               TreeView_SetImageList(m_hWnd,NULL,TVSIL_NORMAL);
+       else if (!lstrcmp(m_classname, WC_TREEVIEW)) {
+               TreeView_SetImageList(m_hWnd, NULL, TVSIL_NORMAL);
        }
        return true;
 }
@@ -213,20 +205,20 @@ BOOL CControl::Create(HWND hParent)
 void CControl::Destroy()
 {
        DeleteAllItems();
-       if(m_hWnd){
+       if (m_hWnd) {
                // \83E\83B\83\93\83h\83E\82ð\94j\8aü\82·\82é
                // \83E\83B\83\93\83h\83E\82Ì\94j\8aü\82Æ\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\94j\8aü\82Í\88ê\92v\82µ\82È\82¢\81B
                ::DestroyWindow(m_hWnd);
-               m_hWnd    = NULL;
+               m_hWnd = NULL;
        }
 }
 
 STDMETHODIMP CControl::get_Width(short *pVal)
 {
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
+               ::GetWindowPlacement(m_hWnd, &pls);
                m_w = (short)(pls.rcNormalPosition.right - pls.rcNormalPosition.left);
        }
        *pVal = m_w;
@@ -236,21 +228,28 @@ STDMETHODIMP CControl::get_Width(short *pVal)
 STDMETHODIMP CControl::put_Width(short newVal)
 {
        m_w = newVal;
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
-               ::SetWindowPos(m_hWnd,NULL,0,0,m_w,pls.rcNormalPosition.right - pls.rcNormalPosition.left,SWP_NOZORDER|SWP_NOMOVE);
+               ::GetWindowPlacement(m_hWnd, &pls);
+               ::SetWindowPos(
+                       m_hWnd,
+                       NULL,
+                       0, 0,
+                       m_w,
+                       pls.rcNormalPosition.right - pls.rcNormalPosition.left,
+                       SWP_NOZORDER | SWP_NOMOVE
+                       );
        }
        return S_OK;
 }
 
 STDMETHODIMP CControl::get_Height(short *pVal)
 {
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
+               ::GetWindowPlacement(m_hWnd, &pls);
                m_h = (short)(pls.rcNormalPosition.bottom - pls.rcNormalPosition.top);
        }
        *pVal = m_h;
@@ -260,21 +259,28 @@ STDMETHODIMP CControl::get_Height(short *pVal)
 STDMETHODIMP CControl::put_Height(short newVal)
 {
        m_h = newVal;
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
-               ::SetWindowPos(m_hWnd,NULL,0,0,m_h,pls.rcNormalPosition.right - pls.rcNormalPosition.left,SWP_NOZORDER|SWP_NOMOVE);
+               ::GetWindowPlacement(m_hWnd, &pls);
+               ::SetWindowPos(
+                       m_hWnd,
+                       NULL,
+                       0, 0,
+                       m_h,
+                       pls.rcNormalPosition.right - pls.rcNormalPosition.left,
+                       SWP_NOZORDER | SWP_NOMOVE
+                       );
        }
        return S_OK;
 }
 
 STDMETHODIMP CControl::get_PosX(short *pVal)
 {
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
+               ::GetWindowPlacement(m_hWnd, &pls);
                m_x = (short)pls.rcNormalPosition.left;
        }
        *pVal = m_x;
@@ -284,21 +290,27 @@ STDMETHODIMP CControl::get_PosX(short *pVal)
 STDMETHODIMP CControl::put_PosX(short newVal)
 {
        m_x = newVal;
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
-               ::SetWindowPos(m_hWnd,NULL,m_x,pls.rcNormalPosition.top,0,0,SWP_NOZORDER|SWP_NOSIZE);
+               ::GetWindowPlacement(m_hWnd, &pls);
+               ::SetWindowPos(
+                       m_hWnd,
+                       NULL,
+                       m_x, pls.rcNormalPosition.top,
+                       0, 0,
+                       SWP_NOZORDER | SWP_NOSIZE
+                       );
        }
        return S_OK;
 }
 
 STDMETHODIMP CControl::get_PosY(short *pVal)
 {
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
+               ::GetWindowPlacement(m_hWnd, &pls);
                m_y = (short)pls.rcNormalPosition.top;
        }
        *pVal = m_y;
@@ -308,11 +320,18 @@ STDMETHODIMP CControl::get_PosY(short *pVal)
 STDMETHODIMP CControl::put_PosY(short newVal)
 {
        m_y = newVal;
-       if(m_hWnd){
+       if (m_hWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hWnd,&pls);
-               ::SetWindowPos(m_hWnd,NULL,pls.rcNormalPosition.left,m_y,0,0,SWP_NOZORDER|SWP_NOSIZE);
+               ::GetWindowPlacement(m_hWnd, &pls);
+               ::SetWindowPos(
+                       m_hWnd,
+                       NULL,
+                       pls.rcNormalPosition.left,
+                       m_y,
+                       0, 0,
+                       SWP_NOZORDER | SWP_NOSIZE
+                       );
        }
        return S_OK;
 }
@@ -320,22 +339,22 @@ STDMETHODIMP CControl::put_PosY(short newVal)
 STDMETHODIMP CControl::SetPlacement(VARIANT x, VARIANT y, VARIANT w, VARIANT h, VARIANT *pvarUnk)
 {
        // \83T\83C\83Y\95Ï\8dX
-       CComVariant varX,varY,varW,varH;
-       if((x.vt != VT_EMPTY && x.vt != VT_NULL && x.vt != VT_ERROR) && varX.ChangeType(VT_I2,&x) == S_OK){
+       CComVariant varX, varY, varW, varH;
+       if ((x.vt != VT_EMPTY && x.vt != VT_NULL && x.vt != VT_ERROR) && SUCCEEDED(varX.ChangeType(VT_I2, &x))) {
                m_x = varX.iVal;
        }
-       if((y.vt != VT_EMPTY && y.vt != VT_NULL && y.vt != VT_ERROR) && varY.ChangeType(VT_I2,&y) == S_OK){
+       if ((y.vt != VT_EMPTY && y.vt != VT_NULL && y.vt != VT_ERROR) && SUCCEEDED(varY.ChangeType(VT_I2, &y))) {
                m_y = varY.iVal;
        }
-       if((h.vt != VT_EMPTY && h.vt != VT_NULL && h.vt != VT_ERROR) && varH.ChangeType(VT_I2,&h) == S_OK){
+       if ((h.vt != VT_EMPTY && h.vt != VT_NULL && h.vt != VT_ERROR) && SUCCEEDED(varH.ChangeType(VT_I2, &h))) {
                m_h = varH.iVal;
        }
-       if((w.vt != VT_EMPTY && w.vt != VT_NULL && w.vt != VT_ERROR) && varW.ChangeType(VT_I2,&w) == S_OK){
+       if ((w.vt != VT_EMPTY && w.vt != VT_NULL && w.vt != VT_ERROR) && SUCCEEDED(varW.ChangeType(VT_I2, &w))) {
                m_w = varW.iVal;
        }
        // \83E\83B\83\93\83h\83E\82ª\95\\8e¦\82³\82ê\82Ä\82¢\82ê\82Î\82½\82¾\82¿\82É\94½\89f
-       if(m_hWnd){
-               ::SetWindowPos(m_hWnd,NULL,m_x,m_y,m_w,m_h,SWP_NOZORDER);
+       if (m_hWnd) {
+               ::SetWindowPos(m_hWnd, NULL, m_x, m_y, m_w, m_h, SWP_NOZORDER);
        }
        GetThisInterface(pvarUnk);
        return S_OK;
@@ -353,9 +372,9 @@ STDMETHODIMP CControl::SetID(VARIANT varID, VARIANT *pvarUnk)
 {
        // \92¼\82¿\82ÉID\82ð\8a\84\82è\93\96\82Ä\82é
        CComVariant tmp;
-       if(varID.vt != VT_EMPTY && varID.vt != VT_EMPTY && varID.vt != VT_EMPTY
-               && (tmp.ChangeType(VT_I2,&varID) == S_OK)){
-               if(tmp.iVal > 0){
+       if (varID.vt != VT_EMPTY && varID.vt != VT_EMPTY && varID.vt != VT_EMPTY
+               && SUCCEEDED(tmp.ChangeType(VT_I2, &varID))) {
+               if (tmp.iVal > 0) {
                        put_ID(tmp.iVal);
                }
        }
@@ -368,8 +387,8 @@ void CControl::GetThisInterface(VARIANT *pvarUnk)
        // \82±\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\95Ô\82·
        ::VariantInit(pvarUnk);
        IUnknown* pUnk = NULL;
-       if(QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-               pvarUnk->vt       = VT_UNKNOWN;
+       if (SUCCEEDED(QueryInterface(IID_IUnknown, (void**)&pUnk))) {
+               pvarUnk->vt = VT_UNKNOWN;
                pvarUnk->punkVal = pUnk;
        }
 }
@@ -381,8 +400,8 @@ int CControl::GetID()
 
 STDMETHODIMP CControl::get_Style(long *pVal)
 {
-       if(m_hWnd){
-               m_style = ::GetWindowLong(m_hWnd,GWL_STYLE);
+       if (m_hWnd) {
+               m_style = ::GetWindowLong(m_hWnd, GWL_STYLE);
        }
        *pVal = m_style;
        return S_OK;
@@ -391,16 +410,16 @@ STDMETHODIMP CControl::get_Style(long *pVal)
 STDMETHODIMP CControl::put_Style(long newVal)
 {
        m_style = newVal;
-       if(m_hWnd){
-               ::SetWindowLong(m_hWnd,GWL_STYLE,m_style);
+       if (m_hWnd) {
+               ::SetWindowLong(m_hWnd, GWL_STYLE, m_style);
        }
        return S_OK;
 }
 
 STDMETHODIMP CControl::get_Exstyle(long *pVal)
 {
-       if(m_hWnd){
-               m_exstyle = ::GetWindowLong(m_hWnd,GWL_EXSTYLE);
+       if (m_hWnd) {
+               m_exstyle = ::GetWindowLong(m_hWnd, GWL_EXSTYLE);
        }
        *pVal = m_exstyle;
        return S_OK;
@@ -409,8 +428,8 @@ STDMETHODIMP CControl::get_Exstyle(long *pVal)
 STDMETHODIMP CControl::put_Exstyle(long newVal)
 {
        m_exstyle = newVal;
-       if(m_hWnd){
-               ::SetWindowLong(m_hWnd,GWL_EXSTYLE,m_exstyle);
+       if (m_hWnd) {
+               ::SetWindowLong(m_hWnd, GWL_EXSTYLE, m_exstyle);
        }
        return S_OK;
 }
@@ -437,7 +456,7 @@ STDMETHODIMP CControl::Refresh()
 
 STDMETHODIMP CControl::get_HWND(long *pVal)
 {
-       *pVal = (long) m_hWnd;
+       *pVal = (long)m_hWnd;
        return S_OK;
 }
 
@@ -453,7 +472,7 @@ HRESULT CControl::ConvertVariantToString(VARIANT text, ATL::CString &retval)
        return S_OK;
 }
 
-STDMETHODIMP CControl::AddString(VARIANT text,VARIANT* pRet)
+STDMETHODIMP CControl::AddString(VARIANT text, VARIANT* pRet)
 {
        ::VariantInit(pRet);
 
@@ -478,49 +497,50 @@ STDMETHODIMP CControl::AddString(VARIANT text,VARIANT* pRet)
 
                // \98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\83o\83C\83\93\83h\82·\82é
                CComObject<CObjectMap>* pMap = NULL;
-               IUnknown* pUnk = NULL;
-               if (pMap->CreateInstance(&pMap) == S_OK) {
-                       pMap->QueryInterface(IID_IUnknown,(void**)&pUnk);
+               if (SUCCEEDED(CComObject<CObjectMap>::CreateInstance(&pMap))) {
+                       IUnknown* pUnk = NULL;
+                       if (SUCCEEDED(pMap->QueryInterface(IID_IUnknown, (void**)&pUnk))) {
+                               ::SendMessage(m_hWnd, LB_SETITEMDATA, nIdx, (LPARAM)pUnk);
+                       }
                }
-               ::SendMessage(m_hWnd,LB_SETITEMDATA,nIdx,(LPARAM)pUnk);
                ret = (short)nIdx;
        }
-       else if(!lstrcmp(m_classname,WC_LISTVIEW)){
+       else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82É\95\8e\9a\97ñ\82ð\92Ç\89Á\82·\82é
                int cnt = ListView_GetItemCount(m_hWnd);
                LVITEM item = {0};
-               item.mask    = LVIF_TEXT;
+               item.mask = LVIF_TEXT;
                item.pszText = buf.GetBuffer();
-               item.iItem   = cnt;
+               item.iItem = cnt;
                int nIdx = ListView_InsertItem(m_hWnd, &item);
 
                // \83T\83u\83J\83\89\83\80\82Í\8bó\95\82ð\96\84\82ß\82é
-               for(int i = 1 ; i < m_nColumnCount ; i++) {
+               for (int i = 1; i < m_nColumnCount; i++) {
                        ListView_SetItemText(m_hWnd, nIdx, i, _TEXT(""));
                }
 
                // \98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\83o\83C\83\93\83h\82·\82é
                CComObject<CObjectMap>* pMap = NULL;
                IUnknown* pUnk = NULL;
-               if (pMap->CreateInstance(&pMap) == S_OK) {
+               if (SUCCEEDED(pMap->CreateInstance(&pMap))) {
                        pMap->QueryInterface(IID_IUnknown, (void**)&pUnk);
                }
                LVITEM itm = {0};
-               itm.iItem  = nIdx;
-               itm.mask   = LVIF_PARAM;
-               itm.lParam = (LPARAM) pUnk;
+               itm.iItem = nIdx;
+               itm.mask = LVIF_PARAM;
+               itm.lParam = (LPARAM)pUnk;
                ListView_SetItem(m_hWnd, &itm);
                ret = (short)nIdx;
        }
        else if (!lstrcmp(m_classname, WC_TREEVIEW)) {
                // \83c\83\8a\81[\83r\83\85\81[\82Ì\83\8b\81[\83g\82É\83A\83C\83e\83\80\82ð\8dì\90¬\82·\82é
                IUnknown* pUnk = NULL;
-               CTreeItem::CreateTreeItem(m_hWnd,TVI_ROOT, buf, &pUnk);
-               if(pUnk != NULL){
+               CTreeItem::CreateTreeItem(m_hWnd, TVI_ROOT, buf, &pUnk);
+               if (pUnk != NULL) {
                        ret = (IUnknown*)pUnk;
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -530,17 +550,16 @@ STDMETHODIMP CControl::AddString(VARIANT text,VARIANT* pRet)
 STDMETHODIMP CControl::SetColumnText(VARIANT item, VARIANT col, VARIANT text)
 {
        if (!m_hParent || !m_hWnd) {
-               ErrorInfo(IDS_ERR_DESTROYED);
-               return DISP_E_EXCEPTION;
+               return Error(IDS_ERR_DESTROYED);
        }
 
        int nIdx = -1;
        int nCol = -1;
        CComVariant varIdx, varCol;
-       if (varIdx.ChangeType(VT_I2, &item) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &item))) {
                nIdx = varIdx.iVal;
        }
-       if (varCol.ChangeType(VT_I2, &col) == S_OK) {
+       if (SUCCEEDED(varCol.ChangeType(VT_I2, &col))) {
                nCol = varCol.iVal;
        }
        if (nIdx < 0 || nCol < 0) {
@@ -582,10 +601,10 @@ STDMETHODIMP CControl::GetColumnText(VARIANT idx, VARIANT col, VARIANT *pText)
        int nIdx = -1;
        int nCol = -1;
        CComVariant varIdx, varCol;
-       if (varIdx.ChangeType(VT_I2, &idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = varIdx.iVal;
        }
-       if (varCol.ChangeType(VT_I2, &col) == S_OK) {
+       if (SUCCEEDED(varCol.ChangeType(VT_I2, &col))) {
                nCol = varCol.iVal;
        }
 
@@ -622,24 +641,24 @@ STDMETHODIMP CControl::get_ItemObject(VARIANT idx, VARIANT *pVal)
 
        int nIdx = -1;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_I2,&idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = varIdx.iVal;
        }
 
-       if (nIdx < 0 ) {
+       if (nIdx < 0) {
                return DISP_E_BADINDEX;
        }
 
        IUnknown* pUnk = NULL;
        if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
                // \83\8a\83X\83g\83{\83b\83N\83X\82©\82ç\98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\8eæ\93¾\82·\82é
-               int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
+               int mx = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
                if (nIdx >= mx) {
                        return Error(IDS_ERR_RANDEOUT);
                }
-               DWORD data = ::SendMessage(m_hWnd, LB_GETITEMDATA, nIdx, 0);
+               LRESULT data = ::SendMessage(m_hWnd, LB_GETITEMDATA, nIdx, 0);
                if (data != LB_ERR && data) {
-                       pUnk = (IUnknown*) data;
+                       pUnk = (IUnknown*)data;
                }
        }
        else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
@@ -650,11 +669,11 @@ STDMETHODIMP CControl::get_ItemObject(VARIANT idx, VARIANT *pVal)
                }
 
                LVITEM itm = {0};
-               itm.mask   = LVIF_PARAM;
-               itm.iItem  = nIdx;
+               itm.mask = LVIF_PARAM;
+               itm.iItem = nIdx;
                if (ListView_GetItem(m_hWnd, &itm)) {
                        if (itm.lParam) {
-                               pUnk = (IUnknown*) itm.lParam;
+                               pUnk = (IUnknown*)itm.lParam;
                        }
                }
        }
@@ -665,7 +684,7 @@ STDMETHODIMP CControl::get_ItemObject(VARIANT idx, VARIANT *pVal)
 
        if (pUnk) {
                pUnk->AddRef();
-               pVal->vt      = VT_UNKNOWN;
+               pVal->vt = VT_UNKNOWN;
                pVal->punkVal = pUnk;
        }
        return S_OK;
@@ -673,18 +692,17 @@ STDMETHODIMP CControl::get_ItemObject(VARIANT idx, VARIANT *pVal)
 
 STDMETHODIMP CControl::DeleteAllItems()
 {
-       if(!m_hParent || !m_hWnd){
-               ErrorInfo(IDS_ERR_DESTROYED);
-               return DISP_E_EXCEPTION;
+       if (!m_hParent || !m_hWnd) {
+               return Error(IDS_ERR_DESTROYED);
        }
        // \83R\83\93\83g\83\8d\81[\83\8b\82Ì\93à\95\94\83A\83C\83e\83\80\82É\8aÖ\98A\95t\82¯\82ç\82ê\82Ä\82¢\82½\98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\89ð\95ú\82·\82é
        if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
                // \83\8a\83X\83g\82Ì\89ð\95ú
                int mx = ::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0);
                for (int i = 0; i < mx; i++) {
-                       DWORD data = ::SendMessage(m_hWnd, LB_GETITEMDATA, i, 0);
+                       LRESULT data = ::SendMessage(m_hWnd, LB_GETITEMDATA, i, 0);
                        if (data != LB_ERR && data) {
-                               ((IUnknown*) data)->Release();
+                               ((IUnknown*)data)->Release();
                        }
                }
        }
@@ -692,12 +710,12 @@ STDMETHODIMP CControl::DeleteAllItems()
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\98A\91z\94z\97ñ\82Ì\89ð\95ú
                int mx = ListView_GetItemCount(m_hWnd);
                LVITEM itm = {0};
-               for(int i = 0; i < mx; i++) {
-                       itm.mask   = LVIF_PARAM;
-                       itm.iItem  = i;
-                       if (ListView_GetItem(m_hWnd,&itm)) {
+               for (int i = 0; i < mx; i++) {
+                       itm.mask = LVIF_PARAM;
+                       itm.iItem = i;
+                       if (ListView_GetItem(m_hWnd, &itm)) {
                                if (itm.lParam) {
-                                       ((IUnknown*) itm.lParam)->Release();
+                                       ((IUnknown*)itm.lParam)->Release();
                                }
                        }
                }
@@ -706,7 +724,7 @@ STDMETHODIMP CControl::DeleteAllItems()
                // \83c\83\8a\81[\83r\83\85\81[\82Ì\98A\91z\94z\97ñ\82Ì\89ð\95ú
                HTREEITEM hItem = TreeView_GetRoot(m_hWnd);
                while (hItem) {
-                       HTREEITEM hNextItem = TreeView_GetNextSibling(m_hWnd,hItem);
+                       HTREEITEM hNextItem = TreeView_GetNextSibling(m_hWnd, hItem);
                        CTreeItem::DeleteTreeItemWithData(m_hWnd, hItem);
                        hItem = hNextItem;
                }
@@ -737,21 +755,21 @@ STDMETHODIMP CControl::DeleteString(VARIANT idx, VARIANT *pRet)
 
        int nIdx = -1;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_I2, &idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = varIdx.iVal;
        }
-       if (nIdx < 0 ) {
+       if (nIdx < 0) {
                return DISP_E_BADINDEX;
        }
 
        CComVariant ret;
        if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
                // \83R\83\93\83{\83{\83b\83N\83X\82©\82ç\95\8e\9a\97ñ\82ð\8dí\8f\9c\82·\82é
-               int mx = ::SendMessage(m_hWnd,CB_GETCOUNT, 0, 0);
+               int mx = ::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0);
                if (nIdx >= mx) {
                        return Error(IDS_ERR_RANDEOUT);
                }
-               int result = ::SendMessage(m_hWnd,CB_DELETESTRING, nIdx, 0);
+               int result = ::SendMessage(m_hWnd, CB_DELETESTRING, nIdx, 0);
                ret = (bool)(result != LB_ERR);
        }
        else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
@@ -762,7 +780,7 @@ STDMETHODIMP CControl::DeleteString(VARIANT idx, VARIANT *pRet)
                }
 
                // \98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\94j\8aü\82·\82é
-               DWORD data = ::SendMessage(m_hWnd,LB_GETITEMDATA, nIdx, 0);
+               LRESULT data = ::SendMessage(m_hWnd, LB_GETITEMDATA, nIdx, 0);
                if (data != LB_ERR && data) {
                        ((IUnknown*)data)->Release();
                }
@@ -780,18 +798,18 @@ STDMETHODIMP CControl::DeleteString(VARIANT idx, VARIANT *pRet)
 
                // \98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\94j\8aü\82·\82é
                LVITEM itm = {0};
-               itm.mask   = LVIF_PARAM;
-               itm.iItem  = nIdx;
-               if (ListView_GetItem(m_hWnd,&itm)) {
+               itm.mask = LVIF_PARAM;
+               itm.iItem = nIdx;
+               if (ListView_GetItem(m_hWnd, &itm)) {
                        if (itm.lParam) {
-                               ((IUnknown*) itm.lParam)->Release();
+                               ((IUnknown*)itm.lParam)->Release();
                        }
                }
 
                // \8dí\8f\9c
                ret = ListView_DeleteItem(m_hWnd, nIdx) ? true : false;
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -803,7 +821,7 @@ STDMETHODIMP CControl::GetCount(VARIANT *pRet)
 {
        ::VariantInit(pRet);
 
-       if (!m_hParent || !m_hWnd){
+       if (!m_hParent || !m_hWnd) {
                return Error(IDS_ERR_DESTROYED);
        }
 
@@ -828,7 +846,7 @@ STDMETHODIMP CControl::GetCount(VARIANT *pRet)
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\83J\83E\83\93\83g
                ret = (short)ListView_GetItemCount(m_hWnd);
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -848,16 +866,16 @@ STDMETHODIMP CControl::get_CurrentSelectedItem(VARIANT *pVal)
                // \83R\83\93\83{\83{\83b\83N\83X\82Ì\8c»\8dÝ\82Ì\91I\91ð\82ð\95Ô\82·
                ret = (long)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
        }
-       else if(!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
+       else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
                // \83\8a\83X\83g\83{\83b\83N\83X\82Ì\8c»\8dÝ\82Ì\91I\91ð\83A\83C\83e\83\80\82ð\95Ô\82·
                if (!(m_style & LBS_MULTIPLESEL)) {
                        // \83V\83\93\83O\83\8b\83Z\83\8c\83N\83g\82Ì\8fê\8d\87
                        ret = (long)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);
                }
-               else{
+               else {
                        // \83}\83\8b\83`\83Z\83\8c\83N\83g\82Ì\8fê\8d\87\82Í\8dÅ\8f\89\82Ì\91I\91ð\83A\83C\83e\83\80\82ð\95Ô\82·
                        ret = (long)-1;
-                       int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
+                       int mx = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
                        if (mx > 0) {
                                std::vector<long> buf(mx + 1);
                                long* pBuf = &buf[0];
@@ -870,24 +888,24 @@ STDMETHODIMP CControl::get_CurrentSelectedItem(VARIANT *pVal)
        }
        else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\8dÅ\8f\89\82Ì\91I\91ð\83A\83C\83e\83\80\82ð\92T\82·
-               ret = (long)ListView_GetNextItem(m_hWnd,-1,LVNI_SELECTED);
+               ret = (long)ListView_GetNextItem(m_hWnd, -1, LVNI_SELECTED);
        }
        else if (!lstrcmp(m_classname, WC_TREEVIEW)) {
                // \83c\83\8a\81[\83r\83\85\81[\82Ì\8ew\92è\83A\83C\83e\83\80\82Ì\91®\90«\82ð\92²\82×\82é
                HTREEITEM hItem = TreeView_GetSelection(m_hWnd);
                if (hItem) {
                        CComObject<CTreeItem>* pItem = NULL;
-                       if (pItem->CreateInstance(&pItem) == S_OK) {
+                       if (SUCCEEDED(pItem->CreateInstance(&pItem))) {
                                pItem->AddRef();
-                               pItem->SetParam(m_hWnd,hItem);
+                               pItem->SetParam(m_hWnd, hItem);
                                IUnknown* pUnk = NULL;
-                               if (pItem->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                               if (SUCCEEDED(pItem->QueryInterface(IID_IUnknown, (void**)&pUnk))) {
                                        ret = pUnk;
                                }
                        }
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -902,11 +920,11 @@ STDMETHODIMP CControl::put_CurrentSelectedItem(VARIANT newVal)
 
        long nIdx = -1;
        CComVariant varIdx;
-       if(varIdx.ChangeType(VT_I4,&newVal) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_I4, &newVal))) {
                nIdx = varIdx.lVal;
        }
 
-       if!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
+       if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
                // \83R\83\93\83{\83{\83b\83N\83X\82ð\91I\91ð\82ð\8ew\92è\82·\82é
                ::SendMessage(m_hWnd, CB_SETCURSEL, nIdx, 0);
        }
@@ -919,7 +937,7 @@ STDMETHODIMP CControl::put_CurrentSelectedItem(VARIANT newVal)
                else {
                        // \83}\83\8b\83`\83Z\83\8c\83N\83g\82Ì\8fê\8d\87
                        int mx = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
-                       for(int i = 0; i < mx; i++) {
+                       for (int i = 0; i < mx; i++) {
                                ::SendMessage(m_hWnd, LB_SETSEL, FALSE, i);
                        }
                        if (nIdx >= 0 && nIdx < mx) {
@@ -930,13 +948,12 @@ STDMETHODIMP CControl::put_CurrentSelectedItem(VARIANT newVal)
        else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\91I\91ð
                int mx = ListView_GetItemCount(m_hWnd);
-               ListView_SetItemState(m_hWnd, -1, LVIS_SELECTED, 0); // TODO:\97v\8am\94F -1\82Å\91S\83A\83C\83e\83\80\91Î\8fÛ\81A\88È\91O\82Ímx\89ñ\83\8b\81[\83v\82µ\82Ä\82¢\82½\81B
+               ListView_SetItemState(m_hWnd, -1, LVIS_SELECTED, 0);
                if (nIdx >= 0 && nIdx < mx) {
-                       // FIXME:TODO: \97v\8am\94F\81@nIdx\82Å\82Í\82È\82­i\82ð\8eg\82Á\82Ä\82¢\82½\81H\90³\82µ\82¢\82Æ\82Í\8ev\82¦\82È\82¢\81B
                        ListView_SetItemState(m_hWnd, nIdx, LVIS_SELECTED, LVIS_SELECTED);
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -947,7 +964,7 @@ STDMETHODIMP CControl::get__NewEnum(IUnknown **pVal)
 {
        *pVal = NULL;
 
-       if(!m_hParent || !m_hWnd){
+       if (!m_hParent || !m_hWnd) {
                return Error(IDS_ERR_DESTROYED);
        }
 
@@ -956,7 +973,7 @@ STDMETHODIMP CControl::get__NewEnum(IUnknown **pVal)
 
        if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
                // \83R\83\93\83{\83{\83b\83N\83X\82Ì\8c»\8dÝ\82Ì\91I\91ð\82ð\95Ô\82·
-               int nIdx = ::SendMessage(m_hWnd,CB_GETCURSEL,0,0);
+               int nIdx = ::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
                mx = 1;
                varArray.resize(1);
                ::VariantInit(&varArray[0]);
@@ -974,9 +991,9 @@ STDMETHODIMP CControl::get__NewEnum(IUnknown **pVal)
                        varArray[0].vt = VT_I2;
                        varArray[0].iVal = nIdx;
                }
-               else{
+               else {
                        // \83}\83\8b\83`\83Z\83\8c\83N\83g\82Ì\8fê\8d\87\82Í\8dÅ\8f\89\82Ì\91I\91ð\83A\83C\83e\83\80\82ð\95Ô\82·
-                       int sz = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
+                       int sz = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
                        std::vector<long> buf(sz + 1);
                        long* pBuf = &buf[0];
                        mx = ::SendMessage(m_hWnd, LB_GETSELITEMS, sz, (LPARAM)pBuf);
@@ -991,28 +1008,28 @@ STDMETHODIMP CControl::get__NewEnum(IUnknown **pVal)
                        }
                }
        }
-       else if(!lstrcmp(m_classname,WC_LISTVIEW)){
+       else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\8dÅ\8f\89\82Ì\91I\91ð\83A\83C\83e\83\80\82ð\92T\82·
                mx = ListView_GetSelectedCount(m_hWnd);
                varArray.resize(mx + 1);
                int nIdx = -1;
                int i = 0;
-               while ((nIdx = ListView_GetNextItem(m_hWnd,nIdx,LVNI_SELECTED)) != -1
-                        && i < mx) {
+               while ((nIdx = ListView_GetNextItem(m_hWnd, nIdx, LVNI_SELECTED)) != -1
+                       && i < mx) {
                        ::VariantInit(&varArray[i]);
                        varArray[i].vt = VT_I2;
                        varArray[i].iVal = (short)nIdx;
                        i++;
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
 
        // \97ñ\8b\93\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\90\90¬
        CComObject<CComEnumVARIANT>* pCol = NULL;
-       if (CComObject<CComEnumVARIANT>::CreateInstance(&pCol) == S_OK) {
+       if (SUCCEEDED(CComObject<CComEnumVARIANT>::CreateInstance(&pCol))) {
                pCol->AddRef();
                pCol->Init(&varArray[0], &varArray[mx], pCol, AtlFlagCopy);
                *pVal = pCol;
@@ -1026,14 +1043,13 @@ STDMETHODIMP CControl::get_ItemSelectState(VARIANT idx, VARIANT *pVal)
        ::VariantInit(pVal);
        CComVariant ret;
 
-       if(!m_hParent || !m_hWnd){
-               ErrorInfo(IDS_ERR_DESTROYED);
-               return DISP_E_EXCEPTION;
+       if (!m_hParent || !m_hWnd) {
+               return Error(IDS_ERR_DESTROYED);
        }
 
        int nIdx = -1;
        CComVariant varIdx;
-       if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = idx.iVal;
        }
 
@@ -1041,7 +1057,7 @@ STDMETHODIMP CControl::get_ItemSelectState(VARIANT idx, VARIANT *pVal)
                // \83R\83\93\83{\83{\83b\83N\83X\82Ì\8c»\8dÝ\82Ì\91I\91ð\82ð\95Ô\82·
                int nSel = ::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
                // \8ew\92è\82µ\82½\83A\83C\83e\83\80\82Æ\91I\91ð\82ª\88ê\92v\82µ\82Ä\82¢\82ê\82Îtrue
-               ret = (bool)((nSel == nIdx)?true:false);
+               ret = (bool)((nSel == nIdx) ? true : false);
        }
        else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
                // \83\8a\83X\83g\83{\83b\83N\83X\82Ì\8c»\8dÝ\82Ì\91I\91ð\83A\83C\83e\83\80\82ð\95Ô\82·
@@ -1051,7 +1067,7 @@ STDMETHODIMP CControl::get_ItemSelectState(VARIANT idx, VARIANT *pVal)
                        // \8ew\92è\82µ\82½\83A\83C\83e\83\80\82Æ\91I\91ð\82ª\88ê\92v\82µ\82Ä\82¢\82ê\82Îtrue
                        ret = (nSel == nIdx);
                }
-               else{
+               else {
                        // \83}\83\8b\83`\83Z\83\8c\83N\83g\82Ì\8fê\8d\87
                        ret = ::SendMessage(m_hWnd, LB_GETSEL, nIdx, 0) > 0;
                }
@@ -1064,7 +1080,7 @@ STDMETHODIMP CControl::get_ItemSelectState(VARIANT idx, VARIANT *pVal)
                        ret = (state & LVNI_SELECTED) != 0;
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -1080,13 +1096,13 @@ STDMETHODIMP CControl::put_ItemSelectState(VARIANT idx, VARIANT newVal)
 
        int nIdx = -1;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_I2,&idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = idx.iVal;
        }
 
        bool bSelected = false;
        CComVariant varSelected;
-       if (varSelected.ChangeType(VT_I2,&newVal) == S_OK) {
+       if (SUCCEEDED(varSelected.ChangeType(VT_I2, &newVal))) {
                bSelected = newVal.iVal != 0;
        }
 
@@ -1105,14 +1121,14 @@ STDMETHODIMP CControl::put_ItemSelectState(VARIANT idx, VARIANT newVal)
                        ::SendMessage(m_hWnd, LB_SETSEL, nIdx, bSelected);
                }
        }
-       else if(!lstrcmp(m_classname, WC_LISTVIEW)) {
+       else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\8ew\92è\83A\83C\83e\83\80\82Ì\91®\90«\82ð\92²\82×\82é
                int mx = ListView_GetItemCount(m_hWnd);
                if (nIdx >= 0 && nIdx < mx) {
                        ListView_SetItemState(m_hWnd, nIdx, bSelected ? LVNI_SELECTED : 0, LVNI_SELECTED);
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -1122,15 +1138,14 @@ STDMETHODIMP CControl::put_ItemSelectState(VARIANT idx, VARIANT newVal)
 STDMETHODIMP CControl::get_SelectedCount(short *pVal)
 {
        *pVal = 0;
-       if(!m_hParent || !m_hWnd){
-               ErrorInfo(IDS_ERR_DESTROYED);
-               return DISP_E_EXCEPTION;
+       if (!m_hParent || !m_hWnd) {
+               return Error(IDS_ERR_DESTROYED);
        }
 
        if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
                // \83\8a\83X\83g\83{\83b\83N\83X\82Ì\83J\83E\83\93\83g
-               int nIdx = ::SendMessage(m_hWnd,CB_GETCURSEL,0,0);
-               *pVal = (short)(nIdx>=0?1:0);
+               int nIdx = ::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
+               *pVal = (short)(nIdx >= 0 ? 1 : 0);
        }
        else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
                // \83\8a\83X\83g\83{\83b\83N\83X\82Ì\83J\83E\83\93\83g
@@ -1138,7 +1153,7 @@ STDMETHODIMP CControl::get_SelectedCount(short *pVal)
                        int nIdx = ::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);
                        *pVal = (short)(nIdx >= 0 ? 1 : 0);
                }
-               else{
+               else {
                        // \83}\83\8b\83`\83Z\83\8c\83N\83g
                        *pVal = (short)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0);
                }
@@ -1147,7 +1162,7 @@ STDMETHODIMP CControl::get_SelectedCount(short *pVal)
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\83J\83E\83\93\83g
                *pVal = (short)ListView_GetSelectedCount(m_hWnd);
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -1156,20 +1171,19 @@ STDMETHODIMP CControl::get_SelectedCount(short *pVal)
 
 STDMETHODIMP CControl::get_TreeRoot(VARIANT *pVal)
 {
-       if(!m_hParent || !m_hWnd){
-               ErrorInfo(IDS_ERR_DESTROYED);
-               return DISP_E_EXCEPTION;
+       if (!m_hParent || !m_hWnd) {
+               return Error(IDS_ERR_DESTROYED);
        }
        ::VariantInit(pVal);
-       if(!lstrcmp(m_classname,WC_TREEVIEW)){
+       if (!lstrcmp(m_classname, WC_TREEVIEW)) {
                HTREEITEM hItem = TreeView_GetRoot(m_hWnd);
                CComObject<CTreeItem>* pItem = NULL;
-               if(pItem->CreateInstance(&pItem) == S_OK){
+               if (SUCCEEDED(pItem->CreateInstance(&pItem))) {
                        pItem->AddRef();
-                       pItem->SetParam(m_hWnd,hItem);
+                       pItem->SetParam(m_hWnd, hItem);
                        IUnknown* pUnk = NULL;
-                       if(pItem->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                               pVal->vt      = VT_UNKNOWN;
+                       if (SUCCEEDED(pItem->QueryInterface(IID_IUnknown, (void**)&pUnk))) {
+                               pVal->vt = VT_UNKNOWN;
                                pVal->punkVal = pUnk;
                        }
                }
@@ -1213,12 +1227,12 @@ int CControl::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
        wsprintf(mes, _TEXT("SORT%d"), me->m_dLastSortColumn);
        CComVariant key(mes);
 
-       CComVariant val1,val2;
+       CComVariant val1, val2;
        if (!me->m_bSortReverse) {
                pMap1->get_Value(key, &val1);
                pMap2->get_Value(key, &val2);
        }
-       else{
+       else {
                pMap1->get_Value(key, &val2);
                pMap2->get_Value(key, &val1);
        }
@@ -1232,66 +1246,65 @@ int CControl::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
        }
 
        int ret = 0;
-       switch (me->m_typCompare)
-       {
-       case VT_UI1:
+       switch (me->m_typCompare) {
+               case VT_UI1:
                {
                        val1.ChangeType(VT_UI1);
                        val2.ChangeType(VT_UI1);
                        ret = val1.bVal - val2.bVal;
                        break;
                }
-       case VT_I2:
+               case VT_I2:
                {
                        val1.ChangeType(VT_I2);
                        val2.ChangeType(VT_I2);
                        ret = val1.iVal - val2.iVal;
                        break;
                }
-       case VT_I4:
+               case VT_I4:
                {
                        val1.ChangeType(VT_I4);
                        val2.ChangeType(VT_I4);
                        ret = val1.lVal - val2.lVal;
                        break;
                }
-       case VT_R4:
+               case VT_R4:
                {
                        val1.ChangeType(VT_R4);
                        val2.ChangeType(VT_R4);
                        ret = val1.fltVal > val2.fltVal;
                        break;
                }
-       case VT_R8:
+               case VT_R8:
                {
                        val1.ChangeType(VT_R8);
                        val2.ChangeType(VT_R8);
                        ret = val1.dblVal > val2.dblVal;
                        break;
                }
-       case VT_CY:
+               case VT_CY:
                {
                        val1.ChangeType(VT_CY);
                        val2.ChangeType(VT_CY);
                        ret = (int)(val1.cyVal.int64 - val2.cyVal.int64); //FIXME: \82æ\82ë\82µ\82­\82È\82¢\81B\8c¸\8eZ\8c\8b\89Ê\82ª\8c\85\82 \82Ó\82ê\82µ\82½\8fê\8d\87\81A\94ä\8ar\8aÖ\90\94\82ª\94j\92]\82·\82é\81B\82È\82¨\82³\82Ë\82Î\81B
                        break;
                }
-       case VT_DATE:
+               case VT_DATE:
                {
                        val1.ChangeType(VT_DATE);
                        val2.ChangeType(VT_DATE);
                        ret = val1.date > val2.date;
                        break;
                }
-       case VT_BSTR:
+               case VT_BSTR:
                {
-                       if(val1.ChangeType(VT_BSTR) == S_OK &&
-                          val2.ChangeType(VT_BSTR) == S_OK){
-                               ret = lstrcmpW(val1.bstrVal,val2.bstrVal);
+                       if (SUCCEEDED(val1.ChangeType(VT_BSTR)) &&
+                               SUCCEEDED(val2.ChangeType(VT_BSTR))) {
+                               ret = lstrcmpW(val1.bstrVal, val2.bstrVal);
                        }
                        break;
                }
-       default:
+               default:
                break;
        }
        return ret;
@@ -1307,7 +1320,7 @@ void CControl::OnRClick()
                // \83c\83\8a\81[\83r\83\85\81[\82Å\82 \82ê\82Î\83h\83\8d\83b\83v\83n\83C\83\89\83C\83g\82ð\91I\91ð\82É\82·\82é
                HTREEITEM hItem = TreeView_GetDropHilight(m_hWnd);
                if (hItem) {
-                       TreeView_SelectItem(m_hWnd,hItem);
+                       TreeView_SelectItem(m_hWnd, hItem);
                }
        }
 }
@@ -1343,7 +1356,7 @@ STDMETHODIMP CControl::put_ItemCheckState(VARIANT idx, BOOL newVal)
                return Error(IDS_ERR_DESTROYED);
        }
 
-       if (lstrcmp(m_classname,WC_LISTVIEW)) {
+       if (lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -1369,7 +1382,7 @@ STDMETHODIMP CControl::DeleteSelectedItem()
        if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
                // \83\8a\83X\83g\83{\83b\83N\83X\82Ì\91I\91ð\8dí\8f\9c
                CComVariant varRet, dmy;
-               while (get_CurrentSelectedItem(&varRet) == S_OK && varRet.vt != VT_EMPTY) {
+               while (SUCCEEDED(get_CurrentSelectedItem(&varRet)) && varRet.vt != VT_EMPTY) {
                        varRet.ChangeType(VT_I4);
                        if (varRet.lVal < 0) {
                                break;
@@ -1377,7 +1390,7 @@ STDMETHODIMP CControl::DeleteSelectedItem()
                        DeleteString(varRet, &dmy);
                }
        }
-       else if(!lstrcmp(m_classname,WC_LISTVIEW)){
+       else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
                // \83\8a\83X\83g\83r\83\85\81[\82Ì\8dí\8f\9c
                int nIdx = -1;
                while ((nIdx = ListView_GetNextItem(m_hWnd, nIdx, LVNI_SELECTED)) != -1) {
@@ -1386,7 +1399,7 @@ STDMETHODIMP CControl::DeleteSelectedItem()
                        nIdx = -1;
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -1395,17 +1408,17 @@ STDMETHODIMP CControl::DeleteSelectedItem()
 
 STDMETHODIMP CControl::get_ItemText(VARIANT idx, BSTR *pVal)
 {
-       if(!m_hParent || !m_hWnd){
+       if (!m_hParent || !m_hWnd) {
                return Error(IDS_ERR_DESTROYED);
        }
 
        int nIdx = -1;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_I2,&idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = varIdx.iVal;
        }
 
-       if(nIdx < 0){
+       if (nIdx < 0) {
                return DISP_E_TYPEMISMATCH;
        }
 
@@ -1442,7 +1455,7 @@ STDMETHODIMP CControl::get_ItemText(VARIANT idx, BSTR *pVal)
                        }
                }
        }
-       else{
+       else {
                // \82»\82ê\88È\8aO\82Í\83T\83|\81[\83g\8aO
                return Error(IDS_ERR_NOTSUPPORTCONTROL);
        }
@@ -1458,7 +1471,7 @@ STDMETHODIMP CControl::put_ItemText(VARIANT idx, BSTR newVal)
 
        int nIdx = -1;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_I2, &idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_I2, &idx))) {
                nIdx = varIdx.iVal;
        }
 
@@ -1477,7 +1490,7 @@ STDMETHODIMP CControl::put_ItemText(VARIANT idx, BSTR newVal)
        return Error(IDS_ERR_NOTSUPPORTCONTROL);
 }
 
-STDMETHODIMP CControl::SetClassEvent(BSTR name,VARIANT* pvarUnk)
+STDMETHODIMP CControl::SetClassEvent(BSTR name, VARIANT* pvarUnk)
 {
        m_bstrClassEvent = name;
        GetThisInterface(pvarUnk);
@@ -1498,26 +1511,26 @@ STDMETHODIMP CControl::CreateChild(VARIANT text, VARIANT varItem, VARIANT* pvarU
 
        // \83A\83C\83e\83\80\82Ì\8c\9f\8fØ
        CComVariant tmp;
-       if (tmp.ChangeType(VT_UNKNOWN, &varItem) == S_OK) {
+       if (SUCCEEDED(tmp.ChangeType(VT_UNKNOWN, &varItem))) {
                ITreeItem * pItem = NULL;
-               if (tmp.punkVal->QueryInterface(IID_ITreeItem, (void**) &pItem) != S_OK) {
+               if (tmp.punkVal->QueryInterface(IID_ITreeItem, (void**)&pItem) != S_OK) {
                        return DISP_E_UNKNOWNINTERFACE;
                }
 
                IUnknown* pUnk = NULL;
-               if (pItem->Create(text,&pUnk) == S_OK) {
-                       pvarUnk->vt      = VT_UNKNOWN;
+               if (SUCCEEDED(pItem->Create(text, &pUnk))) {
+                       pvarUnk->vt = VT_UNKNOWN;
                        pvarUnk->punkVal = pUnk;
                }
                pItem->Release();
        }
-       else{
+       else {
                tmp.ChangeType(VT_VARIANT, &varItem);
                if (tmp.vt == VT_ERROR || tmp.vt == VT_NULL || tmp.vt == VT_EMPTY) {
                        // \83\8b\81[\83g\8fã\82É\83A\83C\83e\83\80\82ð\8dì\90¬\82·\82é
-                       AddString(text,pvarUnk);
+                       AddString(text, pvarUnk);
                }
-               else{
+               else {
                        return DISP_E_TYPEMISMATCH;
                }
        }
index f23c635..fbb6e65 100644 (file)
--- a/Control.h
+++ b/Control.h
@@ -1,17 +1,16 @@
 // Control.h : CControl \82Ì\90é\8c¾
 
-#ifndef __CONTROL_H_
-#define __CONTROL_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include "treeitem.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // CControl
-class ATL_NO_VTABLE CControl : 
+class ATL_NO_VTABLE CControl :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CControl, &CLSID_Control>,
-       public ISupportErrorInfo,
+       public ISupportErrorInfoImpl<&IID_IControl>,
        public IConnectionPointContainerImpl<CControl>,
        public IDispatchImpl<IControl, &IID_IControl, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
@@ -22,14 +21,14 @@ public:
                m_y = 0;
                m_h = 0;
                m_w = 0;
-               m_bChecked  = false;
-               m_exstyle   = 0;
-               m_style     = 0;
-               m_nID       = 0;
-               m_hWnd      = NULL;
-               m_hParent   = NULL;
-               ZeroMemory(m_classname,MAX_PATH);
-               ZeroMemory(m_caption  ,MAX_PATH);
+               m_bChecked = false;
+               m_exstyle = 0;
+               m_style = 0;
+               m_nID = 0;
+               m_hWnd = NULL;
+               m_hParent = NULL;
+               ZeroMemory(m_classname, MAX_PATH);
+               ZeroMemory(m_captionMAX_PATH);
                // \83\8a\83X\83g\83R\83\93\83g\83\8d\81[\83\8b\97p
                m_nColumnCount = 0;
                m_dLastSortColumn = -1; //\8dÅ\8cã\82É\83\\81[\83g\82µ\82½\83J\83\89\83\80
@@ -44,10 +43,10 @@ public:
                m_h = h;
                m_w = w;
                m_exstyle = exstyle;
-               m_style   = style;
-               lstrcpy(m_classname, classname);
-               lstrcpy(m_caption, caption);
-               m_nID  = nID;
+               m_style = style;
+               StringCchCopy(m_classname, MAX_PATH, classname);
+               StringCchCopy(m_caption, MAX_PATH, caption);
+               m_nID = nID;
                m_bstrClassEvent = tmp;
                m_hWnd = NULL;
                m_hParent = NULL;
@@ -66,18 +65,18 @@ public:
 
        void SetFont(HFONT hFont)
        {
-               if(m_hWnd){
-                       ::SendMessage(m_hWnd,WM_SETFONT,(WPARAM)hFont,true);
+               if (m_hWnd) {
+                       ::SendMessage(m_hWnd, WM_SETFONT, (WPARAM)hFont, true);
                }
        }
        void SetColor(DWORD color)
        {
-               if(m_hWnd){
-                       if(!lstrcmp(m_classname,WC_TREEVIEW)){
-                               TreeView_SetBkColor(m_hWnd,COLORREF(color));
+               if (m_hWnd) {
+                       if (!lstrcmp(m_classname, WC_TREEVIEW)) {
+                               TreeView_SetBkColor(m_hWnd, COLORREF(color));
                        }
-                       else if(!lstrcmp(m_classname,WC_LISTVIEW)){
-                               ListView_SetBkColor(m_hWnd,COLORREF(color));
+                       else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
+                               ListView_SetBkColor(m_hWnd, COLORREF(color));
                        }
                }
        }
@@ -87,24 +86,21 @@ public:
                Destroy();
        }
 
-//DECLARE_REGISTRY_RESOURCEID(IDR_CONTROL)
-
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       //DECLARE_REGISTRY_RESOURCEID(IDR_CONTROL)
 
-BEGIN_COM_MAP(CControl)
-       COM_INTERFACE_ENTRY(IControl)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-END_COM_MAP()
-BEGIN_CONNECTION_POINT_MAP(CControl)
-END_CONNECTION_POINT_MAP()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
+       BEGIN_COM_MAP(CControl)
+               COM_INTERFACE_ENTRY(IControl)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+       END_COM_MAP()
+       BEGIN_CONNECTION_POINT_MAP(CControl)
+       END_CONNECTION_POINT_MAP()
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
 
-// IControl
+       // IControl
 public:
        STDMETHOD(CreateChild)(/*[in]*/VARIANT text,/*[in]*/VARIANT varItem,/*[out,retval]*/VARIANT* pvarUnk);
        void GetClassEvent(BSTR* pEventName);
@@ -164,10 +160,10 @@ public:
        void Destroy();
 
 protected:
-//     LRESULT (CALLBACK *subclassproc)(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
-//     static LRESULT CALLBACK WinProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
-static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); 
+       //      LRESULT (CALLBACK *subclassproc)(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
+       //      static LRESULT CALLBACK WinProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
+       static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
 protected:
        int m_x;
        int m_y;
@@ -189,5 +185,3 @@ protected:
        int m_nColumnCount;
        HRESULT ConvertVariantToString(VARIANT text, ATL::CString &retval);
 };
-
-#endif //__CONTROL_H_
index 83762e3..6357d6e 100644 (file)
--- a/Draw.cpp
+++ b/Draw.cpp
@@ -11,14 +11,14 @@ void CCanvas::FinalRelease()
 {
        ATLTRACE("CCanvas::FinalRelease\r\n");
        // \83v\83\8a\83\93\83^\83f\83o\83C\83X\82Ì\89ð\95ú
-       if(m_pPrinterDeviceMode){
+       if (m_pPrinterDeviceMode) {
                delete m_pPrinterDeviceMode;
                m_pPrinterDeviceMode = NULL;
        }
        // \83\8c\83C\83\84\81[\83I\83u\83W\83F\83N\83g\82Ì\89ð\95ú
        int i;
-       for(i=0 ; i<MAXLAYER ; i++){
-               if(m_pComLayer[i] != NULL){
+       for (i = 0; i < MAXLAYER; i++) {
+               if (m_pComLayer[i] != NULL) {
                        m_pComLayer[i]->Release();
                        m_pComLayer[i] = NULL;
                }
@@ -27,13 +27,12 @@ void CCanvas::FinalRelease()
 
 STDMETHODIMP CCanvas::InterfaceSupportsErrorInfo(REFIID riid)
 {
-       static const IID* arr[] = 
+       static const IID* arr[] =
        {
                &IID_ICanvas
        };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
+       for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) {
+               if (IsEqualGUID(*arr[i], riid))
                        return S_OK;
        }
        return S_FALSE;
@@ -44,17 +43,17 @@ STDMETHODIMP CCanvas::get_Layer(VARIANT varLay, VARIANT *pVal)
        // \83\8c\83C\83\84\81[\83I\83u\83W\83F\83N\83g\82Ì\8eó\82¯\93n\82µ
        CComVariant vLay;
        int nLayer = 0;
-       if(vLay.ChangeType(VT_I2,&varLay) == S_OK){
+       if (SUCCEEDED(vLay.ChangeType(VT_I2, &varLay))) {
                nLayer = vLay.iVal;
        }
-       if(!(nLayer >= 0 && nLayer < MAXLAYER) || m_pComLayer[nLayer] == NULL){
-               ErrorInfo(IDS_ERR_LAYERBOUND);
-               return DISP_E_EXCEPTION;
+       if (!(nLayer >= 0 && nLayer < MAXLAYER) || m_pComLayer[nLayer] == NULL) {
+               return Error(IDS_ERR_LAYERBOUND);
        }
+
        IUnknown* pUnk = NULL;
-       if(m_pComLayer[nLayer]->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
+       if (SUCCEEDED(m_pComLayer[nLayer]->QueryInterface(IID_IUnknown, (void**)&pUnk))) {
                ::VariantInit(pVal);
-               pVal->vt      = VT_UNKNOWN;
+               pVal->vt = VT_UNKNOWN;
                pVal->punkVal = pUnk;
        }
        return S_OK;
@@ -62,42 +61,42 @@ STDMETHODIMP CCanvas::get_Layer(VARIANT varLay, VARIANT *pVal)
 
 /////////////////////////////////
 // \88ó\8dü\83\81\83\\83b\83h\81E\83v\83\8d\83p\83e\83B
-STDMETHODIMP CCanvas::PrintAs(VARIANT print,VARIANT* pRet)
+STDMETHODIMP CCanvas::PrintAs(VARIANT print, VARIANT* pRet)
 {
        CComVariant varRet, varPrint;
        PRINTDLG pdlg = {0};
        pdlg.lStructSize = sizeof(PRINTDLG);
        pdlg.hwndOwner = m_hParent;
        pdlg.Flags = PD_NOPAGENUMS | PD_RETURNDC;
-       if(PrintDlg(&pdlg)){
-               if(pdlg.hDevMode){
+       if (PrintDlg(&pdlg)) {
+               if (pdlg.hDevMode) {
                        // \83v\83\8a\83\93\83g\83f\83o\83C\83X\83p\83\89\83\81\81[\83^\81[\82ð\8eæ\93¾\82·\82é
                        DWORD siz = GlobalSize(pdlg.hDevMode);
-                       if(m_pPrinterDeviceMode){
+                       if (m_pPrinterDeviceMode) {
                                delete m_pPrinterDeviceMode;
                        }
                        DEVMODE *pDevMode = (DEVMODE*)GlobalLock(pdlg.hDevMode);
                        m_pPrinterDeviceMode = (DEVMODE*) new BYTE[siz + 1];
                        CopyMemory(m_pPrinterDeviceMode, pDevMode, siz);
                        // \83v\83\8a\83\93\83^\96¼\82ð\95Û\91
-                       StringCbCopy(m_szPrinterName, MAX_PATH, (LPCTSTR) pDevMode->dmDeviceName);
+                       StringCchCopy(m_szPrinterName, MAX_PATH, (LPCTSTR)pDevMode->dmDeviceName);
                        varRet = pDevMode->dmDeviceName;
                        GlobalUnlock(pdlg.hDevMode);
                        GlobalFree(pdlg.hDevMode);
                }
-               if(pdlg.hDevNames){
+               if (pdlg.hDevNames) {
                        GlobalFree(pdlg.hDevNames);
                }
                // \83v\83\8a\83\93\83g\82·\82é\82©\90Ý\92è\82¾\82¯\82©?
                BOOL bPrintOut = true;
-               if(print.vt != VT_EMPTY && print.vt != VT_NULL && print.vt != VT_ERROR
-                       && varPrint.ChangeType(VT_I2,&print) == S_OK){
+               if (print.vt != VT_EMPTY && print.vt != VT_NULL && print.vt != VT_ERROR
+                       && varPrint.ChangeType(VT_I2, &print) == S_OK) {
                        bPrintOut = varPrint.iVal;
                }
                CDC dc;
                dc.m_bPrinting = true;
-               dc.m_hDC       = pdlg.hDC;
-               if(bPrintOut){
+               dc.m_hDC = pdlg.hDC;
+               if (bPrintOut) {
                        PrintCore(dc);
                }
                DeleteDC(dc.m_hDC);
@@ -108,16 +107,16 @@ STDMETHODIMP CCanvas::PrintAs(VARIANT print,VARIANT* pRet)
 
 STDMETHODIMP CCanvas::Print()
 {
-       if(!m_pPrinterDeviceMode){
+       if (!m_pPrinterDeviceMode) {
                // \82Ü\82¾\83v\83\8a\83\93\83^\83f\83o\83C\83X\82ð\83I\81[\83v\83\93\82µ\82Ä\82¢\82È\82¢
                CComVariant dmy;
-               PrintAs(dmy,&dmy);
+               PrintAs(dmy, &dmy);
        }
-       else{
+       else {
                // \82·\82Å\82É\8eæ\93¾\82³\82ê\82½\83v\83\8a\83\93\83^\96¼\82Æ\83f\83o\83C\83X\83p\83\89\83\81\81[\83^\81[\82Å\88ó\8dü\82·\82é
-               HDC hdc = CreateDC(NULL,m_szPrinterName,NULL,m_pPrinterDeviceMode);
+               HDC hdc = CreateDC(NULL, m_szPrinterName, NULL, m_pPrinterDeviceMode);
                CDC dc;
-               dc.m_hDC       = hdc;
+               dc.m_hDC = hdc;
                dc.m_bPrinting = true;
                PrintCore(dc);
                DeleteDC(dc.m_hDC);
@@ -127,33 +126,32 @@ STDMETHODIMP CCanvas::Print()
 
 BOOL CCanvas::PrintCore(CDC dc)
 {
-       ::SetCursor(::LoadCursor(NULL,IDC_WAIT));
+       ::SetCursor(::LoadCursor(NULL, IDC_WAIT));
        // \83v\83\8a\83\93\83^\82Ì\83I\81[\83v\83\93
        DOCINFO dinfo = {0};
        dinfo.cbSize = sizeof(DOCINFO);
        dinfo.lpszDocName = _TEXT("SeraphyScriptTools");
-       int nJob = StartDoc(dc.m_hDC,&dinfo);
+       int nJob = StartDoc(dc.m_hDC, &dinfo);
        StartPage(dc.m_hDC);
        // \88ó\8dü\94Í\88Í\82Ì\90Ý\92è
-       SetMapMode(dc.m_hDC,MM_LOMETRIC);
-       int width  = GetDeviceCaps(dc.m_hDC,PHYSICALWIDTH);
-       int height = GetDeviceCaps(dc.m_hDC,PHYSICALHEIGHT);
-       SetViewportOrgEx(dc.m_hDC,0,height,NULL);
-       SetWindowOrgEx(dc.m_hDC,-m_marginWidth,-m_marginHeight,NULL);
+       SetMapMode(dc.m_hDC, MM_LOMETRIC);
+       int width = GetDeviceCaps(dc.m_hDC, PHYSICALWIDTH);
+       int height = GetDeviceCaps(dc.m_hDC, PHYSICALHEIGHT);
+       SetViewportOrgEx(dc.m_hDC, 0, height, NULL);
+       SetWindowOrgEx(dc.m_hDC, -m_marginWidth, -m_marginHeight, NULL);
        // \94w\8ci\83\82\81[\83h\90Ý\92è
-       SetBkMode(dc.m_hDC,TRANSPARENT);
+       SetBkMode(dc.m_hDC, TRANSPARENT);
        // \83\8c\83C\83\84\81[\82Ì\88ó\8dü
-       dc.m_rct.bottom = GetDeviceCaps(dc.m_hDC,VERTSIZE) * 10;
-       dc.m_rct.right  = GetDeviceCaps(dc.m_hDC,HORZSIZE) * 10;
-       dc.m_rct.bottom +=  - (m_marginHeight * 2); // \83r\83\85\81[\83|\81[\83g\82Ì\90Ý\92è\82Å\8fc\97]\94\92\82³\82ê\82Ä\82¢\82é\82Ì\82ð\83L\83\83\83\93\83Z\83\8b\82·\82é
-       int i;
-       for(i=0;i<MAXLAYER;i++){
+       dc.m_rct.bottom = GetDeviceCaps(dc.m_hDC, VERTSIZE) * 10;
+       dc.m_rct.right = GetDeviceCaps(dc.m_hDC, HORZSIZE) * 10;
+       dc.m_rct.bottom += -(m_marginHeight * 2); // \83r\83\85\81[\83|\81[\83g\82Ì\90Ý\92è\82Å\8fc\97]\94\92\82³\82ê\82Ä\82¢\82é\82Ì\82ð\83L\83\83\83\93\83Z\83\8b\82·\82é
+       for (int i = 0; i < MAXLAYER; i++) {
                m_pComLayer[i]->Draw(dc);
        }
        // \8fI\97¹
        EndPage(dc.m_hDC);
        EndDoc(dc.m_hDC);
-       ::SetCursor(::LoadCursor(NULL,IDC_ARROW));
+       ::SetCursor(::LoadCursor(NULL, IDC_ARROW));
        return true;
 }
 
@@ -161,13 +159,13 @@ STDMETHODIMP CCanvas::GetPrinterDefault(VARIANT name)
 {
        CComVariant varName;
        ATL::CString szPrinterName(_TEXT(""));
-       if (varName.ChangeType(VT_BSTR,&name) == S_OK) {
+       if (SUCCEEDED(varName.ChangeType(VT_BSTR, &name))) {
                szPrinterName = varName.bstrVal;
        }
        else {
                DWORD namesz = MAX_PATH;
                LPTSTR pName = szPrinterName.GetBufferSetLength(namesz);
-               if (!GetDefaultPrinter(pName, &namesz)){
+               if (!GetDefaultPrinter(pName, &namesz)) {
                        // \8aù\92è\82Ì\83v\83\8a\83\93\83^\82ª\8c©\82Â\82©\82ç\82È\82©\82Á\82½\8fê\8d\87
                        return Error(IDS_ERR_NODEFPRINTER);
                }
@@ -182,16 +180,18 @@ STDMETHODIMP CCanvas::GetPrinterDefault(VARIANT name)
                }
 
                // \95K\97v\82È\83p\83\89\83\81\81[\83^\81[\82Ì\95Û\8e\9d
-               DWORD sz = (DWORD)DocumentProperties(m_hParent, hp, szPrinterName.GetBuffer(), NULL, NULL, 0);
-               m_pPrinterDeviceMode = (DEVMODE*)new BYTE[sz+1];
+               DWORD sz = (DWORD)DocumentProperties(
+                       m_hParent, hp, szPrinterName.GetBuffer(), NULL, NULL, 0);
+               m_pPrinterDeviceMode = (DEVMODE*)new BYTE[sz + 1];
 
-               DocumentProperties(m_hParent, hp, szPrinterName.GetBuffer(), m_pPrinterDeviceMode, NULL, DM_OUT_BUFFER);
+               DocumentProperties(m_hParent, hp, szPrinterName.GetBuffer(),
+                       m_pPrinterDeviceMode, NULL, DM_OUT_BUFFER);
                ClosePrinter(hp);
 
                // \83v\83\8a\83\93\83^\96¼\82Ì\95Û\91
-               lstrcpy(m_szPrinterName, szPrinterName);
+               StringCchCopy(m_szPrinterName, MAX_PATH, szPrinterName);
        }
-       else{
+       else {
                // \83v\83\8a\83\93\83^\8fî\95ñ\82Ì\8eæ\93¾\82É\8e¸\94s\82µ\82½\8fê\8d\87
                return Error(IDS_ERR_PRINTERSETTING);
        }
@@ -222,28 +222,28 @@ STDMETHODIMP CCanvas::put_MarginHeight(long newVal)
        return S_OK;
 }
 
-void CCanvas::Draw(HDC hdc,RECT& rt)
+void CCanvas::Draw(HDC hdc, RECT& rt)
 {
        // \83}\83b\83s\83\93\83O\83\82\81[\83h
        int md = GetMapMode(hdc);
-       SetMapMode(hdc,MM_LOMETRIC);
-       POINT oldPort,oldWindow;
-       SetViewportOrgEx(hdc,0,rt.bottom,&oldPort);
-       SetWindowOrgEx(hdc,0,0,&oldWindow);
+       SetMapMode(hdc, MM_LOMETRIC);
+       POINT oldPort, oldWindow;
+       SetViewportOrgEx(hdc, 0, rt.bottom, &oldPort);
+       SetWindowOrgEx(hdc, 0, 0, &oldWindow);
        // \83\8c\83C\83\84\81[\83I\83u\83W\83F\83N\83g\82É\95`\89æ\82ð\8ds\82í\82¹\82é
        CDC dc;
-       dc.m_hDC       = hdc;
+       dc.m_hDC = hdc;
        dc.m_bPrinting = false;
-       dc.m_rct       = rt;
+       dc.m_rct = rt;
        int i;
-       for(i=0 ; i<MAXLAYER ; i++){
-               if(m_pComLayer[i] != NULL){
+       for (i = 0; i < MAXLAYER; i++) {
+               if (m_pComLayer[i] != NULL) {
                        m_pComLayer[i]->Draw(dc);
                }
        }
-       SetWindowOrgEx(hdc,oldWindow.x,oldWindow.y,NULL);
-       SetViewportOrgEx(hdc,oldPort.x,oldPort.y,NULL);
-       SetMapMode(hdc,md);
+       SetWindowOrgEx(hdc, oldWindow.x, oldWindow.y, NULL);
+       SetViewportOrgEx(hdc, oldPort.x, oldPort.y, NULL);
+       SetMapMode(hdc, md);
 }
 
 void CCanvas::DetachOwner()
@@ -263,15 +263,14 @@ STDMETHODIMP CCanvas::LoadPicture(VARIANT file, VARIANT *punkVal)
 {
        ::VariantInit(punkVal);
        CComVariant varFile;
-       if(varFile.ChangeType(VT_BSTR,&file) != S_OK){
+       if (varFile.ChangeType(VT_BSTR, &file) != S_OK) {
                return DISP_E_TYPEMISMATCH;
        }
        IPicture* pPicture = NULL;
-       if(OleLoadPicturePath(varFile.bstrVal,NULL,0,NULL,IID_IPicture,(void**)&pPicture) != S_OK){
-               ErrorInfo(IDS_ERR_PICTURELOADFAIL);
-               return DISP_E_EXCEPTION;
+       if (OleLoadPicturePath(varFile.bstrVal, NULL, 0, NULL, IID_IPicture, (void**)&pPicture) != S_OK) {
+               return Error(IDS_ERR_PICTURELOADFAIL);
        }
-       punkVal->vt      = VT_UNKNOWN;
+       punkVal->vt = VT_UNKNOWN;
        punkVal->punkVal = pPicture; // (IUnknown*)
        return S_OK;
 }
diff --git a/Draw.h b/Draw.h
index ec45291..b73ceae 100644 (file)
--- a/Draw.h
+++ b/Draw.h
@@ -1,7 +1,6 @@
 // Draw.h : CCanvas \82Ì\90é\8c¾
 
-#ifndef __DRAW_H_
-#define __DRAW_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include "layer.h"
@@ -11,7 +10,7 @@
 
 #define MAXLAYER 256
 
-class ATL_NO_VTABLE CCanvas : 
+class ATL_NO_VTABLE CCanvas :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CCanvas, &CLSID_Canvas>,
        public ISupportErrorInfo,
@@ -25,15 +24,15 @@ public:
                m_hParent = NULL;
                // \88ó\8dü\8aÖ\98A
                m_pPrinterDeviceMode = NULL;
-               m_marginWidth    = 150; // 1.5Cm\82Ì\83}\81[\83W\83\93
-               m_marginHeight   = 150;
+               m_marginWidth = 150; // 1.5Cm\82Ì\83}\81[\83W\83\93
+               m_marginHeight = 150;
                // \83\8c\83C\83\84\81[\82Ì\8f\89\8aú\89»
                int i;
-               for(i=0 ; i<MAXLAYER ; i++){
-                       if(m_pComLayer[i]->CreateInstance(&m_pComLayer[i]) == S_OK){
+               for (i = 0; i < MAXLAYER; i++) {
+                       if (m_pComLayer[i]->CreateInstance(&m_pComLayer[i]) == S_OK) {
                                m_pComLayer[i]->AddRef();
                        }
-                       else{
+                       else {
                                // \90\90¬\82É\8e¸\94s\81B
                                m_pComLayer[i] = NULL;
                        }
@@ -41,29 +40,29 @@ public:
        }
        void CCanvas::FinalRelease();
 
-DECLARE_REGISTRY_RESOURCEID(IDR_CANVAS)
+       DECLARE_REGISTRY_RESOURCEID(IDR_CANVAS)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CCanvas)
-       COM_INTERFACE_ENTRY(ICanvas)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-END_COM_MAP()
-BEGIN_CONNECTION_POINT_MAP(CCanvas)
-END_CONNECTION_POINT_MAP()
+       BEGIN_COM_MAP(CCanvas)
+               COM_INTERFACE_ENTRY(ICanvas)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+       END_COM_MAP()
+       BEGIN_CONNECTION_POINT_MAP(CCanvas)
+       END_CONNECTION_POINT_MAP()
 
 
-// ISupportsErrorInfo
+       // ISupportsErrorInfo
        STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
 
-// ICanvas
+       // ICanvas
 public:
        STDMETHOD(LoadPicture)(/*[in]*/VARIANT path,/*[out,retval]*/VARIANT* punkVal);
        void AttachOwner(HWND hParent);
        void DetachOwner();
-       void Draw(HDC hdc,RECT& rt);
+       void Draw(HDC hdc, RECT& rt);
        STDMETHOD(get_Layer)(/*[in]*/VARIANT varLay, /*[out, retval]*/ VARIANT *pVal);
        STDMETHOD(Print)();
        STDMETHOD(GetPrinterDefault)(/*[in,optional]*/VARIANT name);
@@ -81,5 +80,3 @@ protected:
        BOOL PrintCore(CDC dc);
        HWND m_hParent;
 };
-
-#endif //__DRAW_H_
index d7247cf..b1c0ae8 100644 (file)
--- a/Event.cpp
+++ b/Event.cpp
@@ -7,21 +7,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // CEvent
 
-STDMETHODIMP CEvent::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_IEvent
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
-
 STDMETHODIMP CEvent::get_Message(short *pVal)
 {
        *pVal = m_message;
@@ -71,134 +56,134 @@ STDMETHODIMP CEvent::get_time(DATE *pVal)
        return S_OK;
 }
 
-void CEvent::SetData(short message, short wParam,DWORD lParam,POINT& pt,POINT& lp)
+void CEvent::SetData(short message, short wParam, DWORD lParam, POINT& pt, POINT& lp)
 {
        SYSTEMTIME systim;
        GetLocalTime(&systim);
-       SystemTimeToVariantTime(&systim,&m_time);
-       m_ptDP    = pt;
-       m_ptLP    = lp;
+       SystemTimeToVariantTime(&systim, &m_time);
+       m_ptDP = pt;
+       m_ptLP = lp;
        m_message = message;
-       m_param   = wParam;
-       m_lparam  = lParam;
+       m_param = wParam;
+       m_lparam = lParam;
 }
 
 STDMETHODIMP CEvent::IsMouseMove(BOOL *pResult)
 {
-       *pResult = (m_message == WM_MOUSEMOVE)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_MOUSEMOVE) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsClick(BOOL *pResult)
 {
-       *pResult = (m_message == WM_LBUTTONDOWN)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_LBUTTONDOWN) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsRClick(BOOL *pResult)
 {
-       *pResult = (m_message == WM_RBUTTONDOWN)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_RBUTTONDOWN) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsClickCancel(BOOL *pResult)
 {
        *pResult = (m_message == WM_CAPTURECHANGED &&
-                               m_param   == 1 )?VB_TRUE:VB_FALSE;
+               m_param == 1) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsRClickCancel(BOOL *pResult)
 {
        *pResult = (m_message == WM_CAPTURECHANGED &&
-                               m_param   == 2 )?VB_TRUE:VB_FALSE;
+               m_param == 2) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsClickOut(BOOL *pResult)
 {
-       *pResult = (m_message == WM_LBUTTONUP)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_LBUTTONUP) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsRClickOut(BOOL *pResult)
 {
-       *pResult = (m_message == WM_RBUTTONUP)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_RBUTTONUP) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsCommand(BOOL *pResult)
 {
        *pResult = (m_message == WM_COMMAND &&
-                           (m_param > IDABORT) )?VB_TRUE:VB_FALSE;
+               (m_param > IDABORT)) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsTimer(BOOL *pResult)
 {
-       *pResult = (m_message == WM_TIMER)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_TIMER) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsSize(BOOL *pResult)
 {
-       *pResult = (m_message == WM_SIZE)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_SIZE) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsExit(BOOL *pResult)
 {
        *pResult = (m_message == WM_COMMAND &&
-                               m_param   == IDABORT)?VB_TRUE:VB_FALSE;
+               m_param == IDABORT) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsOK(BOOL *pResult)
 {
        *pResult = (m_message == WM_COMMAND &&
-                               m_param   == IDOK)?VB_TRUE:VB_FALSE;
+               m_param == IDOK) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsCancel(BOOL *pResult)
 {
        *pResult = (m_message == WM_COMMAND &&
-                               m_param   == IDCANCEL)?VB_TRUE:VB_FALSE;
+               m_param == IDCANCEL) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsDblClick(BOOL *pResult)
 {
-       *pResult = (m_message == WM_LBUTTONDBLCLK)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_LBUTTONDBLCLK) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsRDblClick(BOOL *pResult)
 {
-       *pResult = (m_message == WM_RBUTTONDBLCLK)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_RBUTTONDBLCLK) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsContextMenu(BOOL *pResult)
 {
-       *pResult = (m_message == WM_NOTIFY && m_lparam == VK_RBUTTON)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_NOTIFY && m_lparam == VK_RBUTTON) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsContextDelete(BOOL *pResult)
 {
-       *pResult = (m_message == WM_NOTIFY && m_lparam == VK_DELETE)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_NOTIFY && m_lparam == VK_DELETE) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsKeydown(BOOL *pResult)
 {
-       *pResult = (m_message == WM_KEYDOWN)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_KEYDOWN) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP CEvent::IsKeydown2(BOOL *pResult)
 {
-       *pResult = (m_message == WM_KEYDOWN_EX)?VB_TRUE:VB_FALSE;
+       *pResult = (m_message == WM_KEYDOWN_EX) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
diff --git a/Event.h b/Event.h
index 9f41f78..386b10a 100644 (file)
--- a/Event.h
+++ b/Event.h
@@ -1,16 +1,15 @@
 // Event.h : CEvent \82Ì\90é\8c¾
 
-#ifndef __EVENT_H_
-#define __EVENT_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 
 /////////////////////////////////////////////////////////////////////////////
 // CEvent
-class ATL_NO_VTABLE CEvent : 
+class ATL_NO_VTABLE CEvent :
        public CComObjectRootEx<CComSingleThreadModel>,
-//     public CComCoClass<CEvent, &CLSID_Event>,
-       public ISupportErrorInfo,
+       public CComCoClass<CEvent, &CLSID_Event>,
+       public ISupportErrorInfoImpl<&IID_IEvent>,
        public IConnectionPointContainerImpl<CEvent>,
        public IDispatchImpl<IEvent, &IID_IEvent, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
@@ -18,33 +17,29 @@ public:
        CEvent()
        {
                m_message = 0;
-               m_param   = 0;
-               m_lparam  = 0;
-               m_time    = 0.;
-               m_ptDP.x  = 0;
-               m_ptDP.y  = 0;
-               m_ptLP.x  = 0;
-               m_ptLP.y  = 0;
+               m_param = 0;
+               m_lparam = 0;
+               m_time = 0.;
+               m_ptDP.x = 0;
+               m_ptDP.y = 0;
+               m_ptLP.x = 0;
+               m_ptLP.y = 0;
        }
 
-//DECLARE_REGISTRY_RESOURCEID(IDR_EVENT)
+       //DECLARE_REGISTRY_RESOURCEID(IDR_EVENT)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CEvent)
-       COM_INTERFACE_ENTRY(IEvent)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-END_COM_MAP()
-BEGIN_CONNECTION_POINT_MAP(CEvent)
-END_CONNECTION_POINT_MAP()
+       BEGIN_COM_MAP(CEvent)
+               COM_INTERFACE_ENTRY(IEvent)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+       END_COM_MAP()
+       BEGIN_CONNECTION_POINT_MAP(CEvent)
+       END_CONNECTION_POINT_MAP()
 
-
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// IEvent
+       // IEvent
 public:
        STDMETHOD(IsKeydown2)(/*[out,retval]*/BOOL* pResult);
        STDMETHOD(get_DPosY)(/*[out, retval]*/ long *pVal);
@@ -68,15 +63,18 @@ public:
        STDMETHOD(IsRClick)(/*[out,retval]*/BOOL* pResult);
        STDMETHOD(IsClick)(/*[out,retval]*/BOOL* pResult);
        STDMETHOD(IsMouseMove)(/*[out,retval]*/BOOL* pResult);
-       short GetMessage(){     return m_message; }
-       short GetParam()  { return m_param;   }
-       DWORD GetLParam() { return m_lparam; }
-       void SetData(short message,short wParam,DWORD lParam,POINT& pt,POINT& lp);
        STDMETHOD(get_time)(/*[out, retval]*/ DATE *pVal);
        STDMETHOD(get_PosY)(/*[out, retval]*/ double *pVal);
        STDMETHOD(get_PosX)(/*[out, retval]*/ double *pVal);
        STDMETHOD(get_Parameter)(/*[out, retval]*/ short *pVal);
        STDMETHOD(get_Message)(/*[out, retval]*/ short *pVal);
+
+public:
+       short GetMessage(){ return m_message; }
+       short GetParam()  { return m_param; }
+       DWORD GetLParam() { return m_lparam; }
+       void SetData(short message, short wParam, DWORD lParam, POINT& pt, POINT& lp);
+
 protected:
        POINT m_ptDP;
        POINT m_ptLP;
@@ -85,5 +83,3 @@ protected:
        DWORD m_lparam;
        double m_time;
 };
-
-#endif //__EVENT_H_
index 9367b40..bec47d1 100644 (file)
--- a/Form.cpp
+++ b/Form.cpp
@@ -6,32 +6,18 @@
 /////////////////////////////////////////////////////////////////////////////
 // CForm
 
-STDMETHODIMP CForm::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_IForm
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 void CForm::FinalRelease()
 {
        ATLTRACE("CForm::FinalRelease\r\n");
        // \8f\89\8aú\89»
        ClearControls();
        // \83R\83\93\83g\83\8d\81[\83\8b\94w\8ci\83u\83\89\83V\82Ì\94j\8aü
-       if(m_hBrushControlBkColor){
+       if (m_hBrushControlBkColor) {
                DeleteObject(m_hBrushControlBkColor);
                m_hBrushControlBkColor = NULL;
        }
        // \83t\83H\83\93\83g\82Ì\94j\8aü
-       if(m_hControlFont){
+       if (m_hControlFont) {
                DeleteObject(m_hControlFont);
                m_hControlFont = NULL;
        }
@@ -42,17 +28,17 @@ STDMETHODIMP CForm::get_Control(VARIANT varNum, VARIANT *pVal)
        ::VariantInit(pVal);
        CComVariant tmp;
        int nID = -1;
-       if(tmp.ChangeType(VT_I2,&varNum) == S_OK){
+       if (tmp.ChangeType(VT_I2, &varNum) == S_OK) {
                nID = tmp.iVal;
        }
-       if(nID > 0){
+       if (nID > 0) {
                list<CComObject<CControl>*>::iterator p = m_lstControl.begin();
-               while(p != m_lstControl.end()){
-                       if((*p)->GetID() == nID){
+               while (p != m_lstControl.end()) {
+                       if ((*p)->GetID() == nID) {
                                // \93¯\88êID\82ð\94­\8c©\82µ\82½\82Ì\82Å\81A\82±\82ê\82ð\95Ô\82·
                                IUnknown* pUnk = NULL;
-                               if((*p)->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                                       pVal->vt      = VT_UNKNOWN;
+                               if ((*p)->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                                       pVal->vt = VT_UNKNOWN;
                                        pVal->punkVal = pUnk;
                                }
                                break;
@@ -67,7 +53,7 @@ STDMETHODIMP CForm::SetControlFont(VARIANT fontname, VARIANT fontsize)
 {
        CComVariant varName;
        ATL::CString szFontName;
-       if (varName.ChangeType(VT_BSTR,&fontname) == S_OK) {
+       if (varName.ChangeType(VT_BSTR, &fontname) == S_OK) {
                szFontName = varName.bstrVal;
        }
 
@@ -107,141 +93,141 @@ STDMETHODIMP CForm::SetControlFont(VARIANT fontname, VARIANT fontsize)
 STDMETHODIMP CForm::Label(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,SS_NOTIFY,0, _TEXT("STATIC"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, SS_NOTIFY, 0, _TEXT("STATIC"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::Button(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_PUSHBUTTON,0, _TEXT("BUTTON"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, WS_TABSTOP | BS_PUSHBUTTON, 0, _TEXT("BUTTON"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::CheckBox(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTOCHECKBOX,0, _TEXT("BUTTON"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, WS_TABSTOP | BS_AUTOCHECKBOX, 0, _TEXT("BUTTON"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::RadioButton(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,BS_AUTORADIOBUTTON|(m_bControlNextIsGroupHead?WS_TABSTOP:0),0, _TEXT("BUTTON"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, BS_AUTORADIOBUTTON | (m_bControlNextIsGroupHead ? WS_TABSTOP : 0), 0, _TEXT("BUTTON"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::CheckBox3state(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTO3STATE,0, _TEXT("BUTTON"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, WS_TABSTOP | BS_AUTO3STATE, 0, _TEXT("BUTTON"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::PushCheckButton(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTOCHECKBOX|BS_PUSHLIKE,0, _TEXT("BUTTON"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, WS_TABSTOP | BS_AUTOCHECKBOX | BS_PUSHLIKE, 0, _TEXT("BUTTON"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::PushRadioButton(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,0,BS_AUTORADIOBUTTON|BS_PUSHLIKE|(m_bControlNextIsGroupHead?WS_TABSTOP:0),0, _TEXT("BUTTON"));
+       CreateControlCore(text, width, dmy, pvarUnk, 0, BS_AUTORADIOBUTTON | BS_PUSHLIKE | (m_bControlNextIsGroupHead ? WS_TABSTOP : 0), 0, _TEXT("BUTTON"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::ReadonlyEdit(VARIANT text, VARIANT width, VARIANT height, VARIANT *punkVal)
 {
        DWORD style = WS_TABSTOP | ES_READONLY;
-       if(height.vt != VT_ERROR && height.vt != VT_NULL && height.vt != VT_EMPTY){
+       if (height.vt != VT_ERROR && height.vt != VT_NULL && height.vt != VT_EMPTY) {
                // \8d\82\82³\8ew\92è\82ª\82 \82é\8fê\8d\87\82Í\95¡\90\94\8ds
                style |= ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL;
        }
-       else{
+       else {
                // \92P\88ê\8ds
                style |= ES_AUTOHSCROLL;
        }
-       CreateControlCore(text,width,height,punkVal,m_bControlUseStaticEdge?WS_EX_STATICEDGE:WS_EX_CLIENTEDGE,style,0, _TEXT("EDIT"));
+       CreateControlCore(text, width, height, punkVal, m_bControlUseStaticEdge ? WS_EX_STATICEDGE : WS_EX_CLIENTEDGE, style, 0, _TEXT("EDIT"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::Edit(VARIANT text, VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        DWORD style = WS_TABSTOP;
-       if(height.vt != VT_ERROR && height.vt != VT_NULL && height.vt != VT_EMPTY){
+       if (height.vt != VT_ERROR && height.vt != VT_NULL && height.vt != VT_EMPTY) {
                // \8d\82\82³\8ew\92è\82ª\82 \82é\8fê\8d\87\82Í\95¡\90\94\8ds
                style |= ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN;
        }
-       else{
+       else {
                // \92P\88ê\8ds
                style |= ES_AUTOHSCROLL;
        }
-       CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,style,0, _TEXT("EDIT"));
+       CreateControlCore(text, width, height, pvarUnk, WS_EX_CLIENTEDGE, style, 0, _TEXT("EDIT"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::PasswordEdit(VARIANT text, VARIANT width, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(text,width,dmy,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|ES_PASSWORD,0, _TEXT("EDIT"));
+       CreateControlCore(text, width, dmy, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | ES_PASSWORD, 0, _TEXT("EDIT"));
        return S_OK;
 }
 
-STDMETHODIMP CForm::ListBox(VARIANT width, VARIANT height,VARIANT* pvarUnk)
+STDMETHODIMP CForm::ListBox(VARIANT width, VARIANT height, VARIANT* pvarUnk)
 {
        CComVariant text;
-       CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LBS_NOTIFY|LBS_USETABSTOPS|LBS_NOINTEGRALHEIGHT|LBS_DISABLENOSCROLL,0, _TEXT("LISTBOX"));
+       CreateControlCore(text, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | LBS_NOTIFY | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL, 0, _TEXT("LISTBOX"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::MultiListBox(VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        CComVariant text;
-       CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LBS_NOTIFY|LBS_USETABSTOPS|LBS_NOINTEGRALHEIGHT|LBS_MULTIPLESEL|/*LBS_EXTENDEDSEL|*/LBS_DISABLENOSCROLL|LBS_HASSTRINGS,0,_TEXT("LISTBOX"));
+       CreateControlCore(text, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | LBS_NOTIFY | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_MULTIPLESEL |/*LBS_EXTENDEDSEL|*/LBS_DISABLENOSCROLL | LBS_HASSTRINGS, 0, _TEXT("LISTBOX"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::DropdownList(VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(dmy,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|CBS_DROPDOWNLIST|CBS_SORT,0,_TEXT("COMBOBOX"));
+       CreateControlCore(dmy, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | CBS_DROPDOWNLIST | CBS_SORT, 0, _TEXT("COMBOBOX"));
        return S_OK;
 }
 
-STDMETHODIMP CForm::DropdownEdit(VARIANT text,VARIANT width, VARIANT height, VARIANT *pvarUnk)
+STDMETHODIMP CForm::DropdownEdit(VARIANT text, VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
-       CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|CBS_DROPDOWN|CBS_AUTOHSCROLL|CBS_SORT,0,_TEXT("COMBOBOX"));
+       CreateControlCore(text, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT, 0, _TEXT("COMBOBOX"));
        return S_OK;
 }
 
 STDMETHODIMP CForm::TreeView(VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(dmy,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|TVS_DISABLEDRAGDROP|TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT|TVS_SHOWSELALWAYS,0,WC_TREEVIEW);
+       CreateControlCore(dmy, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | TVS_DISABLEDRAGDROP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, 0, WC_TREEVIEW);
        return S_OK;
 }
 
-STDMETHODIMP CForm::ListView(VARIANT colum,VARIANT width, VARIANT height, VARIANT *pvarUnk)
+STDMETHODIMP CForm::ListView(VARIANT colum, VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(colum,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS,0,WC_LISTVIEW);
+       CreateControlCore(colum, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | LVS_REPORT | LVS_SHOWSELALWAYS, 0, WC_LISTVIEW);
        return S_OK;
 }
 
 STDMETHODIMP CForm::EditListView(VARIANT colum, VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(colum,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LVS_REPORT|LVS_EDITLABELS|LVS_SHOWSELALWAYS,0,WC_LISTVIEW);
+       CreateControlCore(colum, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | LVS_REPORT | LVS_EDITLABELS | LVS_SHOWSELALWAYS, 0, WC_LISTVIEW);
        return S_OK;
 }
 
 STDMETHODIMP CForm::CheckListView(VARIANT colum, VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
        CComVariant dmy;
-       CreateControlCore(colum,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LVS_SINGLESEL|LVS_REPORT,LVS_EX_CHECKBOXES|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT ,WC_LISTVIEW);
+       CreateControlCore(colum, width, height, pvarUnk, WS_EX_CLIENTEDGE, WS_TABSTOP | LVS_SINGLESEL | LVS_REPORT, LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, WC_LISTVIEW);
        return S_OK;
 }
 
@@ -249,60 +235,60 @@ STDMETHODIMP CForm::ClearControls()
 {
        // \83R\83\93\83g\83\8d\81[\83\8b\82ð\82·\82×\82Ä\94j\8aü\82·\82é
        list<CComObject<CControl>*>::iterator p = m_lstControl.begin();
-       while(p != m_lstControl.end()){
+       while (p != m_lstControl.end()) {
                (*p)->Destroy(); // \83E\83B\83\93\83h\83E\82ð\94j\8aü\82µ\8eQ\8fÆ\82ª\8ec\82Á\82Ä\82à\83A\83N\83Z\83X\95s\89Â\82É\82·\82é
                (*p)->Release();
                p = m_lstControl.erase(p);
        }
-       m_nControlNextY  = 0;
+       m_nControlNextY = 0;
        m_nControlNextY0 = 0;
-       m_nCommandID     = 10;
-       m_nControlLeftMargin  = 5;
+       m_nCommandID = 10;
+       m_nControlLeftMargin = 5;
        m_nControlRightMargin = 5;
-       m_nControlNextX  = m_nControlLeftMargin;
-       m_bControlNextIsGroupHead  = false;
+       m_nControlNextX = m_nControlLeftMargin;
+       m_bControlNextIsGroupHead = false;
        m_bControlUseStaticEdge = true;
        //
        // \83R\83\93\83g\83\8d\81[\83\8b\97p\83t\83H\83\93\83g\82Ì\8dì\90¬
-       if(m_hControlFont){
+       if (m_hControlFont) {
                DeleteObject(m_hControlFont);
        }
        m_nControlFontSize = 16;
-       m_hControlFont = CreateFont(m_nControlFontSize,0,0,0,0,false,false,false,SHIFTJIS_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,NULL);
+       m_hControlFont = CreateFont(m_nControlFontSize, 0, 0, 0, 0, false, false, false, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, NULL);
        return S_OK;
 }
 
-CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &height,VARIANT *pvarUnk, DWORD extstyle, DWORD style, DWORD afterstyle,LPCTSTR classname)
+CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &height, VARIANT *pvarUnk, DWORD extstyle, DWORD style, DWORD afterstyle, LPCTSTR classname)
 {
        CComVariant varText;
        ATL::CString szCaption;
-       if (varText.ChangeType(VT_BSTR,&text) == S_OK) {
+       if (varText.ChangeType(VT_BSTR, &text) == S_OK) {
                szCaption = varText.bstrVal;
        }
-       
+
        // \94z\92u\83T\83C\83Y\82Ì\8eæ\93¾
        int nWidth = (m_nWindowWidth - m_nControlRightMargin) - m_nControlNextX;
-       if(nWidth <= 0){
+       if (nWidth <= 0) {
                ControlBreak();
                nWidth = (m_nWindowWidth - m_nControlRightMargin) - m_nControlNextX;
        }
        CComVariant varWidth;
-       if(varWidth.ChangeType(VT_I2,&width) == S_OK){
+       if (varWidth.ChangeType(VT_I2, &width) == S_OK) {
                nWidth = varWidth.iVal * m_nControlFontSize;
-               if(nWidth + m_nControlNextX > m_nWindowWidth){
+               if (nWidth + m_nControlNextX > m_nWindowWidth) {
                        ControlBreak();
                }
        }
 
        int nHeight = m_nControlFontSize;
        CComVariant varHeight;
-       if((height.vt != VT_EMPTY && height.vt != VT_ERROR && height.vt != VT_NULL)
-               && varHeight.ChangeType(VT_I2,&height) == S_OK){
+       if ((height.vt != VT_EMPTY && height.vt != VT_ERROR && height.vt != VT_NULL)
+               && varHeight.ChangeType(VT_I2, &height) == S_OK) {
                nHeight = varHeight.iVal * m_nControlFontSize;
        }
 
        // \83O\83\8b\81[\83v\83w\83b\83_
-       if(m_bControlNextIsGroupHead){
+       if (m_bControlNextIsGroupHead) {
                style |= WS_GROUP;
                m_bControlNextIsGroupHead = false;
        }
@@ -314,13 +300,13 @@ CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &heigh
 
        // \8eQ\8fÆ\83J\83E\83\93\83g\81A\83|\83C\83\93\83^\82Ì\95Û\91
        pControl->AddRef();
-       pControl->SetParam(afterstyle,extstyle,classname,szCaption,style,m_nControlNextX,m_nControlNextY,nWidth,nHeight+6,m_nCommandID);
+       pControl->SetParam(afterstyle, extstyle, classname, szCaption, style, m_nControlNextX, m_nControlNextY, nWidth, nHeight + 6, m_nCommandID);
        // \83\8a\83X\83g\82É\93o\98^
        m_lstControl.push_back(pControl);
 
        // \83E\83B\83\93\83h\83E\82ª\90\90¬\8dÏ\82Ý\82Å\82 \82ê\82Î\81A\82½\82¾\82¿\82É\90\90¬\82ð\8ds\82¤
        // \82»\82¤\82Å\82È\82¯\82ê\82Î\83E\83B\83\93\83h\83E\90\90¬\8cã\82É\8eæ\93¾
-       if(m_hOwner){
+       if (m_hOwner) {
                pControl->Create(m_hOwner);
                pControl->SetFont(m_hControlFont);
                pControl->SetColor(m_dwControlColor);
@@ -328,10 +314,10 @@ CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &heigh
 
        // \82±\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\96ß\82è\92l\82Æ\82·\82é
        IUnknown* pUnk = NULL;
-       hRet = pControl->QueryInterface(IID_IUnknown,(void**)&pUnk);
+       hRet = pControl->QueryInterface(IID_IUnknown, (void**)&pUnk);
        ATLASSERT(hRet == S_OK);
        ::VariantInit(pvarUnk);
-       pvarUnk->vt      = VT_UNKNOWN;
+       pvarUnk->vt = VT_UNKNOWN;
        pvarUnk->punkVal = pUnk;
 
        // \8e\9f\82É\89ü\8ds\82µ\82½\82Æ\82«\82É\88Ú\93®\82·\82é\97Ê
@@ -340,12 +326,12 @@ CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &heigh
                nHeight = m_nControlFontSize;
        }
        int ny = m_nControlNextY + nHeight + 7;
-       if(m_nControlNextY0 < ny){
+       if (m_nControlNextY0 < ny) {
                m_nControlNextY0 = ny;
        }
        // \8d\95û\8cü\82Ö\89ü\8ds\82·\82é
        m_nControlNextX += nWidth + 2;
-       if(m_nControlNextX >= m_nWindowWidth){
+       if (m_nControlNextX >= m_nWindowWidth) {
                // \83I\81[\83o\81[\82µ\82½\82ç\90Ü\82è\95Ô\82·\81B
                ControlBreak();
        }
@@ -381,12 +367,12 @@ STDMETHODIMP CForm::ControlGroup()
 STDMETHODIMP CForm::ControlPad(VARIANT width, VARIANT height)
 {
        // \8bó\94\92\82ð\82Â\82­\82é
-       CComVariant varWidth,varHeight;
-       if(varHeight.ChangeType(VT_I2,&height) == S_OK){
+       CComVariant varWidth, varHeight;
+       if (varHeight.ChangeType(VT_I2, &height) == S_OK) {
                ControlBreak();
                m_nControlNextY += varHeight.iVal;
        }
-       if(varWidth.ChangeType(VT_I2,&width) == S_OK){
+       if (varWidth.ChangeType(VT_I2, &width) == S_OK) {
                m_nControlNextX += varWidth.iVal;
        }
        return S_OK;
@@ -395,7 +381,7 @@ STDMETHODIMP CForm::ControlPad(VARIANT width, VARIANT height)
 
 STDMETHODIMP CForm::StatusLabel(VARIANT text, VARIANT width, VARIANT height, VARIANT *pvarUnk)
 {
-       CreateControlCore(text,width,height,pvarUnk,m_bControlUseStaticEdge?WS_EX_STATICEDGE:WS_EX_CLIENTEDGE,SS_NOTIFY,0,_TEXT("STATIC"));
+       CreateControlCore(text, width, height, pvarUnk, m_bControlUseStaticEdge ? WS_EX_STATICEDGE : WS_EX_CLIENTEDGE, SS_NOTIFY, 0, _TEXT("STATIC"));
        return S_OK;
 }
 
@@ -403,8 +389,8 @@ STDMETHODIMP CForm::ControlUseStaticEdge(VARIANT mode)
 {
        int nMode = true;
        CComVariant varMode;
-       if((mode.vt != VT_EMPTY && mode.vt != VT_ERROR && mode.vt != VT_NULL)
-               && (varMode.ChangeType(VT_I2,&mode) == S_OK)){
+       if ((mode.vt != VT_EMPTY && mode.vt != VT_ERROR && mode.vt != VT_NULL)
+               && (varMode.ChangeType(VT_I2, &mode) == S_OK)) {
                nMode = varMode.iVal;
        }
        m_bControlUseStaticEdge = nMode;
@@ -416,7 +402,7 @@ void CForm::AttachOwner(HWND hOwner)
        m_hOwner = hOwner;
        // \8e\96\91O\8dì\90¬\82³\82ê\82Ä\82¢\82½\83R\83\93\83g\83\8d\81[\83\8b\82ð\82·\82×\82Ä\90\90¬\82·\82é
        list<CComObject<CControl>*>::iterator p = m_lstControl.begin();
-       while(p != m_lstControl.end()){
+       while (p != m_lstControl.end()) {
                (*p)->Create(hOwner);
                (*p)->SetFont(m_hControlFont);
                (*p)->SetColor(m_dwControlColor);
@@ -432,12 +418,22 @@ void CForm::DetachOwner()
        m_hOwner = NULL;
 }
 
-void CForm::SetWindowSize(int width, int height,BOOL bThick)
+void CForm::SetWindowSize(int width, int height, DWORD style, DWORD styleEx)
 {
        // \83E\83B\83\93\83h\83E\82Ì\83T\83C\83Y\82ð\8ew\92è\82·\82é
        // \82½\82¾\82µ\81A\8e©\93®\93I\82É\8d\89E\82Ì\98g\95ª\82ð\88ø\82­
-       m_nWindowWidth  = width - (GetSystemMetrics(bThick?SM_CXSIZEFRAME:SM_CXFIXEDFRAME) * 2);
-       m_nWindowHeight = height- (GetSystemMetrics(bThick?SM_CYSIZEFRAME:SM_CYFIXEDFRAME) * 2);
+
+       // \81¦ Windows\82Ì\98g\95\9d\82Ì\8eZ\92è\95û\96@\95Ï\8dX.(2015/08)
+       // \83N\83\89\83C\83A\83\93\83g\95\9d\82ð\89¼\92è\82µ\82Ä\83E\83B\83\93\83h\83E\95\9d\82ð\8b\81\82ß\82½\82 \82Æ\81A
+       // \82»\82Ì\8d·\82©\82ç\8eÀ\8dÛ\82Ì\98g\95\9d\82ð\8b\81\82ß\82é\81B
+       RECT rct = {0, 0, width, height};
+       AdjustWindowRectEx(&rct, style, false, styleEx);
+
+       int diff_w = rct.right - width;
+       int diff_h = rct.bottom - height;
+
+       m_nWindowWidth = width - diff_w * 2;
+       m_nWindowHeight = height - diff_h * 2;
 }
 
 STDMETHODIMP CForm::get_RightMargin(short *pVal)
@@ -455,12 +451,12 @@ STDMETHODIMP CForm::put_RightMargin(short newVal)
 void CForm::EnableAllControl(BOOL mode)
 {
        // \91S\83R\83\93\83g\83\8d\81[\83\8b\82Ì\83C\83l\81[\83u\83\8b\81E\83f\83B\83Z\81[\83u\83\8b\82Ì\90Ø\91Ö
-       if(!::IsWindow(m_hOwner)){
+       if (!::IsWindow(m_hOwner)) {
                // \83\81\83C\83\93\83E\83B\83\93\83h\83E\82ª\8dì\90¬\82³\82ê\82Ä\82¢\82È\82¯\82ê\82Î\89½\82à\82µ\82È\82¢
                return;
        }
        list<CComObject<CControl>*>::iterator p = m_lstControl.begin();
-       while(p != m_lstControl.end()){
+       while (p != m_lstControl.end()) {
                (*p)->put_Enable(mode);
                p++;
        }
@@ -474,7 +470,7 @@ STDMETHODIMP CForm::get_ControlColor(long *pVal)
 
 STDMETHODIMP CForm::put_ControlColor(long newVal)
 {
-       if(m_hBrushControlBkColor){
+       if (m_hBrushControlBkColor) {
                DeleteObject(m_hBrushControlBkColor);
        }
        m_hBrushControlBkColor = CreateSolidBrush(m_dwControlColor);
@@ -497,8 +493,8 @@ BOOL CForm::FindControlEventName(int eventcode, BSTR *pEventName)
        // pEventName\82Í\8f\89\8aú\89»\82³\82ê\82Ä\82¢\82È\82¢BSTR\82Ö\82Ì\83|\83C\83\93\83^\82ð\93n\82·
        // \8cÄ\82Ñ\8fo\82µ\8c³\82Ítrue\82ª\8bA\82Á\82½\82ç\81A\82±\82ÌBSTR\82ð\89ð\95ú\82·\82é\95K\97v\82ª\82 \82é
        list<CComObject<CControl>*>::iterator p = m_lstControl.begin();
-       while(p != m_lstControl.end()){
-               if((*p)->GetID() == eventcode){
+       while (p != m_lstControl.end()) {
+               if ((*p)->GetID() == eventcode) {
                        (*p)->GetClassEvent(pEventName);
                        return true;
                }
diff --git a/Form.h b/Form.h
index 0b33122..e1c064d 100644 (file)
--- a/Form.h
+++ b/Form.h
@@ -1,7 +1,6 @@
 // Form.h : CForm \82Ì\90é\8c¾
 
-#ifndef __FORM_H_
-#define __FORM_H_
+#pragma once
 
 #include <list>
 using namespace std;
@@ -11,10 +10,10 @@ using namespace std;
 
 /////////////////////////////////////////////////////////////////////////////
 // CForm
-class ATL_NO_VTABLE CForm : 
+class ATL_NO_VTABLE CForm :
        public CComObjectRootEx<CComSingleThreadModel>,
-//     public CComCoClass<CForm, &CLSID_Form>,
-       public ISupportErrorInfo,
+       public CComCoClass<CForm, &CLSID_Form>,
+       public ISupportErrorInfoImpl<&IID_IForm>,
        public IConnectionPointContainerImpl<CForm>,
        public IDispatchImpl<IForm, &IID_IForm, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
@@ -26,32 +25,29 @@ public:
                m_hBrushControlBkColor = CreateSolidBrush(m_dwControlColor);
                ClearControls(); // \8f\89\8aú\89»\82·\82é
                // \83f\83B\83t\83H\83\8b\83g\82Ì\83E\83B\83\93\83h\83E\82Ì\83T\83C\83Y
-               m_nWindowWidth  = 0;
+               m_nWindowWidth = 0;
                m_nWindowHeight = 0;
        }
        void FinalRelease();
 
-//DECLARE_REGISTRY_RESOURCEID(IDR_FORM)
+       //DECLARE_REGISTRY_RESOURCEID(IDR_FORM)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CForm)
-       COM_INTERFACE_ENTRY(IForm)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-END_COM_MAP()
-BEGIN_CONNECTION_POINT_MAP(CForm)
-END_CONNECTION_POINT_MAP()
+       BEGIN_COM_MAP(CForm)
+               COM_INTERFACE_ENTRY(IForm)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+       END_COM_MAP()
+       BEGIN_CONNECTION_POINT_MAP(CForm)
+       END_CONNECTION_POINT_MAP()
 
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// IForm
+       // IForm
 public:
        HWND GetAttachedOwner();
-       BOOL FindControlEventName(int eventcode,BSTR* pEventName);
+       BOOL FindControlEventName(int eventcode, BSTR* pEventName);
        HBRUSH GetControlColorBrush();
        DWORD GetControlColor();
        STDMETHOD(get_ControlColor)(/*[out, retval]*/ long *pVal);
@@ -67,7 +63,7 @@ public:
        void EnableAllControl(BOOL mode);
        STDMETHOD(get_RightMargin)(/*[out, retval]*/ short *pVal);
        STDMETHOD(put_RightMargin)(/*[in]*/ short newVal);
-       void SetWindowSize(int width,int height,BOOL bThick);
+       void SetWindowSize(int width, int height, DWORD style, DWORD styleEx);
        void DetachOwner();
        void AttachOwner(HWND hOwner);
        STDMETHOD(get_Control)(/*[in]*/VARIANT varNum, /*[out, retval]*/ VARIANT *pVal);
@@ -111,5 +107,3 @@ protected:
        DWORD m_dwControlColor;
        HBRUSH m_hBrushControlBkColor;
 };
-
-#endif //__FORM_H_
index 1148d71..aeb2c10 100644 (file)
@@ -12,19 +12,19 @@ CInstance::CInstance()
 {
        // \83\81\83C\83\93\83E\83B\83\93\83h\83E\82Ì\90\90¬
        m_pMainWindow = NULL;
-       if(m_pMainWindow->CreateInstance(&m_pMainWindow) == S_OK){
+       if (m_pMainWindow->CreateInstance(&m_pMainWindow) == S_OK) {
                m_pMainWindow->AddRef();
                // \83I\81[\83o\81[\83\89\83b\83v\83E\83B\83\93\83h\83E\83\8a\83X\83g\82É\92Ç\89Á
                m_lstOverlappedWnd.push_back(m_pMainWindow);
        }
        // \83R\83\82\83\93\83_\83C\83A\83\8d\83O\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\90\90¬
        m_pCommDlg = NULL;
-       if(m_pCommDlg->CreateInstance(&m_pCommDlg) == S_OK){
+       if (m_pCommDlg->CreateInstance(&m_pCommDlg) == S_OK) {
                m_pCommDlg->AddRef();
                // \83\81\83C\83\93\83E\83B\83\93\83h\83E\82ð\83R\83\82\83\93\83_\83C\83A\83\8d\83O\83C\83\93\83^\81[\83t\83F\83C\83X\82É\90Ú\91±\82·\82é
-               if(m_pMainWindow){
+               if (m_pMainWindow) {
                        IUnknown* pUnk = NULL;
-                       if(m_pMainWindow->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
+                       if (m_pMainWindow->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
                                CComVariant varUnk(pUnk);
                                m_pCommDlg->SetMainWindow(varUnk);
                        }
@@ -38,18 +38,18 @@ void CInstance::FinalRelease()
 {
        ATLTRACE("CInstance::FinalRelease\r\n");
        // \83\81\83C\83\93\83E\83B\83\93\83h\83E\82Ì\89ð\95ú
-       if(m_pMainWindow){
+       if (m_pMainWindow) {
                m_pMainWindow->Release();
                m_pMainWindow = NULL;
        }
        // \83R\83\82\83\93\83_\83C\83A\83\8d\83O\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\89ð\95ú
-       if(m_pCommDlg){
+       if (m_pCommDlg) {
                m_pCommDlg->Release();
                m_pCommDlg = NULL;
        }
        // \83|\83b\83v\83A\83b\83v\83E\83B\83\93\83h\83E\82Ì\89ð\95ú
        list<CComObject<COverlappedWindow>*>::iterator p = m_lstOverlappedWnd.begin();
-       while(p != m_lstOverlappedWnd.end()){
+       while (p != m_lstOverlappedWnd.end()) {
                (*p)->Close();
                (*p)->Release();
                p = m_lstOverlappedWnd.erase(p);
@@ -60,10 +60,10 @@ STDMETHODIMP CInstance::get_Dialog(VARIANT *pVal)
 {
        // \83R\83\82\83\93\83_\83C\83A\83\8d\83O\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\95Ô\82·
        ::VariantInit(pVal);
-       if(m_pCommDlg){
+       if (m_pCommDlg) {
                IUnknown *pUnk = NULL;
-               if(m_pCommDlg->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                       pVal->vt      = VT_UNKNOWN;
+               if (m_pCommDlg->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                       pVal->vt = VT_UNKNOWN;
                        pVal->punkVal = pUnk;
                }
        }
@@ -75,12 +75,12 @@ STDMETHODIMP CInstance::CreateFrame(VARIANT *pvarUnk)
        ::VariantInit(pvarUnk);
        // \8eQ\8fÆ\83J\83E\83\93\83g\82ª1\82Â\82µ\82©\82È\82¢\83E\83B\83\93\83h\83E\82Ì\94j\8aü\82ð\8ds\82¤
        list<CComObject<COverlappedWindow>*>::iterator p = m_lstOverlappedWnd.begin();
-       while(p != m_lstOverlappedWnd.end()){
-               if((*p)->m_dwRef == 1){
+       while (p != m_lstOverlappedWnd.end()) {
+               if ((*p)->m_dwRef == 1) {
                        // \8eQ\8fÆ\83J\83E\83\93\83g\82ª1\82µ\82©\82È\82¢ = \82±\82Ì\83N\83\89\83X\82µ\82©\8eg\82Á\82Ä\82¢\82È\82¢ = \95s\97v
                        BOOL bVisible = false;
                        (*p)->get_Visible(&bVisible);
-                       if(!bVisible){
+                       if (!bVisible) {
                                // \95\\8e¦\82³\82ê\82Ä\82¢\82È\82¯\82ê\82Î\8fÁ\82µ\82Ä\82æ\82µ\81B
                                (*p)->Release();
                                p = m_lstOverlappedWnd.erase(p);
@@ -91,14 +91,14 @@ STDMETHODIMP CInstance::CreateFrame(VARIANT *pvarUnk)
        }
        // \83E\83B\83\93\83h\83E\82Ì\90\90¬
        CComObject<COverlappedWindow>* pNewWnd = NULL;
-       if(pNewWnd->CreateInstance(&pNewWnd) == S_OK){
+       if (pNewWnd->CreateInstance(&pNewWnd) == S_OK) {
                pNewWnd->AddRef();
                pNewWnd->put_WaitCursor(m_dWaitCursor);
                m_lstOverlappedWnd.push_back(pNewWnd);
                // \83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8eæ\93¾
                IUnknown* pUnk = NULL;
-               if(pNewWnd->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                       pvarUnk->vt      = VT_UNKNOWN;
+               if (pNewWnd->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                       pvarUnk->vt = VT_UNKNOWN;
                        pvarUnk->punkVal = pUnk;
                }
        }
@@ -111,36 +111,36 @@ STDMETHODIMP CInstance::WaitEvent(VARIANT varTim, VARIANT *pvarUnk)
        // \91Ò\8b@\8e\9e\8aÔ\82Ì\8eæ\93¾
        DWORD sleeptim = 1000;
        CComVariant tim;
-       if(tim.ChangeType(VT_I4,&varTim) == S_OK){
+       if (tim.ChangeType(VT_I4, &varTim) == S_OK) {
                sleeptim = (DWORD)tim.lVal;
        }
-       if(sleeptim == 0){
+       if (sleeptim == 0) {
                sleeptim = INFINITE;
        }
        // \82·\82×\82Ä\82Ì\83|\83b\83v\83A\83b\83v\83E\83B\83\93\83h\83E\82Ì\83C\83x\83\93\83g\83n\83\93\83h\83\8b\82ð\8eæ\93¾\82·\82é
-       HANDLE hEvent[MAXIMUM_WAIT_OBJECTS] = { NULL };
-       HWND   hWnd  [MAXIMUM_WAIT_OBJECTS] = { NULL };
-       CComObject<COverlappedWindow>* pOverlapped[MAXIMUM_WAIT_OBJECTS] = { NULL };
+       HANDLE hEvent[MAXIMUM_WAIT_OBJECTS] = {NULL};
+       HWND   hWnd[MAXIMUM_WAIT_OBJECTS] = {NULL};
+       CComObject<COverlappedWindow>* pOverlapped[MAXIMUM_WAIT_OBJECTS] = {NULL};
        int count = 0;
        int n = 0;
        list<CComObject<COverlappedWindow>*>::iterator p = m_lstOverlappedWnd.begin();
-       while(p != m_lstOverlappedWnd.end()){
+       while (p != m_lstOverlappedWnd.end()) {
                n = count;
-               (*p)->SetWaitParam(&count,hWnd,hEvent);
-               for(;n<count;n++){
+               (*p)->SetWaitParam(&count, hWnd, hEvent);
+               for (; n < count; n++) {
                        pOverlapped[n] = *p;
                }
                p++;
        }
        // \83\81\83b\83Z\81[\83W\83\8b\81[\83v
-       if(count > 0){
-               DWORD ret = pOverlapped[0]->MessageLoop(sleeptim,count,hWnd,hEvent);
-               if(ret > 0 && ret <= (DWORD)count){
-                       if(pOverlapped[ret-1]){
+       if (count > 0) {
+               DWORD ret = pOverlapped[0]->MessageLoop(sleeptim, count, hWnd, hEvent);
+               if (ret > 0 && ret <= (DWORD)count) {
+                       if (pOverlapped[ret - 1]) {
                                // OVERLAPPEDWINDOW\83I\83u\83W\83F\83N\83g\82Ö\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\95Ô\82·
                                IUnknown* pUnk = NULL;
-                               if(pOverlapped[ret - 1]->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                                       pvarUnk->vt      = VT_UNKNOWN;
+                               if (pOverlapped[ret - 1]->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                                       pvarUnk->vt = VT_UNKNOWN;
                                        pvarUnk->punkVal = pUnk;
                                }
                        }
@@ -152,10 +152,10 @@ STDMETHODIMP CInstance::WaitEvent(VARIANT varTim, VARIANT *pvarUnk)
 STDMETHODIMP CInstance::get_MainFrame(VARIANT *pVal)
 {
        ::VariantInit(pVal);
-       if(m_pMainWindow){
+       if (m_pMainWindow) {
                IUnknown* pUnk = NULL;
-               if(m_pMainWindow->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                       pVal->vt      = VT_UNKNOWN;
+               if (m_pMainWindow->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                       pVal->vt = VT_UNKNOWN;
                        pVal->punkVal = pUnk;
                }
        }
@@ -173,7 +173,7 @@ STDMETHODIMP CInstance::put_WaitCursor(short newVal)
        m_dWaitCursor = newVal;
        // \82·\82×\82Ä\82Ì\83|\83b\83v\83A\83b\83v\83E\83B\83\93\83h\83E\82É\83E\83F\83C\83g\83J\81[\83\\83\8b\92l\82ð\90Ý\92è\82·\82é
        list<CComObject<COverlappedWindow>*>::iterator p = m_lstOverlappedWnd.begin();
-       while(p != m_lstOverlappedWnd.end()){
+       while (p != m_lstOverlappedWnd.end()) {
                (*p)->put_WaitCursor(newVal);
                p++;
        }
@@ -183,31 +183,31 @@ STDMETHODIMP CInstance::put_WaitCursor(short newVal)
 STDMETHODIMP CInstance::get_Keyboard(VARIANT vk, BOOL *pVal)
 {
        CComVariant varVk;
-       if(varVk.ChangeType(VT_I2,&vk) != S_OK){
+       if (varVk.ChangeType(VT_I2, &vk) != S_OK) {
                return DISP_E_TYPEMISMATCH;
        }
-       *pVal = (GetAsyncKeyState(varVk.iVal) & 0x8000)?VB_TRUE:VB_FALSE;
+       *pVal = (GetAsyncKeyState(varVk.iVal) & 0x8000) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
-STDMETHODIMP CInstance::get_MousePosX(short *pVal)
+STDMETHODIMP CInstance::get_MousePosX(long *pVal)
 {
        POINT pt;
        ::GetCursorPos(&pt);
-       *pVal = (short)pt.x; //UNDONE: \90¸\93x\82ª\97\8e\82¿\82Ä\82¢\82é\81B
+       *pVal = pt.x;
        return S_OK;
 }
 
-STDMETHODIMP CInstance::get_MousePosY(short *pVal)
+STDMETHODIMP CInstance::get_MousePosY(long *pVal)
 {
        POINT pt;
        ::GetCursorPos(&pt);
-       *pVal = (short)pt.y; //UNDONE: \90¸\93x\82ª\97\8e\82¿\82Ä\82¢\82é\81B
+       *pVal = pt.y;
        return S_OK;
 }
 
 STDMETHODIMP CInstance::get_Version(double *pVal)
 {
-       *pVal = 0.91;
+       *pVal = 0.92;
        return S_OK;
 }
index 7a47b05..8c50321 100644 (file)
@@ -1,7 +1,6 @@
 // Instance.h : Declaration of the CInstance
 
-#ifndef __INSTANCE_H_
-#define __INSTANCE_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include <atlctl.h>
@@ -11,7 +10,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 // CInstance
-class ATL_NO_VTABLE CInstance : 
+class ATL_NO_VTABLE CInstance :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CStockPropImpl<CInstance, ISeraphyScriptTools_Instance, &IID_ISeraphyScriptTools_Instance, &LIBID_SERAPHYSCRIPTTOOLSLib>,
        public CComControl<CInstance>,
@@ -35,81 +34,80 @@ public:
        CInstance();
        void FinalRelease();
 
-DECLARE_REGISTRY_RESOURCEID(IDR_INSTANCE)
-
-DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-BEGIN_COM_MAP(CInstance)
-       COM_INTERFACE_ENTRY(ISeraphyScriptTools_Instance)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(IViewObjectEx)
-       COM_INTERFACE_ENTRY(IViewObject2)
-       COM_INTERFACE_ENTRY(IViewObject)
-       COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceObject)
-       COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
-       COM_INTERFACE_ENTRY(IOleControl)
-       COM_INTERFACE_ENTRY(IOleObject)
-       COM_INTERFACE_ENTRY(IPersistStreamInit)
-       COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-       COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
-       COM_INTERFACE_ENTRY(IQuickActivate)
-       COM_INTERFACE_ENTRY(IPersistStorage)
-       COM_INTERFACE_ENTRY(IDataObject)
-       COM_INTERFACE_ENTRY(IProvideClassInfo)
-       COM_INTERFACE_ENTRY(IProvideClassInfo2)
-END_COM_MAP()
-
-BEGIN_PROP_MAP(CInstance)
-       PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
-       PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
-       PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
-       // Example entries
-       // PROP_ENTRY("Property Description", dispid, clsid)
-       // PROP_PAGE(CLSID_StockColorPage)
-END_PROP_MAP()
-
-BEGIN_CONNECTION_POINT_MAP(CInstance)
-       CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
-END_CONNECTION_POINT_MAP()
-
-BEGIN_MSG_MAP(CInstance)
-       CHAIN_MSG_MAP(CComControl<CInstance>)
-       DEFAULT_REFLECTION_HANDLER()
-END_MSG_MAP()
-// Handler prototypes:
-//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
-//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
-
-
-
-// ISupportsErrorInfo
+       DECLARE_REGISTRY_RESOURCEID(IDR_INSTANCE)
+
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+       BEGIN_COM_MAP(CInstance)
+               COM_INTERFACE_ENTRY(ISeraphyScriptTools_Instance)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(IViewObjectEx)
+               COM_INTERFACE_ENTRY(IViewObject2)
+               COM_INTERFACE_ENTRY(IViewObject)
+               COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
+               COM_INTERFACE_ENTRY(IOleInPlaceObject)
+               COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
+               COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
+               COM_INTERFACE_ENTRY(IOleControl)
+               COM_INTERFACE_ENTRY(IOleObject)
+               COM_INTERFACE_ENTRY(IPersistStreamInit)
+               COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+               COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
+               COM_INTERFACE_ENTRY(IQuickActivate)
+               COM_INTERFACE_ENTRY(IPersistStorage)
+               COM_INTERFACE_ENTRY(IDataObject)
+               COM_INTERFACE_ENTRY(IProvideClassInfo)
+               COM_INTERFACE_ENTRY(IProvideClassInfo2)
+       END_COM_MAP()
+
+       BEGIN_PROP_MAP(CInstance)
+               PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
+               PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
+               PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
+               // Example entries
+               // PROP_ENTRY("Property Description", dispid, clsid)
+               // PROP_PAGE(CLSID_StockColorPage)
+       END_PROP_MAP()
+
+       BEGIN_CONNECTION_POINT_MAP(CInstance)
+               CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
+       END_CONNECTION_POINT_MAP()
+
+       BEGIN_MSG_MAP(CInstance)
+               CHAIN_MSG_MAP(CComControl<CInstance>)
+               DEFAULT_REFLECTION_HANDLER()
+       END_MSG_MAP()
+       // Handler prototypes:
+       //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+       //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+       //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
+
+
+
+       // ISupportsErrorInfo
        STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
        {
-               static const IID* arr[] = 
+               static const IID* arr[] =
                {
                        &IID_ISeraphyScriptTools_Instance,
                };
-               for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
-               {
+               for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) {
                        if (IsEqualGUID(*arr[i], riid))
                                return S_OK;
                }
                return S_FALSE;
        }
 
-// IViewObjectEx
+       // IViewObjectEx
        DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
 
-// ISeraphyScriptTools_Instance
+       // ISeraphyScriptTools_Instance
 public:
        STDMETHOD(get_Version)(/*[out, retval]*/ double *pVal);
-       STDMETHOD(get_MousePosY)(/*[out, retval]*/ short *pVal);
-       STDMETHOD(get_MousePosX)(/*[out, retval]*/ short *pVal);
+       STDMETHOD(get_MousePosY)(/*[out, retval]*/ long *pVal);
+       STDMETHOD(get_MousePosX)(/*[out, retval]*/ long *pVal);
        STDMETHOD(get_Keyboard)(/*[in]*/VARIANT vk, /*[out, retval]*/ BOOL *pVal);
        _bstr_t m_bstr_ProfilePath;
        STDMETHOD(get_WaitCursor)(/*[out, retval]*/ short *pVal);
@@ -124,12 +122,12 @@ public:
                RECT& rc = *(RECT*)di.prcBounds;
                Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
 
-               SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
+               SetTextAlign(di.hdcDraw, TA_CENTER | TA_BASELINE);
                LPCTSTR pszText = _T("SeraphyScriptTools");
-               TextOut(di.hdcDraw, 
-                       (rc.left + rc.right) / 2, 
-                       (rc.top + rc.bottom) / 2, 
-                       pszText, 
+               TextOut(di.hdcDraw,
+                       (rc.left + rc.right) / 2,
+                       (rc.top + rc.bottom) / 2,
+                       pszText,
                        lstrlen(pszText));
 
                return S_OK;
@@ -141,5 +139,3 @@ protected:
        CComObject<COverlappedWindow>* m_pMainWindow;
        int m_dWaitCursor;
 };
-
-#endif //__INSTANCE_H_
index eff6782..15d82c5 100644 (file)
--- a/Layer.cpp
+++ b/Layer.cpp
@@ -7,63 +7,49 @@
 /////////////////////////////////////////////////////////////////////////////
 // CLayer
 
-STDMETHODIMP CLayer::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_ILayer
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 void CLayer::Draw(CDC dc)
 {
        // \83h\83\8d\81[\83C\83\93\83O\83f\81[\83^\81[\82Ì\95`\89æ
-       if(m_bVisible){
+       if (m_bVisible) {
                // \83y\83\93\81A\83u\83\89\83V\82Ì\90Ý\92è
-               HPEN hPen = CreatePen(PS_SOLID,0,COLORREF(m_dwColor));
+               HPEN hPen = CreatePen(PS_SOLID, 0, COLORREF(m_dwColor));
                HBRUSH hBrush = CreateSolidBrush(COLORREF(m_dwFillColor));
-               HPEN hOldPen = (HPEN)SelectObject(dc.m_hDC,hPen);
-               HBRUSH hOldBrush = (HBRUSH)SelectObject(dc.m_hDC,hBrush);
-               COLORREF oldColor = SetTextColor(dc.m_hDC,COLORREF(m_dwFontColor));
+               HPEN hOldPen = (HPEN)SelectObject(dc.m_hDC, hPen);
+               HBRUSH hOldBrush = (HBRUSH)SelectObject(dc.m_hDC, hBrush);
+               COLORREF oldColor = SetTextColor(dc.m_hDC, COLORREF(m_dwFontColor));
                // \83t\83H\83\93\83g\82Ì\91I\91ð
                int fntsiz = m_nFontSize;
-               if(m_bFontTextMappingMode){
+               if (m_bFontTextMappingMode) {
                        //DPtoLP(hdc,&fz,1);
                        HWND hWnd = GetDesktopWindow();
                        HDC hdc = GetDC(hWnd);
-                       long height_mm = GetDeviceCaps(hdc,VERTSIZE) * 10;
-                       long height_px = GetDeviceCaps(hdc,VERTRES);
-                       fntsiz = MulDiv(fntsiz,height_mm,height_px);
-                       ReleaseDC(hWnd,hdc);
+                       long height_mm = GetDeviceCaps(hdc, VERTSIZE) * 10;
+                       long height_px = GetDeviceCaps(hdc, VERTRES);
+                       fntsiz = MulDiv(fntsiz, height_mm, height_px);
+                       ReleaseDC(hWnd, hdc);
                }
                HFONT hFont = CreateFont(fntsiz, 0, 0, 0, 0, false, false, false,
                        SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, m_szFontName);
                HFONT hOldFont = NULL;
-               if(hFont){
-                       hOldFont = (HFONT)SelectObject(dc.m_hDC,hFont);
+               if (hFont) {
+                       hOldFont = (HFONT)SelectObject(dc.m_hDC, hFont);
                }
                // \95`\89æ\83f\81[\83^
                EnterCriticalSection(&m_objDrawingDataProtection);
                list<drawdata*>::iterator p = m_lstDraw.begin();
-               while(p != m_lstDraw.end()){
+               while (p != m_lstDraw.end()) {
                        (*p)->Draw(dc);
                        p++;
                }
                LeaveCriticalSection(&m_objDrawingDataProtection);
                // \83I\83u\83W\83F\83N\83g\82Ì\89ð\95ú
-               SelectObject(dc.m_hDC,hOldPen);
-               SelectObject(dc.m_hDC,hOldBrush);
+               SelectObject(dc.m_hDC, hOldPen);
+               SelectObject(dc.m_hDC, hOldBrush);
                DeleteObject(hPen);
                DeleteObject(hBrush);
-               SetTextColor(dc.m_hDC,oldColor);
-               if(hOldFont){
-                       SelectObject(dc.m_hDC,hOldFont);
+               SetTextColor(dc.m_hDC, oldColor);
+               if (hOldFont) {
+                       SelectObject(dc.m_hDC, hOldFont);
                        DeleteObject(hFont);
                }
        }
@@ -78,11 +64,11 @@ void CLayer::FinalRelease()
        DeleteCriticalSection(&m_objDrawingDataProtection);
 }
 
-STDMETHODIMP CLayer::Text(VARIANT x,VARIANT y,VARIANT text)
+STDMETHODIMP CLayer::Text(VARIANT x, VARIANT y, VARIANT text)
 {
        CComVariant str;
        HRESULT hr = str.ChangeType(VT_BSTR, &text);
-       if(FAILED(hr)) {
+       if (FAILED(hr)) {
                return hr;
        }
 
@@ -105,7 +91,7 @@ STDMETHODIMP CLayer::TextBox(VARIANT sx, VARIANT sy, VARIANT ex, VARIANT ey, VAR
 
        UINT ufmt = 0;
        CComVariant cfmt;
-       if (cfmt.ChangeType(VT_I4, &fmt) == S_OK){
+       if (cfmt.ChangeType(VT_I4, &fmt) == S_OK) {
                ufmt = cfmt.lVal;
        }
 
@@ -126,7 +112,7 @@ STDMETHODIMP CLayer::Circle(VARIANT x, VARIANT y, VARIANT radius)
        long lx = GetMappedValue(x);
        long ly = GetMappedValue(y);
        long lr = GetMappedValue(radius);
-       AddDrawData(new circledata(lx,ly,lr,m_bTextMappingMode));
+       AddDrawData(new circledata(lx, ly, lr, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -136,7 +122,7 @@ STDMETHODIMP CLayer::Line(VARIANT sx, VARIANT sy, VARIANT ex, VARIANT ey)
        long lsy = GetMappedValue(sy);
        long lex = GetMappedValue(ex);
        long ley = GetMappedValue(ey);
-       AddDrawData(new linedata(lsx,lsy,lex,ley,m_bTextMappingMode));
+       AddDrawData(new linedata(lsx, lsy, lex, ley, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -146,7 +132,7 @@ STDMETHODIMP CLayer::Box(VARIANT sx, VARIANT sy, VARIANT ex, VARIANT ey)
        long lsy = GetMappedValue(sy);
        long lex = GetMappedValue(ex);
        long ley = GetMappedValue(ey);
-       AddDrawData(new boxdata(lsx,lsy,lex,ley,m_bTextMappingMode));
+       AddDrawData(new boxdata(lsx, lsy, lex, ley, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -160,7 +146,7 @@ STDMETHODIMP CLayer::Arc(VARIANT x1, VARIANT y1, VARIANT x2, VARIANT y2, VARIANT
        long lsy = GetMappedValue(sy);
        long lex = GetMappedValue(ex);
        long ley = GetMappedValue(ey);
-       AddDrawData(new arcdata(lx1,ly1,lx2,ly2,lsx,lsy,lex,ley,m_bTextMappingMode));
+       AddDrawData(new arcdata(lx1, ly1, lx2, ly2, lsx, lsy, lex, ley, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -168,21 +154,21 @@ STDMETHODIMP CLayer::Picture(VARIANT unk, VARIANT x, VARIANT y, VARIANT w, VARIA
 {
        CComVariant cUnk;
        IPicture* pPicture = NULL;
-       if( cUnk.ChangeType(VT_UNKNOWN,&unk) != S_OK ||
-               cUnk.punkVal->QueryInterface(IID_IPicture,(void**)&pPicture) != S_OK){
+       if (cUnk.ChangeType(VT_UNKNOWN, &unk) != S_OK ||
+               cUnk.punkVal->QueryInterface(IID_IPicture, (void**)&pPicture) != S_OK) {
                return DISP_E_TYPEMISMATCH;
        }
        long lx = GetMappedValue(x);
        long ly = GetMappedValue(y);
        int width = -1;
-       if(w.vt != VT_NULL && w.vt != VT_ERROR && w.vt != VT_EMPTY){
-               width = GetMappedValue(w,-1);
+       if (w.vt != VT_NULL && w.vt != VT_ERROR && w.vt != VT_EMPTY) {
+               width = GetMappedValue(w, -1);
        }
        int height = -1;
-       if(h.vt != VT_NULL && h.vt != VT_ERROR && h.vt != VT_EMPTY){
-               height = GetMappedValue(h,-1);
+       if (h.vt != VT_NULL && h.vt != VT_ERROR && h.vt != VT_EMPTY) {
+               height = GetMappedValue(h, -1);
        }
-       AddDrawData(new picturedata(pPicture,lx,ly,width,height,m_bTextMappingMode));
+       AddDrawData(new picturedata(pPicture, lx, ly, width, height, m_bTextMappingMode));
        pPicture->Release();
        return S_OK;
 }
@@ -193,7 +179,7 @@ STDMETHODIMP CLayer::FillBox(VARIANT sx, VARIANT sy, VARIANT ex, VARIANT ey)
        long lsy = GetMappedValue(sy);
        long lex = GetMappedValue(ex);
        long ley = GetMappedValue(ey);
-       AddDrawData(new fillboxdata(lsx,lsy,lex,ley,m_bTextMappingMode));
+       AddDrawData(new fillboxdata(lsx, lsy, lex, ley, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -202,7 +188,7 @@ STDMETHODIMP CLayer::FillCircle(VARIANT x, VARIANT y, VARIANT radius)
        long lx = GetMappedValue(x);
        long ly = GetMappedValue(y);
        long lr = GetMappedValue(radius);
-       AddDrawData(new fillcircledata(lx,ly,lr,m_bTextMappingMode));
+       AddDrawData(new fillcircledata(lx, ly, lr, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -216,7 +202,7 @@ STDMETHODIMP CLayer::FillArc(VARIANT x1, VARIANT y1, VARIANT x2, VARIANT y2, VAR
        long lsy = GetMappedValue(sy);
        long lex = GetMappedValue(ex);
        long ley = GetMappedValue(ey);
-       AddDrawData(new fillarcdata(lx1,ly1,lx2,ly2,lsx,lsy,lex,ley,m_bTextMappingMode));
+       AddDrawData(new fillarcdata(lx1, ly1, lx2, ly2, lsx, lsy, lex, ley, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -226,9 +212,9 @@ STDMETHODIMP CLayer::FillRBox(VARIANT sx, VARIANT sy, VARIANT ex, VARIANT ey, VA
        long lsy = GetMappedValue(sy);
        long lex = GetMappedValue(ex);
        long ley = GetMappedValue(ey);
-       long lw  = GetMappedValue(w);
-       long lh  = GetMappedValue(h);
-       AddDrawData(new fillrboxdata(lsx,lsy,lex,ley,lw,lh,m_bTextMappingMode));
+       long lw = GetMappedValue(w);
+       long lh = GetMappedValue(h);
+       AddDrawData(new fillrboxdata(lsx, lsy, lex, ley, lw, lh, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -237,8 +223,8 @@ STDMETHODIMP CLayer::Polygon(VARIANT cx, VARIANT cy, VARIANT arrayPt)
        long lx = GetMappedValue(cx);
        long ly = GetMappedValue(cy);
        VARTYPE vt = VT_EMPTY;
-       SAFEARRAY* pArray = GetArrayFromVariant(arrayPt,&vt);
-       if(!pArray || vt != VT_VARIANT){
+       SAFEARRAY* pArray = GetArrayFromVariant(arrayPt, &vt);
+       if (!pArray || vt != VT_VARIANT) {
                return DISP_E_TYPEMISMATCH;
        }
        POINT* pPt = NULL;
@@ -247,33 +233,32 @@ STDMETHODIMP CLayer::Polygon(VARIANT cx, VARIANT cy, VARIANT arrayPt)
        long lb0 = 0;
        long ub0 = 0;
        int dm = SafeArrayGetDim(pArray);
-       SafeArrayGetLBound(pArray,1,&lb0); // \8d\91¤\82Ì\93Y\82¦\8e\9a
-       SafeArrayGetUBound(pArray,1,&ub0);
-       SafeArrayGetLBound(pArray,2,&lb);  // \89E\91¤\82Ì\93Y\82¦\8e\9a
-       SafeArrayGetUBound(pArray,2,&ub);
-       if(dm == 2 && lb == 0 && lb0 == 0 && ub0 == 2 && ub > lb && ub > 2){
+       SafeArrayGetLBound(pArray, 1, &lb0); // \8d\91¤\82Ì\93Y\82¦\8e\9a
+       SafeArrayGetUBound(pArray, 1, &ub0);
+       SafeArrayGetLBound(pArray, 2, &lb);  // \89E\91¤\82Ì\93Y\82¦\8e\9a
+       SafeArrayGetUBound(pArray, 2, &ub);
+       if (dm == 2 && lb == 0 && lb0 == 0 && ub0 == 2 && ub > lb && ub > 2) {
                // \94z\97ñ\82Ì\8e\9f\8c³\81A\94Í\88Í\82ª\97L\8cø\82Å\82 \82é\81B
                // \91½\8ap\8c`\82ð\8dì\90¬\82·\82é\82½\82ß\82É\82Í\92¸\93_\82Í3\82Â\88È\8fã\95K\97v\81B
                pPt = new POINT[ub + 1];
                long idx[2];
-               for(int cnt = 0 ; cnt <= ub ; cnt++){
+               for (int cnt = 0; cnt <= ub; cnt++) {
                        // VARIANT\82Ì\94z\97ñ\82Å\82 \82é
-                       CComVariant tmpX,tmpY;
+                       CComVariant tmpX, tmpY;
                        idx[1] = cnt;
                        idx[0] = 0;
-                       SafeArrayGetElement(pArray,idx,&tmpX);
+                       SafeArrayGetElement(pArray, idx, &tmpX);
                        idx[0] = 1;
-                       SafeArrayGetElement(pArray,idx,&tmpY);
+                       SafeArrayGetElement(pArray, idx, &tmpY);
                        pPt[cnt].x = GetMappedValue(tmpX) + lx;
                        pPt[cnt].y = GetMappedValue(tmpY) + ly;
                }
        }
-       if(!pPt){
+       if (!pPt) {
                // \94z\97ñ\82Ì\8eí\97Þ\82ª\82È\82ñ\82¾\82©\95ª\82©\82ç\82È\82¢\81B
-               ErrorInfo(IDS_ERR_NEED2DIM);
-               return DISP_E_EXCEPTION;
+               return Error(IDS_ERR_NEED2DIM);
        }
-       AddDrawData(new polygondata(pPt,ub,m_bTextMappingMode));
+       AddDrawData(new polygondata(pPt, ub, m_bTextMappingMode));
        return S_OK;
 }
 
@@ -282,8 +267,8 @@ STDMETHODIMP CLayer::Clear()
        // \83h\83\8d\81[\83C\83\93\83O\83f\81[\83^\81[\82Ì\94j\8aü
        EnterCriticalSection(&m_objDrawingDataProtection);
        list<drawdata*>::iterator p = m_lstDraw.begin();
-       while(p != m_lstDraw.end()){
-               delete *p;
+       while (p != m_lstDraw.end()) {
+               (*p)->Destroy();
                p = m_lstDraw.erase(p);
        }
        LeaveCriticalSection(&m_objDrawingDataProtection);
@@ -377,7 +362,7 @@ STDMETHODIMP CLayer::put_FontSize(short newVal)
 STDMETHODIMP CLayer::SetMappingMode(VARIANT mode)
 {
        CComVariant varMode;
-       if(varMode.ChangeType(VT_I2,&mode) == S_OK){
+       if (varMode.ChangeType(VT_I2, &mode) == S_OK) {
                m_bTextMappingMode = varMode.iVal;
        }
        return S_OK;
@@ -386,15 +371,15 @@ STDMETHODIMP CLayer::SetMappingMode(VARIANT mode)
 long CLayer::GetMappedValue(VARIANT var, long def)
 {
        CComVariant varTmp;
-       if(m_bTextMappingMode){
+       if (m_bTextMappingMode) {
                // \83s\83N\83Z\83\8b\92P\88Ê\82Ì\8dÀ\95W\8ew\92è
-               if(varTmp.ChangeType(VT_I4,&var) == S_OK){
+               if (varTmp.ChangeType(VT_I4, &var) == S_OK) {
                        return varTmp.lVal;
                }
        }
-       else{
+       else {
                // \83~\83\8a\92P\88Ê\82Ì\8dÀ\95W\8ew\92è (1\92P\88Ê 0.1mm)
-               if(varTmp.ChangeType(VT_R8,&var) == S_OK){
+               if (varTmp.ChangeType(VT_R8, &var) == S_OK) {
                        return (long)(varTmp.dblVal * 10);
                }
        }
diff --git a/Layer.h b/Layer.h
index 7574acc..c571410 100644 (file)
--- a/Layer.h
+++ b/Layer.h
@@ -1,7 +1,6 @@
 // Layer.h : CLayer \82Ì\90é\8c¾
 
-#ifndef __LAYER_H_
-#define __LAYER_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 
@@ -27,30 +26,32 @@ public:
        {
                HWND hWnd = GetDesktopWindow();
                HDC hdc = GetDC(hWnd);
-               m_height_mm = GetDeviceCaps(hdc,VERTSIZE) * 10;
-               m_height_px = GetDeviceCaps(hdc,VERTRES);
-               m_width_mm  = GetDeviceCaps(hdc,HORZSIZE) * 10;
-               m_width_px = GetDeviceCaps(hdc,HORZRES);
-               ReleaseDC(hWnd,hdc);
+               m_height_mm = GetDeviceCaps(hdc, VERTSIZE) * 10;
+               m_height_px = GetDeviceCaps(hdc, VERTRES);
+               m_width_mm = GetDeviceCaps(hdc, HORZSIZE) * 10;
+               m_width_px = GetDeviceCaps(hdc, HORZRES);
+               ReleaseDC(hWnd, hdc);
        }
        virtual void Destroy() = 0;
        virtual void Draw(CDC hdc) = 0;
-       void DPtoLP(CDC& dc,POINT* pt,int cnt)
+       void DPtoLP(CDC& dc, POINT* pt, int cnt)
        {
                long offsetY = 0;
-               if(!dc.m_bPrinting){
-                       offsetY = MulDiv(dc.m_rct.bottom,m_height_mm,m_height_px);
+               if (!dc.m_bPrinting) {
+                       offsetY = MulDiv(dc.m_rct.bottom, m_height_mm, m_height_px);
                }
-               else{
+               else {
                        offsetY = dc.m_rct.bottom;
                }
                int i;
-               for(i=0;i<cnt;i++){
-                       pt[i].y = offsetY - MulDiv(pt[i].y,m_height_mm,m_height_px);
-                       pt[i].x = MulDiv(pt[i].x,m_width_mm ,m_width_px );
+               for (i = 0; i < cnt; i++) {
+                       pt[i].y = offsetY - MulDiv(pt[i].y, m_height_mm, m_height_px);
+                       pt[i].x = MulDiv(pt[i].x, m_width_mm, m_width_px);
                }
        }
 protected:
+       virtual ~drawdata() {}
+
        int m_bTextMappingMode;
        long m_height_mm;
        long m_height_px;
@@ -63,8 +64,10 @@ class textdata : public drawdata
 public:
        textdata(long x, long y, LPCTSTR text, BOOL mapmode)
        {
-               pBuf = new TCHAR[lstrlen(text)+1];
-               lstrcpy(pBuf,text);
+               if (text == NULL) {
+                       text = _TEXT("");
+               }
+               buf = text;
                m_x = x;
                m_y = y;
                m_bTextMappingMode = mapmode;
@@ -72,26 +75,25 @@ public:
 
        virtual void Destroy()
        {
-               delete pBuf;
                delete this;
        }
 
        virtual void Draw(CDC dc)
        {
-               POINT pt = {m_x,m_y};
-               if(m_bTextMappingMode){
-                       SetTextAlign(dc.m_hDC,TA_TOP);
-                       DPtoLP(dc,&pt,1);
+               POINT pt = {m_x, m_y};
+               if (m_bTextMappingMode) {
+                       SetTextAlign(dc.m_hDC, TA_TOP);
+                       DPtoLP(dc, &pt, 1);
                }
-               else{
-                       SetTextAlign(dc.m_hDC,TA_BASELINE);
+               else {
+                       SetTextAlign(dc.m_hDC, TA_BASELINE);
                }
-               TextOut(dc.m_hDC,pt.x,pt.y,pBuf,lstrlen(pBuf));
+               TextOut(dc.m_hDC, pt.x, pt.y, buf, buf.GetLength());
        }
 protected:
        long m_x;
        long m_y;
-       LPTSTR pBuf;
+       ATL::CString buf;
 };
 
 class textboxdata : public drawdata
@@ -99,42 +101,44 @@ class textboxdata : public drawdata
 public:
        textboxdata(long sx, long sy, long ex, long ey, LPCTSTR text, UINT fmt, BOOL mapmode)
        {
-               pBuf = new TCHAR[lstrlen(text)+1];
-               lstrcpy(pBuf,text);
-               m_box.left   = sx;
-               m_box.top    = sy;
-               m_box.right  = ex;
+               if (text == NULL) {
+                       text = _TEXT("");
+               }
+               buf = text;
+               m_box.left = sx;
+               m_box.top = sy;
+               m_box.right = ex;
                m_box.bottom = ey;
                m_fmt = fmt;
                m_bTextMappingMode = mapmode;
        }
        virtual void Destroy()
        {
-               delete pBuf;
                delete this;
        }
        virtual void Draw(CDC dc)
        {
                RECT box = m_box;
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,(LPPOINT)&box,2);
-                       SetTextAlign(dc.m_hDC,TA_TOP);
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, (LPPOINT)&box, 2);
+                       SetTextAlign(dc.m_hDC, TA_TOP);
                }
-               else{
-                       SetTextAlign(dc.m_hDC,TA_BASELINE);
+               else {
+                       SetTextAlign(dc.m_hDC, TA_BASELINE);
                }
-               DrawText(dc.m_hDC,pBuf,lstrlen(pBuf),&box,m_fmt);
+               DrawText(dc.m_hDC, buf, buf.GetLength(), &box, m_fmt);
        }
+
 protected:
        UINT m_fmt;
        RECT m_box;
-       LPTSTR pBuf;
+       ATL::CString buf;
 };
 
 class linedata : public drawdata
 {
 public:
-       linedata(long sx,long sy,long ex,long ey,BOOL mapmode)
+       linedata(long sx, long sy, long ex, long ey, BOOL mapmode)
        {
                m_sx = sx;
                m_sy = sy;
@@ -142,19 +146,22 @@ public:
                m_ey = ey;
                m_bTextMappingMode = mapmode;
        }
+
        virtual void Destroy()
        {
                delete this;
        }
+
        virtual void Draw(CDC dc)
        {
-               POINT pt[2] = {{m_sx,m_sy},{m_ex,m_ey}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,2);
+               POINT pt[2] = {{m_sx, m_sy}, {m_ex, m_ey}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 2);
                }
-               MoveToEx(dc.m_hDC,pt[0].x,pt[0].y,NULL);
-               LineTo(dc.m_hDC,pt[1].x,pt[1].y);
+               MoveToEx(dc.m_hDC, pt[0].x, pt[0].y, NULL);
+               LineTo(dc.m_hDC, pt[1].x, pt[1].y);
        }
+
 protected:
        long m_sx;
        long m_sy;
@@ -165,24 +172,31 @@ protected:
 class circledata : public drawdata
 {
 public:
-       circledata(long sx,long sy,long radius,BOOL mapmode)
+       circledata(long sx, long sy, long radius, BOOL mapmode)
        {
                m_sx = sx;
                m_sy = sy;
                m_radius = radius;
                m_bTextMappingMode = mapmode;
        }
+
        virtual void Destroy()
        {
                delete this;
        }
+
        virtual void Draw(CDC dc)
        {
-               POINT pt[2]   = {{m_sx ,m_sy},{m_radius ,m_radius}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,2);
+               POINT pt[2] = {{m_sx, m_sy}, {m_radius, m_radius}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 2);
                }
-               Arc(dc.m_hDC,(pt[0].x-pt[1].x),(pt[0].y-pt[1].x),(pt[0].x+pt[1].x),(pt[0].y+pt[1].x),0,0,0,0);
+               Arc(dc.m_hDC,
+                       (pt[0].x - pt[1].x),
+                       (pt[0].y - pt[1].x),
+                       (pt[0].x + pt[1].x),
+                       (pt[0].y + pt[1].x),
+                       0, 0, 0, 0);
        }
 protected:
        long m_sx;
@@ -193,25 +207,32 @@ protected:
 class fillcircledata : public drawdata
 {
 public:
-       fillcircledata(long sx,long sy,long radius,BOOL mapmode)
+       fillcircledata(long sx, long sy, long radius, BOOL mapmode)
        {
                m_sx = sx;
                m_sy = sy;
                m_radius = radius;
                m_bTextMappingMode = mapmode;
        }
+
        virtual void Destroy()
        {
                delete this;
        }
+
        virtual void Draw(CDC dc)
        {
                long mid = m_radius / 2;
-               POINT pt[2]   = {{m_sx ,m_sy},{m_radius ,m_radius}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,2);
+               POINT pt[2] = {{m_sx, m_sy}, {m_radius, m_radius}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 2);
                }
-               Ellipse(dc.m_hDC,(pt[0].x-pt[1].x),(pt[0].y-pt[1].x),(pt[0].x+pt[1].x),(pt[0].y+pt[1].x));
+               Ellipse(dc.m_hDC,
+                       (pt[0].x - pt[1].x),
+                       (pt[0].y - pt[1].x),
+                       (pt[0].x + pt[1].x),
+                       (pt[0].y + pt[1].x)
+                       );
        }
 protected:
        long m_sx;
@@ -222,7 +243,7 @@ protected:
 class boxdata : public drawdata
 {
 public:
-       boxdata(long sx,long sy,long ex,long ey,BOOL mapmode)
+       boxdata(long sx, long sy, long ex, long ey, BOOL mapmode)
        {
                m_sx = sx;
                m_sy = sy;
@@ -230,22 +251,25 @@ public:
                m_ey = ey;
                m_bTextMappingMode = mapmode;
        }
+
        virtual void Destroy()
        {
                delete this;
        }
+
        virtual void Draw(CDC dc)
        {
-               POINT pt[2]   = {{m_sx ,m_sy},{m_ex,m_ey}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,2);
+               POINT pt[2] = {{m_sx, m_sy}, {m_ex, m_ey}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 2);
                }
-               MoveToEx(dc.m_hDC,pt[0].x,pt[0].y,NULL);
-               LineTo  (dc.m_hDC,pt[1].x,pt[0].y);
-               LineTo  (dc.m_hDC,pt[1].x,pt[1].y);
-               LineTo  (dc.m_hDC,pt[0].x,pt[1].y);
-               LineTo  (dc.m_hDC,pt[0].x,pt[0].y);
+               MoveToEx(dc.m_hDC, pt[0].x, pt[0].y, NULL);
+               LineTo(dc.m_hDC, pt[1].x, pt[0].y);
+               LineTo(dc.m_hDC, pt[1].x, pt[1].y);
+               LineTo(dc.m_hDC, pt[0].x, pt[1].y);
+               LineTo(dc.m_hDC, pt[0].x, pt[0].y);
        }
+
 protected:
        long m_sx;
        long m_sy;
@@ -256,7 +280,7 @@ protected:
 class fillboxdata : public drawdata
 {
 public:
-       fillboxdata(long sx,long sy,long ex,long ey,BOOL mapmode)
+       fillboxdata(long sx, long sy, long ex, long ey, BOOL mapmode)
        {
                m_sx = sx;
                m_sy = sy;
@@ -264,18 +288,21 @@ public:
                m_ey = ey;
                m_bTextMappingMode = mapmode;
        }
+
        virtual void Destroy()
        {
                delete this;
        }
+
        virtual void Draw(CDC dc)
        {
-               POINT pt[2]   = {{m_sx ,m_sy},{m_ex,m_ey}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,2);
+               POINT pt[2] = {{m_sx, m_sy}, {m_ex, m_ey}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 2);
                }
-               Rectangle(dc.m_hDC,pt[0].x,pt[0].y,pt[1].x,pt[1].y);
+               Rectangle(dc.m_hDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y);
        }
+
 protected:
        long m_sx;
        long m_sy;
@@ -286,28 +313,31 @@ protected:
 class fillrboxdata : public drawdata
 {
 public:
-       fillrboxdata(long sx,long sy,long ex,long ey,long w,long h,BOOL mapmode)
+       fillrboxdata(long sx, long sy, long ex, long ey, long w, long h, BOOL mapmode)
        {
                m_sx = sx;
                m_sy = sy;
                m_ex = ex;
                m_ey = ey;
-               m_w  = w;
-               m_h  = h;
+               m_w = w;
+               m_h = h;
                m_bTextMappingMode = mapmode;
        }
+
        virtual void Destroy()
        {
                delete this;
        }
+
        virtual void Draw(CDC dc)
        {
-               POINT pt[3]   = {{m_sx ,m_sy},{m_ex,m_ey},{m_w,m_h}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,3);
+               POINT pt[3] = {{m_sx, m_sy}, {m_ex, m_ey}, {m_w, m_h}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 3);
                }
-               RoundRect(dc.m_hDC,pt[0].x,pt[0].y,pt[1].x,pt[1].y,pt[2].x,pt[2].y);
+               RoundRect(dc.m_hDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y, pt[2].x, pt[2].y);
        }
+
 protected:
        long m_sx;
        long m_sy;
@@ -320,7 +350,7 @@ protected:
 class arcdata : public drawdata
 {
 public:
-       arcdata(long x1,long y1,long x2,long y2,long sx,long sy,long ex,long ey,BOOL mapmode)
+       arcdata(long x1, long y1, long x2, long y2, long sx, long sy, long ex, long ey, BOOL mapmode)
        {
                m_x1 = x1;
                m_y1 = y1;
@@ -338,11 +368,11 @@ public:
        }
        virtual void Draw(CDC dc)
        {
-               POINT pt[4]   = {{m_x1,m_y1},{m_x2,m_y2},{m_sx ,m_sy},{m_ex,m_ey}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,4);
+               POINT pt[4] = {{m_x1, m_y1}, {m_x2, m_y2}, {m_sx, m_sy}, {m_ex, m_ey}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 4);
                }
-               Arc(dc.m_hDC,pt[0].x,pt[0].y,pt[1].x,pt[1].y,pt[2].x,pt[2].y,pt[3].x,pt[3].y);
+               Arc(dc.m_hDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y, pt[2].x, pt[2].y, pt[3].x, pt[3].y);
        }
 protected:
        long m_x1;
@@ -358,7 +388,7 @@ protected:
 class fillarcdata : public drawdata
 {
 public:
-       fillarcdata(long x1,long y1,long x2,long y2,long sx,long sy,long ex,long ey,BOOL mapmode)
+       fillarcdata(long x1, long y1, long x2, long y2, long sx, long sy, long ex, long ey, BOOL mapmode)
        {
                m_x1 = x1;
                m_y1 = y1;
@@ -376,11 +406,11 @@ public:
        }
        virtual void Draw(CDC dc)
        {
-               POINT pt[4]   = {{m_x1,m_y1},{m_x2,m_y2},{m_sx ,m_sy},{m_ex,m_ey}};
-               if(m_bTextMappingMode){
-                       DPtoLP(dc,pt,4);
+               POINT pt[4] = {{m_x1, m_y1}, {m_x2, m_y2}, {m_sx, m_sy}, {m_ex, m_ey}};
+               if (m_bTextMappingMode) {
+                       DPtoLP(dc, pt, 4);
                }
-               Pie(dc.m_hDC,pt[0].x,pt[0].y,pt[1].x,pt[1].y,pt[2].x,pt[2].y,pt[3].x,pt[3].y);
+               Pie(dc.m_hDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y, pt[2].x, pt[2].y, pt[3].x, pt[3].y);
        }
 protected:
        long m_x1;
@@ -396,7 +426,7 @@ protected:
 class polygondata : public drawdata
 {
 public:
-       polygondata(POINT* pPt,int cnt,BOOL mapmode)
+       polygondata(POINT* pPt, int cnt, BOOL mapmode)
        {
                m_cnt = cnt;
                m_pPt = pPt;
@@ -409,18 +439,18 @@ public:
        }
        virtual void Draw(CDC dc)
        {
-               if(m_bTextMappingMode){
+               if (m_bTextMappingMode) {
                        POINT* pt = new POINT[m_cnt];
                        int i;
-                       for(i=0;i<m_cnt;i++){
+                       for (i = 0; i < m_cnt; i++) {
                                pt[i] = m_pPt[i];
                        }
-                       DPtoLP (dc,pt,m_cnt);
-                       Polygon(dc.m_hDC,pt,m_cnt);
+                       DPtoLP(dc, pt, m_cnt);
+                       Polygon(dc.m_hDC, pt, m_cnt);
                        delete[]pt;
                }
-               else{
-                       Polygon(dc.m_hDC,m_pPt,m_cnt);
+               else {
+                       Polygon(dc.m_hDC, m_pPt, m_cnt);
                }
        }
 protected:
@@ -431,7 +461,7 @@ protected:
 class picturedata : public drawdata
 {
 public:
-       picturedata(IPicture* pPicture,long x,long y,long w,long h,BOOL mapmode)
+       picturedata(IPicture* pPicture, long x, long y, long w, long h, BOOL mapmode)
        {
                m_x = x;
                m_y = y;
@@ -439,20 +469,20 @@ public:
                m_w = w;
                m_pPicture = pPicture;
                m_bTextMappingMode = mapmode;
-               if(m_pPicture){
+               if (m_pPicture) {
                        m_pPicture->AddRef();
                }
        }
        virtual void Destroy()
        {
-               if(m_pPicture){
+               if (m_pPicture) {
                        m_pPicture->Release();
                        m_pPicture = NULL;
                }
        }
        virtual void Draw(CDC dc)
        {
-               if(!m_pPicture){
+               if (!m_pPicture) {
                        // \83r\83N\83`\83\83\81[\83C\83\93\83^\81[\83t\83F\83C\83X\82ª\82È\82¢\82È\82ç\89½\82à\82µ\82È\82¢
                        return;
                }
@@ -463,24 +493,26 @@ public:
                m_pPicture->get_Width(&w);
                m_pPicture->get_Height(&h);
 
-               if(m_bTextMappingMode){
-                       POINT pt[2] = {{m_x,m_y},{m_x+m_w,m_y+m_h}};
-                       DPtoLP(dc,pt,2);
-                       if(m_w < 0){ pt[1].x = w/10; } else { pt[1].x = labs(pt[1].x - pt[0].x); }
-                       if(m_h < 0){ pt[1].y = h/10; } else { pt[1].y = labs(pt[1].y - pt[0].y); }
+               if (m_bTextMappingMode) {
+                       POINT pt[2] = {{m_x, m_y}, {m_x + m_w, m_y + m_h}};
+                       DPtoLP(dc, pt, 2);
+                       if (m_w < 0) { pt[1].x = w / 10; }
+                       else { pt[1].x = labs(pt[1].x - pt[0].x); }
+                       if (m_h < 0) { pt[1].y = h / 10; }
+                       else { pt[1].y = labs(pt[1].y - pt[0].y); }
                        m_pPicture->Render(dc.m_hDC
-                               ,(pt[0].x)
-                               ,(pt[0].y-pt[1].y)
-                               ,(pt[1].x)
-                               ,(pt[1].y)
-                               ,0,0,w,h,NULL);
+                               , (pt[0].x)
+                               , (pt[0].y - pt[1].y)
+                               , (pt[1].x)
+                               , (pt[1].y)
+                               , 0, 0, w, h, NULL);
                }
-               else{
+               else {
                        long dw = w / 10;
                        long dh = h / 10;
-                       if(m_w > 0) dw = m_w;
-                       if(m_h > 0) dh = m_h;
-                       m_pPicture->Render(dc.m_hDC,m_x,m_y,dw,dh,0,0,w,h,NULL);
+                       if (m_w > 0) dw = m_w;
+                       if (m_h > 0) dh = m_h;
+                       m_pPicture->Render(dc.m_hDC, m_x, m_y, dw, dh, 0, 0, w, h, NULL);
                }
        }
 protected:
@@ -493,10 +525,10 @@ protected:
 
 /////////////////////////////////////////////////////////////////////////////
 // CLayer
-class ATL_NO_VTABLE CLayer : 
+class ATL_NO_VTABLE CLayer :
        public CComObjectRootEx<CComSingleThreadModel>,
-//     public CComCoClass<CLayer, &CLSID_Layer>,
-       public ISupportErrorInfo,
+       public CComCoClass<CLayer, &CLSID_Layer>,
+       public ISupportErrorInfoImpl<&IID_ILayer>,
        public IConnectionPointContainerImpl<CLayer>,
        public IDispatchImpl<ILayer, &IID_ILayer, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
@@ -518,26 +550,22 @@ public:
        }
        void FinalRelease();
 
-//DECLARE_REGISTRY_RESOURCEID(IDR_LAYER)
+       //DECLARE_REGISTRY_RESOURCEID(IDR_LAYER)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CLayer)
-       COM_INTERFACE_ENTRY(ILayer)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-END_COM_MAP()
-BEGIN_CONNECTION_POINT_MAP(CLayer)
-END_CONNECTION_POINT_MAP()
+       BEGIN_COM_MAP(CLayer)
+               COM_INTERFACE_ENTRY(ILayer)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+       END_COM_MAP()
+       BEGIN_CONNECTION_POINT_MAP(CLayer)
+       END_CONNECTION_POINT_MAP()
 
-
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// ILayer
+       // ILayer
 public:
-       long GetMappedValue(VARIANT var,long def = 0);
+       long GetMappedValue(VARIANT var, long def = 0);
        STDMETHOD(SetMappingMode)(/*[in]*/VARIANT mode);
        STDMETHOD(Picture)(/*[in]*/VARIANT punkVal,/*[in]*/VARIANT x,/*[in]*/VARIANT y,/*[in,optional]*/VARIANT w,/*[in,optional]*/VARIANT h);
        STDMETHOD(Clear)();
@@ -578,5 +606,3 @@ protected:
        int m_bTextMappingMode;
        int m_bFontTextMappingMode;
 };
-
-#endif //__LAYER_H_
index c86a8ad..e634fdf 100644 (file)
@@ -3,35 +3,23 @@
 #include "SeraphyScriptTools.h"
 #include "ObjectMap.h"
 #include "profilesection.h"
-#include "generic.h"
+#include "CComEnumDynaVARIANT.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // CObjectMap
 
-
-STDMETHODIMP CObjectMap::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_IObjectMap
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 STDMETHODIMP CObjectMap::FindNear(VARIANT key, VARIANT *pVal)
 {
-       CComVariant varName;
        ::VariantInit(pVal);
-       if(varName.ChangeType(VT_BSTR,&key) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+
+       CComVariant varName;
+       HRESULT hr;
+       if (FAILED(hr = varName.ChangeType(VT_BSTR, &key))) {
+               return hr;
        }
+
        VariantMap::iterator p = m_mapVariant.lower_bound(varName.bstrVal);
-       if(p != m_mapVariant.end()){
+       if (p != m_mapVariant.end()) {
                // \94­\8c©\82³\82ê\82½
                CComVariant findkey((LPCWSTR)p->first);
                findkey.ChangeType(VT_BSTR);
@@ -42,30 +30,36 @@ STDMETHODIMP CObjectMap::FindNear(VARIANT key, VARIANT *pVal)
 
 STDMETHODIMP CObjectMap::get_NearValue(VARIANT key, VARIANT *pVal)
 {
-       CComVariant varName;
        ::VariantInit(pVal);
-       if(varName.ChangeType(VT_BSTR,&key) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+
+       CComVariant varName;
+       HRESULT hr;
+       if (FAILED(hr = varName.ChangeType(VT_BSTR, &key))) {
+               return hr;
        }
+
        VariantMap::iterator p = m_mapVariant.lower_bound(varName.bstrVal);
-       if(p != m_mapVariant.end()){
+       if (p != m_mapVariant.end()) {
                // \94­\8c©\82³\82ê\82½
-               VariantCopy(pVal,&p->second);
+               VariantCopy(pVal, &p->second);
        }
        return S_OK;
 }
 
 STDMETHODIMP CObjectMap::get_Value(VARIANT key, VARIANT *pVal)
 {
-       CComVariant varName;
        ::VariantInit(pVal);
-       if(varName.ChangeType(VT_BSTR,&key) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+
+       CComVariant varName;
+       HRESULT hr;
+       if (FAILED(hr = varName.ChangeType(VT_BSTR, &key))) {
+               return hr;
        }
+
        VariantMap::iterator p = m_mapVariant.find(varName.bstrVal);
-       if(p != m_mapVariant.end()){
+       if (p != m_mapVariant.end()) {
                // \94­\8c©\82³\82ê\82½
-               VariantCopy(pVal,&p->second);
+               VariantCopy(pVal, &p->second);
        }
        return S_OK;
 }
@@ -73,20 +67,22 @@ STDMETHODIMP CObjectMap::get_Value(VARIANT key, VARIANT *pVal)
 STDMETHODIMP CObjectMap::put_Value(VARIANT key, VARIANT newVal)
 {
        CComVariant varName;
-       if(varName.ChangeType(VT_BSTR,&key) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+       HRESULT hr;
+       if (FAILED(hr = varName.ChangeType(VT_BSTR, &key))) {
+               return hr;
        }
+
        VariantMap::iterator p = m_mapVariant.find(varName.bstrVal);
-       if(p != m_mapVariant.end()){
+       if (p != m_mapVariant.end()) {
                // \8aù\91
-               VariantCopy(&p->second,&newVal);
+               VariantCopy(&p->second, &newVal);
        }
-       else{
+       else {
                // \90V\8bK
                VARIANT tmp;
                ::VariantInit(&tmp);
-               VariantCopy(&tmp,&newVal);
-               m_mapVariant.insert(pair<_bstr_t,VARIANT>(varName.bstrVal,tmp));
+               VariantCopy(&tmp, &newVal);
+               m_mapVariant.insert(pair<_bstr_t, VARIANT>(varName.bstrVal, tmp));
        }
        return S_OK;
 }
@@ -101,7 +97,7 @@ STDMETHODIMP CObjectMap::Clear()
 {
        //VARIANT\82Ì\83N\83\8a\83A\82Æ\98A\91z\94z\97ñ\82Ì\89ð\95ú
        VariantMap::iterator p = m_mapVariant.begin();
-       while(p != m_mapVariant.end()){
+       while (p != m_mapVariant.end()) {
                ::VariantClear(&p->second);
                p++;
        }
@@ -114,16 +110,16 @@ STDMETHODIMP CObjectMap::Duplicate(IUnknown** punkVal)
 {
        *punkVal = NULL;
        CComObject<CObjectMap>* pMap = NULL;
-       if(pMap->CreateInstance(&pMap) == S_OK){
+       if (pMap->CreateInstance(&pMap) == S_OK) {
                // \8c»\8dÝ\82Ì\83I\83u\83W\83F\83N\83g\82ð\95¡\90»\82·\82é
                VariantMap::iterator p = m_mapVariant.begin();
-               while(p != m_mapVariant.end()){
+               while (p != m_mapVariant.end()) {
                        CComVariant key((LPCWSTR)p->first);
                        key.ChangeType(VT_BSTR);
-                       pMap->put_Value(key,p->second);
+                       pMap->put_Value(key, p->second);
                        p++;
                }
-               pMap->QueryInterface(IID_IUnknown,(void**)punkVal);
+               pMap->QueryInterface(IID_IUnknown, (void**)punkVal);
        }
        return S_OK;
 }
@@ -132,20 +128,20 @@ STDMETHODIMP CObjectMap::CreateMap(IUnknown** punkVal)
 {
        *punkVal = NULL;
        CComObject<CObjectMap>* pMap = NULL;
-       if(pMap->CreateInstance(&pMap) == S_OK){
-               pMap->QueryInterface(IID_IUnknown,(void**)punkVal);
+       if (SUCCEEDED(pMap->CreateInstance(&pMap))) {
+               return pMap->QueryInterface(IID_IUnknown, (void**)punkVal);
        }
-       return S_OK;
+       return E_FAIL;
 }
 
 STDMETHODIMP CObjectMap::get__NewEnum(IUnknown **pVal)
 {
        int mx = m_mapVariant.size();
-       VARIANT* pvarArray = new VARIANT[mx+1];
+       VARIANT* pvarArray = new VARIANT[mx + 1];
        // \8ai\94[\82³\82ê\82Ä\82¢\82é\96¼\91O\82Ì\97ñ\8b\93
        VariantMap::iterator p = m_mapVariant.begin();
        int i = 0;
-       while(p != m_mapVariant.end()){
+       while (p != m_mapVariant.end()) {
                ::VariantInit(&pvarArray[i]);
                pvarArray[i].vt = VT_BSTR;
                pvarArray[i].bstrVal = SysAllocString(p->first);
@@ -154,14 +150,14 @@ STDMETHODIMP CObjectMap::get__NewEnum(IUnknown **pVal)
        }
        // \97ñ\8b\93\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\90\90¬
        CComObject<CComEnumVARIANT>* pCol = NULL;
-       if(pCol->CreateInstance(&pCol) == S_OK){
+       if (pCol->CreateInstance(&pCol) == S_OK) {
                pCol->AddRef();
-               pCol->Init(&pvarArray[0],&pvarArray[mx],pCol,AtlFlagCopy);
+               pCol->Init(&pvarArray[0], &pvarArray[mx], pCol, AtlFlagCopy);
                *pVal = pCol;
        }
        // \8am\95Û\82µ\82½\83o\83\8a\83A\83\93\83g\82Ì\94j\8aü(\83\8a\83\8a\81[\83X\82ð\8ds\82¤\95K\97v\82 \82è)
        i = 0;
-       while(i < mx){
+       while (i < mx) {
                ::VariantClear(&pvarArray[i++]);
        }
        delete[]pvarArray;
@@ -170,69 +166,69 @@ STDMETHODIMP CObjectMap::get__NewEnum(IUnknown **pVal)
 
 STDMETHODIMP CObjectMap::ExpandVariables(VARIANT text, VARIANT env, VARIANT *pVal)
 {
-       CComVariant varText,varEnv,varResult;
-       if(varText.ChangeType(VT_BSTR,&text) != S_OK){
+       CComVariant varText, varEnv, varResult;
+       if (varText.ChangeType(VT_BSTR, &text) != S_OK) {
                return DISP_E_TYPEMISMATCH;
        }
        // \8aÂ\8b«\95Ï\90\94\82ð\93W\8aJ\82·\82é\82©?
        BOOL bEnv = false;
-       if(varEnv.ChangeType(VT_I2,&env) == S_OK){
+       if (varEnv.ChangeType(VT_I2, &env) == S_OK) {
                bEnv = varEnv.iVal;
        }
        // \83t\83F\81[\83Y1 : \8aÜ\82Ü\82ê\82é\95Ï\90\94\82ð\92²\8d¸\82µ\82Ä\95K\97v\82È\83o\83b\83t\83@\83T\83C\83Y\82ð\8b\81\82ß\82é
        // \83t\83F\81[\83Y2 ; \8eÀ\8dÛ\82É\93W\8aJ\82·\82é
        DWORD expandsize = 0;
-       UINT writeidx    = 0;
+       UINT writeidx = 0;
        LPWSTR pExpandBuffer = NULL;
-       for(int phase = 0;phase < 2;phase++){
+       for (int phase = 0; phase < 2; phase++) {
                LPCWSTR str = varText.bstrVal;
                UINT length = SysStringLen(varText.bstrVal);
-               UINT idx    = 0;
-               while(idx < length){
-                       if(str[idx] == '%'){
+               UINT idx = 0;
+               while (idx < length) {
+                       if (str[idx] == '%') {
                                // \95Ï\90\94\93W\8aJ\83X\83^\81[\83g
                                WCHAR name[MAX_PATH] = {0};
                                UINT len = 0;
                                // \98A\91±\82·\82é%\82É\82æ\82é%\8e©\90g\82Ì\8fo\97Í\82Å\82 \82é\82©?
                                idx++;
-                               if(str[idx] == '%'){
-                                       if(phase == 0){
+                               if (str[idx] == '%') {
+                                       if (phase == 0) {
                                                idx++;
                                        }
-                                       else{
+                                       else {
                                                pExpandBuffer[writeidx++] = str[idx++];
                                        }
                                        continue;
                                }
                                // \95Ï\90\94\96¼\82Ì\8eæ\82è\8fo\82µ
-                               while(idx < length && str[idx] != '%'){
+                               while (idx < length && str[idx] != '%') {
                                        name[len++] = str[idx++];
                                }
                                name[len] = 0;
-                               if(str[idx] == '%'){
+                               if (str[idx] == '%') {
                                        idx++;
                                }
                                // \95Ï\90\94\82Ì\8eÀ\8dÝ\83`\83F\83b\83N
                                VariantMap::iterator p = m_mapVariant.find(name);
-                               if(p != m_mapVariant.end()){
+                               if (p != m_mapVariant.end()) {
                                        // \94­\8c©\82³\82ê\82½
                                        CComVariant tmp;
-                                       if(tmp.ChangeType(VT_BSTR,&p->second) == S_OK){
-                                               if(phase == 0){
+                                       if (tmp.ChangeType(VT_BSTR, &p->second) == S_OK) {
+                                               if (phase == 0) {
                                                        // \83t\83F\81[\83Y1\82Í\83T\83C\83Y\82ð\83J\83E\83\93\83g\82·\82é\82¾\82¯
                                                        expandsize += SysStringLen(tmp.bstrVal);
                                                }
-                                               else{
+                                               else {
                                                        // \83t\83F\81[\83Y2\82Í\8c»\8dÝ\88Ê\92u\82É\95Ï\90\94\82ð\93W\8aJ\82·\82é
                                                        UINT len = SysStringLen(tmp.bstrVal);
                                                        UINT i;
-                                                       for(i=0;i<len;i++){
+                                                       for (i = 0; i < len; i++) {
                                                                pExpandBuffer[writeidx++] = tmp.bstrVal[i];
                                                        }
                                                }
                                        }
                                }
-                               else if (bEnv){
+                               else if (bEnv) {
                                        // \98A\91z\94z\97ñ\82É\82Í\91\8dÝ\82¹\82¸\81A\8aÂ\8b«\95Ï\90\94\93W\8aJ\82ª\8ew\8e¦\82³\82ê\82Ä\82¢\82é
                                        ATL::CString szName(name);
                                        TCHAR szBuf[MAX_PATH] = {0};
@@ -243,10 +239,10 @@ STDMETHODIMP CObjectMap::ExpandVariables(VARIANT text, VARIANT env, VARIANT *pVa
                                                        // \83t\83G\81[\83Y1\82Í\83J\83E\83\93\83g\82·\82é\82¾\82¯
                                                        expandsize += ret;
                                                }
-                                               else{
+                                               else {
                                                        // \83t\83F\81[\83Y2\82Í\8eÀ\8dÛ\82É\8f\91\82«\8d\9e\82Þ
                                                        ATL::CStringW wbuf(szBuf);
-                                                       for (UINT i=0; i < ret; i++) {
+                                                       for (UINT i = 0; i < ret; i++) {
                                                                pExpandBuffer[writeidx++] = wbuf[i];
                                                        }
                                                }
@@ -254,21 +250,21 @@ STDMETHODIMP CObjectMap::ExpandVariables(VARIANT text, VARIANT env, VARIANT *pVa
                                }
                                continue;
                        }
-                       if(phase == 0){
+                       if (phase == 0) {
                                // \83t\83F\81[\83Y1\82Í\89½\82à\82µ\82È\82¢
                                idx++;
                        }
-                       else{
+                       else {
                                // \83t\83F\81[\83Y2\82Í\83o\83b\83t\83@\82É\92Ê\8fí\8f\91\82«\8d\9e\82Ý\82·\82é
                                pExpandBuffer[writeidx++] = str[idx++];
                        }
                }
                //
-               if(phase == 0){
+               if (phase == 0) {
                        // \83t\83F\81[\83Y1\82ª\8fI\97¹\82µ\82½\82Ì\82Å\83o\83b\83t\83@\83T\83C\83Y\82ª\94»\96¾\82µ\82½\81B
                        pExpandBuffer = new WCHAR[length + expandsize + 1];
                }
-               else{
+               else {
                        // \83t\83F\81[\83Y2\82ª\8fI\97¹\82µ\82½\82Ì\82Å\92u\8a·\82ª\8a®\97¹\82µ\82½
                        pExpandBuffer[writeidx] = 0;
                        varResult = (LPCWSTR)pExpandBuffer;
@@ -282,13 +278,16 @@ STDMETHODIMP CObjectMap::ExpandVariables(VARIANT text, VARIANT env, VARIANT *pVa
 
 STDMETHODIMP CObjectMap::get_IsExist(VARIANT key, BOOL *pVal)
 {
-       CComVariant varName;
        *pVal = VB_FALSE;
-       if(varName.ChangeType(VT_BSTR,&key) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+
+       CComVariant varName;
+       HRESULT hr;
+       if (FAILED(hr = varName.ChangeType(VT_BSTR, &key))) {
+               return hr;
        }
+
        VariantMap::iterator p = m_mapVariant.find(varName.bstrVal);
-       if(p != m_mapVariant.end()){
+       if (p != m_mapVariant.end()) {
                // \91\8dÝ\82·\82é
                *pVal = VB_TRUE;
        }
@@ -298,11 +297,13 @@ STDMETHODIMP CObjectMap::get_IsExist(VARIANT key, BOOL *pVal)
 STDMETHODIMP CObjectMap::Erase(VARIANT key)
 {
        CComVariant varName;
-       if(varName.ChangeType(VT_BSTR,&key) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+       HRESULT hr;
+       if (FAILED(hr = varName.ChangeType(VT_BSTR, &key))) {
+               return hr;
        }
+
        VariantMap::iterator p = m_mapVariant.find(varName.bstrVal);
-       if(p != m_mapVariant.end()){
+       if (p != m_mapVariant.end()) {
                m_mapVariant.erase(p);
        }
        return S_OK;
@@ -311,28 +312,34 @@ STDMETHODIMP CObjectMap::Erase(VARIANT key)
 STDMETHODIMP CObjectMap::LoadProfile(IUnknown *punkVal)
 {
        ISeraphyScriptTools_ProfileSection* pSection = NULL;
-       if(punkVal->QueryInterface(IID_ISeraphyScriptTools_ProfileSection,(void**)&pSection) != S_OK){
-               return DISP_E_UNKNOWNINTERFACE;
+       HRESULT hr;
+       if (FAILED(hr = punkVal->QueryInterface(
+               IID_ISeraphyScriptTools_ProfileSection, (void**)&pSection))) {
+               return hr;
        }
-       // 
+
        CComVariant varArray;
-       pSection->GetKeyNames(&varArray);
-       if(!(varArray.vt & VT_ARRAY)){
+       if (FAILED(hr = pSection->GetKeyNames(&varArray))) {
+               return hr;
+       }
+       if (!(varArray.vt & VT_ARRAY)) {
                // Internal Error
                return DISP_E_UNKNOWNINTERFACE;
        }
+
        // \94z\97ñ\82Ì\8f\87\8f\98\93I\8eæ\93¾
        long mx = 0;
-       HRESULT ret = SafeArrayGetUBound(varArray.parray,1,&mx);
-       if(ret != S_OK){
+       HRESULT ret = SafeArrayGetUBound(varArray.parray, 1, &mx);
+       if (ret != S_OK) {
                mx = -1;
        }
+
        long idx = 0;
-       while(idx <= mx){
-               CComVariant varKey,varVal;
-               if(SafeArrayGetElement(varArray.parray,&idx,&varKey) == S_OK){
-                       if(pSection->get_Value(varKey,&varVal) == S_OK){
-                               put_Value(varKey,varVal);
+       while (idx <= mx) {
+               CComVariant varKey, varVal;
+               if (SafeArrayGetElement(varArray.parray, &idx, &varKey) == S_OK) {
+                       if (pSection->get_Value(varKey, &varVal) == S_OK) {
+                               put_Value(varKey, varVal);
                        }
                }
                idx++;
@@ -344,16 +351,19 @@ STDMETHODIMP CObjectMap::LoadProfile(IUnknown *punkVal)
 STDMETHODIMP CObjectMap::SaveProfile(IUnknown *punkVal)
 {
        ISeraphyScriptTools_ProfileSection* pSection = NULL;
-       if(punkVal->QueryInterface(IID_ISeraphyScriptTools_ProfileSection,(void**)&pSection) != S_OK){
-               return DISP_E_UNKNOWNINTERFACE;
+       HRESULT hr;
+       if (FAILED(hr = punkVal->QueryInterface(
+               IID_ISeraphyScriptTools_ProfileSection, (void**)&pSection))) {
+               return hr;
        }
+
        // \8ai\94[\82³\82ê\82Ä\82¢\82é\96¼\91O\82Ì\97ñ\8b\93
        VariantMap::iterator p = m_mapVariant.begin();
-       while(p != m_mapVariant.end()){
+       while (p != m_mapVariant.end()) {
                CComVariant varTmp;
-               if(varTmp.ChangeType(VT_BSTR,&p->second) == S_OK){
+               if (SUCCEEDED(varTmp.ChangeType(VT_BSTR, &p->second))) {
                        CComVariant varIdx = (BSTR)p->first;
-                       pSection->put_Value(varIdx,varTmp);
+                       pSection->put_Value(varIdx, varTmp);
                }
                p++;
        }
index 36d8527..76363a1 100644 (file)
@@ -1,21 +1,20 @@
 // ObjectMap.h : CObjectMap \82Ì\90é\8c¾
 
-#ifndef __OBJECTMAP_H_
-#define __OBJECTMAP_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include <map>
 #include <string>
 using namespace std;
 
-typedef map<_bstr_t,VARIANT> VariantMap;
+typedef map<_bstr_t, VARIANT> VariantMap;
 
 /////////////////////////////////////////////////////////////////////////////
 // CObjectMap
-class ATL_NO_VTABLE CObjectMap : 
+class ATL_NO_VTABLE CObjectMap :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CObjectMap, &CLSID_ObjectMap>,
-       public ISupportErrorInfo,
+       public ISupportErrorInfoImpl<&IID_IObjectMap>,
        public IDispatchImpl<IObjectMap, &IID_IObjectMap, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
@@ -28,20 +27,17 @@ public:
                ATLTRACE("CObjectMap::FinalRelease\n");
        }
 
-DECLARE_REGISTRY_RESOURCEID(IDR_OBJECTMAP)
+       DECLARE_REGISTRY_RESOURCEID(IDR_OBJECTMAP)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CObjectMap)
-       COM_INTERFACE_ENTRY(IObjectMap)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
+       BEGIN_COM_MAP(CObjectMap)
+               COM_INTERFACE_ENTRY(IObjectMap)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+       END_COM_MAP()
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// IObjectMap
+       // IObjectMap
 public:
        STDMETHOD(SaveProfile)(/*[in]*/IUnknown* punkVal);
        STDMETHOD(LoadProfile)(/*[in]*/IUnknown* punkVal);
@@ -60,5 +56,3 @@ public:
 protected:
        VariantMap m_mapVariant;
 };
-
-#endif //__OBJECTMAP_H_
index f12898e..36931cc 100644 (file)
@@ -3,65 +3,57 @@
 #include "SeraphyScriptTools.h"
 #include "ObjectVector.h"
 #include "generic.h"
+#include "CComEnumDynaVARIANT.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // CObjectVector
 
-STDMETHODIMP CObjectVector::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_IObjectVector
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 STDMETHODIMP CObjectVector::CreateVector(IUnknown **punkVal)
 {
        *punkVal = NULL;
        CComObject<CObjectVector>* pVct = NULL;
-       if(pVct->CreateInstance(&pVct) == S_OK){
-               pVct->QueryInterface(IID_IUnknown,(void**)punkVal);
+       if (SUCCEEDED(pVct->CreateInstance(&pVct))) {
+               pVct->QueryInterface(IID_IUnknown, (void**)punkVal);
        }
        return S_OK;
 }
 
-STDMETHODIMP CObjectVector::Duplicate(VARIANT idx,VARIANT count,IUnknown **punkVal)
+STDMETHODIMP CObjectVector::Duplicate(VARIANT idx, VARIANT count, IUnknown **punkVal)
 {
        *punkVal = NULL;
        CComObject<CObjectVector>* pVct = NULL;
-       if(pVct->CreateInstance(&pVct) == S_OK){
-               pVct->QueryInterface(IID_IUnknown,(void**)punkVal);
+       if (SUCCEEDED(pVct->CreateInstance(&pVct))) {
+               pVct->QueryInterface(IID_IUnknown, (void**)punkVal);
        }
-       if(!m_vctVariant.empty()){
+
+       if (!m_vctVariant.empty()) {
                // \8ew\92è\88Ê\92u\82æ\82è\8ew\92è\90\94\82Ì\95¡\8eÊ
-               CComVariant varIdx,varCount;
+               CComVariant varIdx, varCount;
                long nIdx = 0;
-               if(varIdx.ChangeType(VT_I4,&idx) == S_OK){
+               if (SUCCEEDED(varIdx.ChangeType(VT_I4, &idx))) {
                        nIdx = varIdx.lVal;
                }
+
                long nCount = -1; // 0\96¢\96\9e\82ð\8ew\92è\82·\82é\82Æ\96\96\94ö\82Ü\82Å\82Ì\83J\83E\83\93\83g\82ð\8cv\8eZ\82·\82é
-               if(varCount.ChangeType(VT_I4,&count) == S_OK){
+               if (SUCCEEDED(varCount.ChangeType(VT_I4, &count))) {
                        nCount = varCount.lVal;
                }
+
                long mx = m_vctVariant.size();
-               if(nCount < 0 || nIdx + nCount >= mx){
+               if (nCount < 0 || nIdx + nCount >= mx) {
                        nCount = mx - nIdx;
                }
-               if(nIdx < 0){
+
+               if (nIdx < 0) {
                        nIdx = 0;
                }
-               if(nIdx < mx){
+
+               if (nIdx < mx) {
                        long i;
-                       for(i=0 ; i<nCount ; i++){
+                       for (i = 0; i < nCount; i++) {
                                VARIANT tmp;
                                ::VariantInit(&tmp);
-                               ::VariantCopy(&tmp,&m_vctVariant.at(nIdx + i));
+                               ::VariantCopy(&tmp, &m_vctVariant.at(nIdx + i));
                                pVct->m_vctVariant.push_back(tmp);
                        }
                }
@@ -73,7 +65,7 @@ STDMETHODIMP CObjectVector::Clear()
 {
        //VARIANT\82Ì\83N\83\8a\83A\82Æ\98A\91z\94z\97ñ\82Ì\89ð\95ú
        VariantVector::iterator p = m_vctVariant.begin();
-       while(p != m_vctVariant.end()){
+       while (p != m_vctVariant.end()) {
                ::VariantClear(&*p);
                p++;
        }
@@ -84,23 +76,26 @@ STDMETHODIMP CObjectVector::Clear()
 STDMETHODIMP CObjectVector::Erase(VARIANT idx, VARIANT count)
 {
        // \8ew\92è\88Ê\92u\82æ\82è\8ew\92è\90\94\82Ì\8dí\8f\9c
-       CComVariant varIdx,varCount;
+       CComVariant varIdx, varCount;
        long nIdx = 0;
-       if(varIdx.ChangeType(VT_I4,&idx) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_I4, &idx))) {
                nIdx = varIdx.lVal;
        }
+
        long nCount = 1;
-       if(varCount.ChangeType(VT_I4,&count) == S_OK){
+       if (SUCCEEDED(varCount.ChangeType(VT_I4, &count))) {
                nCount = varCount.lVal;
        }
+
        long mx = m_vctVariant.size();
-       if(nCount < 0 || nIdx + nCount >= mx){
+       if (nCount < 0 || nIdx + nCount >= mx) {
                nCount = mx - nIdx;
        }
-       if(nIdx < 0 || nIdx >= mx || nCount < 0 ){
+       if (nIdx < 0 || nIdx >= mx || nCount < 0) {
                return DISP_E_BADINDEX;
        }
-       m_vctVariant.erase(m_vctVariant.begin() + nIdx,m_vctVariant.begin() + nIdx + nCount);
+
+       m_vctVariant.erase(m_vctVariant.begin() + nIdx, m_vctVariant.begin() + nIdx + nCount);
        return S_OK;
 }
 
@@ -109,7 +104,7 @@ STDMETHODIMP CObjectVector::Push(VARIANT newVal)
        // \96\96\94ö\82É\92Ç\89Á
        VARIANT tmp;
        ::VariantInit(&tmp);
-       ::VariantCopy(&tmp,&newVal);
+       ::VariantCopy(&tmp, &newVal);
        m_vctVariant.push_back(tmp);
        return S_OK;
 }
@@ -118,10 +113,10 @@ STDMETHODIMP CObjectVector::Pop(VARIANT *pVal)
 {
        // \96\96\94ö\82ð\8eæ\82è\8fo\82µ
        ::VariantInit(pVal);
-       if(!m_vctVariant.empty()){
+       if (!m_vctVariant.empty()) {
                long mx = m_vctVariant.size();
                ::VariantInit(pVal);
-               ::VariantCopy(pVal,&m_vctVariant.at(mx-1));
+               ::VariantCopy(pVal, &m_vctVariant.at(mx - 1));
                m_vctVariant.pop_back();
        }
        return S_OK;
@@ -132,35 +127,40 @@ STDMETHODIMP CObjectVector::Insert(VARIANT idx, VARIANT newVal)
        // \8ew\92è\88Ê\92u\82É\91}\93ü
        CComVariant varIdx;
        long nIdx = 0;
-       if(varIdx.ChangeType(VT_I4,&idx) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_I4, &idx))) {
                nIdx = varIdx.lVal;
        }
+
        long mx = m_vctVariant.size();
-       if(nIdx < 0 || nIdx >= mx){
+       if (nIdx < 0 || nIdx >= mx) {
                return DISP_E_BADINDEX;
        }
+
        VARIANT tmp;
        ::VariantInit(&tmp);
-       ::VariantCopy(&tmp,&newVal); 
-       m_vctVariant.insert(m_vctVariant.begin() + nIdx,tmp);
+       ::VariantCopy(&tmp, &newVal);
+       m_vctVariant.insert(m_vctVariant.begin() + nIdx, tmp);
        return S_OK;
 }
 
 STDMETHODIMP CObjectVector::get_Value(VARIANT idx, VARIANT *pVal)
 {
        ::VariantInit(pVal);
+
        long nIdx = 0;
        CComVariant varIdx;
-       if(varIdx.ChangeType(VT_I4,&idx) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_I4, &idx))) {
                nIdx = varIdx.lVal;
        }
-       if(nIdx < 0){
+
+       if (nIdx < 0) {
                return DISP_E_BADINDEX;
        }
+
        long mx = m_vctVariant.size();
-       if(nIdx < mx){
+       if (nIdx < mx) {
                // \83x\83N\83^\81[\82Ì\94Í\88Í\93à\82È\82ç\92l\82ð\8eæ\93¾\82·\82é
-               ::VariantCopy(pVal,&m_vctVariant.at(nIdx));
+               ::VariantCopy(pVal, &m_vctVariant.at(nIdx));
        }
        return S_OK;
 }
@@ -169,25 +169,26 @@ STDMETHODIMP CObjectVector::put_Value(VARIANT idx, VARIANT newVal)
 {
        long nIdx = 0;
        CComVariant varIdx;
-       if(varIdx.ChangeType(VT_I4,&idx) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_I4, &idx))) {
                nIdx = varIdx.lVal;
        }
-       if(nIdx < 0){
+       if (nIdx < 0) {
                return DISP_E_BADINDEX;
        }
+
        long mx = m_vctVariant.size();
-       if(nIdx >= mx){
+       if (nIdx >= mx) {
                // \83x\83N\83^\81[\82Ì\94Í\88Í\82ð\92´\82¦\82Ä\82¢\82ê\82Î\8ag\92£\82µ\81A\8f\89\8aú\89»\82³\82ê\82½VARIANT\82Å\96\84\82ß\82é
                VARIANT tmp;
                ::VariantInit(&tmp);
-               while(mx <= nIdx){
+               while (mx <= nIdx) {
                        m_vctVariant.push_back(tmp);
                        mx++;
                }
        }
        // \83x\83N\83^\81[\82Ì\94Í\88Í\93à\82È\82ç\92l\82ð\8dÄ\90Ý\92è\82·\82é
        ::VariantClear(&m_vctVariant.at(nIdx));
-       ::VariantCopy(&m_vctVariant.at(nIdx),&newVal);
+       ::VariantCopy(&m_vctVariant.at(nIdx), &newVal);
        return S_OK;
 }
 
@@ -201,9 +202,9 @@ STDMETHODIMP CObjectVector::get__NewEnum(IUnknown **pVal)
 {
        typedef CComEnumDynaVARIANT<CObjectVector> CComEnumDynaVector;
        CComObject<CComEnumDynaVector>* pDyna = NULL;
-       if(pDyna->CreateInstance(&pDyna) == S_OK){
-               pDyna->Init(this,0);
-               pDyna->QueryInterface(IID_IEnumVARIANT,(void**)pVal);
+       if (SUCCEEDED(pDyna->CreateInstance(&pDyna))) {
+               pDyna->Init(this, 0);
+               pDyna->QueryInterface(IID_IEnumVARIANT, (void**)pVal);
        }
        return S_OK;
 }
@@ -212,45 +213,45 @@ STDMETHODIMP CObjectVector::Merge(VARIANT unkVal)
 {
        HRESULT ret = DISP_E_TYPEMISMATCH;
        CComVariant varUnk;
-       if(varUnk.ChangeType(VT_UNKNOWN,&unkVal) == S_OK){
+       if (SUCCEEDED(varUnk.ChangeType(VT_UNKNOWN, &unkVal))) {
                // \83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8fê\8d\87
                IObjectVector* pVect = NULL;
-               if(varUnk.punkVal->QueryInterface(IID_IObjectVector,(void**)&pVect) != S_OK){
+               if (SUCCEEDED(varUnk.punkVal->QueryInterface(IID_IObjectVector, (void**)&pVect))) {
                        // \8ew\92è\8aO\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82Å\82 \82é
                        return DISP_E_TYPEMISMATCH;
                }
                long mx;
                pVect->get_Count(&mx);
                long i;
-               for(i=0;i<mx;i++){
+               for (i = 0; i < mx; i++) {
                        CComVariant idx((long)i);
                        VARIANT ret;
                        ::VariantInit(&ret);
-                       pVect->get_Value(idx,&ret);
+                       pVect->get_Value(idx, &ret);
                        m_vctVariant.push_back(ret);
                }
                pVect->Release();
                ret = S_OK;
        }
-       else{
+       else {
                VARTYPE vt = VT_EMPTY;
-               SAFEARRAY* pArray = GetArrayFromVariant(unkVal,&vt);
-               if(pArray && vt == VT_VARIANT){
+               SAFEARRAY* pArray = GetArrayFromVariant(unkVal, &vt);
+               if (pArray && vt == VT_VARIANT) {
                        long lb = 0;
                        long ub = 0;
                        int dm = SafeArrayGetDim(pArray);
-                       SafeArrayGetLBound(pArray,1,&lb); // \8d\91¤\82Ì\93Y\82¦\8e\9a
-                       SafeArrayGetUBound(pArray,1,&ub);
-                       if(dm == 1 && lb == 0 && vt == VT_VARIANT){
+                       SafeArrayGetLBound(pArray, 1, &lb); // \8d\91¤\82Ì\93Y\82¦\8e\9a
+                       SafeArrayGetUBound(pArray, 1, &ub);
+                       if (dm == 1 && lb == 0 && vt == VT_VARIANT) {
                                // 1\8e\9f\8c³\94z\97ñ\82Å\81A0\83x\81[\83X\82Ì\83o\83\8a\83A\83\93\83g\94z\97ñ\82Å\82 \82é
                                int cnt;
                                long dim[1];
-                               for(cnt = 0 ; cnt <= ub ; cnt++){
+                               for (cnt = 0; cnt <= ub; cnt++) {
                                        // VARIANT\82Ì\94z\97ñ\82Å\82 \82é
                                        VARIANT tmp;
                                        ::VariantInit(&tmp);
                                        dim[0] = cnt;
-                                       SafeArrayGetElement(pArray,dim,&tmp);
+                                       SafeArrayGetElement(pArray, dim, &tmp);
                                        m_vctVariant.push_back(tmp);
                                }//next(\94z\97ñ\82Ì\83\8b\81[\83v)
                                ret = S_OK;
@@ -264,18 +265,18 @@ STDMETHODIMP CObjectVector::Merge(VARIANT unkVal)
 STDMETHODIMP CObjectVector::MakeArray(VARIANT *pVal)
 {
        long mx = m_vctVariant.size();
-       SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT,0,mx);
+       SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT, 0, mx);
        VARIANT* pvars;
-       if(SafeArrayAccessData(pArray,(void**)&pvars) == S_OK){
+       if (SUCCEEDED(SafeArrayAccessData(pArray, (void**)&pvars))) {
                long cnt = 0;
-               for(cnt = 0; cnt < mx ; cnt++){
+               for (cnt = 0; cnt < mx; cnt++) {
                        VariantInit(&pvars[cnt]);
-                       VariantCopy(&pvars[cnt],&m_vctVariant.at(cnt));
+                       VariantCopy(&pvars[cnt], &m_vctVariant.at(cnt));
                }
                SafeArrayUnaccessData(pArray);
        }
        pArray->fFeatures |= FADF_HAVEVARTYPE;
-       pVal->vt     = VT_ARRAY | VT_VARIANT;
+       pVal->vt = VT_ARRAY | VT_VARIANT;
        pVal->parray = pArray;
        return S_OK;
 }
index 6acc11b..9af8b09 100644 (file)
@@ -1,7 +1,6 @@
 // ObjectVector.h : CObjectVector \82Ì\90é\8c¾
 
-#ifndef __OBJECTVECTOR_H_
-#define __OBJECTVECTOR_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include <vector>
@@ -11,10 +10,10 @@ typedef vector<VARIANT> VariantVector;
 
 /////////////////////////////////////////////////////////////////////////////
 // CObjectVector
-class ATL_NO_VTABLE CObjectVector : 
+class ATL_NO_VTABLE CObjectVector :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CObjectVector, &CLSID_ObjectVector>,
-       public ISupportErrorInfo,
+       public ISupportErrorInfoImpl<&IID_IObjectVector>,
        public IDispatchImpl<IObjectVector, &IID_IObjectVector, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
@@ -28,20 +27,17 @@ public:
                Clear();
        }
 
-DECLARE_REGISTRY_RESOURCEID(IDR_OBJECTVECTOR)
+       DECLARE_REGISTRY_RESOURCEID(IDR_OBJECTVECTOR)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CObjectVector)
-       COM_INTERFACE_ENTRY(IObjectVector)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
+       BEGIN_COM_MAP(CObjectVector)
+               COM_INTERFACE_ENTRY(IObjectVector)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+       END_COM_MAP()
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// IObjectVector
+       // IObjectVector
 public:
        STDMETHOD(MakeArray)(/*[out,retval]*/VARIANT* pVal);
        STDMETHOD(Merge)(/*[in]*/VARIANT unkVal);
@@ -59,5 +55,3 @@ public:
 protected:
        VariantVector m_vctVariant;
 };
-
-#endif //__OBJECTVECTOR_H_
index d787166..4f8e5b0 100644 (file)
@@ -22,31 +22,33 @@ COverlappedWindow::COverlappedWindow()
        m_hIcon = NULL;
 
        // \83C\83x\83\93\83g\91Ò\8b@\97p\83C\83x\83\93\83g\83n\83\93\83h\83\8b\81A\83C\83x\83\93\83g\8f\88\97\9d\92\86\83Z\83}\83t\83H
-       m_hWaitEvent    = CreateEvent(NULL,false,false,NULL); // \8e©\93®\83C\83x\83\93\83g : \8f\89\8aúFALSE
+       m_hWaitEvent = CreateEvent(NULL, false, false, NULL); // \8e©\93®\83C\83x\83\93\83g : \8f\89\8aúFALSE
        // \83N\83\8a\83e\83B\83J\83\8b\83Z\83N\83V\83\87\83\93
        InitializeCriticalSection(&m_objEventDataProtection);
 
        // \83C\83x\83\93\83g\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8f\89\8aú\89»
-       m_pEvent  = NULL;
+       m_pEvent = NULL;
        // \83N\83\89\83X\83I\83u\83W\83F\83N\83g\82Ì\8f\89\8aú\89»
        m_pClassDisp = NULL;
        m_bAutoReleaseClassObject = true;
 
        // \83E\83B\83\93\83h\83E\83T\83C\83Y
-       windowParam.SetWindowPlacement(CW_USEDEFAULT,CW_USEDEFAULT,300,300);
-       windowParam.noclose         = false;
-       windowParam.doublebuffer    = true;
+       // \81¦ Windows2000\8e\9e\91ã\82Í300x300\82¾\82Á\82½\82ª\81ALuna\88È\8d~\82Å\98g\95\9d\82ª\95Ï\8dX\82³\82ê\82½\82±\82Æ\82É\82æ\82è
+       // \89¡\95\9d308\82É\8fC\90³\82µ\82½\81B(2015/08)
+       windowParam.SetWindowPlacement(CW_USEDEFAULT, CW_USEDEFAULT, 308, 300);
+       windowParam.noclose = false;
+       windowParam.doublebuffer = true;
        windowParam.automessageloop = true;
        // \83o\83b\83N\83O\83\89\83E\83\93\83h\83u\83\89\83V
-       m_dwBackColor    = ::GetSysColor(COLOR_WINDOW);
-       m_hBkBrush  = CreateSolidBrush(COLORREF(m_dwBackColor));
+       m_dwBackColor = ::GetSysColor(COLOR_WINDOW);
+       m_hBkBrush = CreateSolidBrush(COLORREF(m_dwBackColor));
        // \83E\83B\83\93\83h\83E\82Ì\8dì\90¬
-       m_hParentWnd    = NULL;
-       m_hPopupWnd     = NULL;
-       m_hMenu         = NULL;
+       m_hParentWnd = NULL;
+       m_hPopupWnd = NULL;
+       m_hMenu = NULL;
 
        // \83\86\81[\83U\81[\83\82\81[\83h\82Ì\8f\89\8aú\89»
-       m_bQuit        = false; // \95Â\82\82ç\82ê\82Ä\82¢\82È\82¢\82±\82Æ\82ð\8e¦\82·
+       m_bQuit = false; // \95Â\82\82ç\82ê\82Ä\82¢\82È\82¢\82±\82Æ\82ð\8e¦\82·
        m_dModalExitCode = 0;   // \83\82\81[\83_\83\8b\95Ô\93\9a\83R\81[\83h
        m_dCaptureMode = 0;
        m_bDefaultAction = true; // \83f\83B\83t\83H\83\8b\83g\82ÌOK/CANCEL\83A\83N\83V\83\87\83\93\82Å\95Â\82\82é
@@ -54,18 +56,19 @@ COverlappedWindow::COverlappedWindow()
        // \83t\83H\81[\83\80\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8dì\90¬
        m_pForm = NULL;
        m_hLastFocusControl = NULL;
-       if(m_pForm->CreateInstance(&m_pForm) == S_OK){
+       if (m_pForm->CreateInstance(&m_pForm) == S_OK) {
                m_pForm->AddRef();
-               m_pForm->SetWindowSize(windowParam.width,windowParam.height,true);
+               m_pForm->SetWindowSize(windowParam.width, windowParam.height,
+                       windowParam.GetStyle(), windowParam.exstyle);
        }
        // \95`\89æ\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\90\90¬
        m_pCanvas = NULL;
-       if(m_pCanvas->CreateInstance(&m_pCanvas) == S_OK){
+       if (m_pCanvas->CreateInstance(&m_pCanvas) == S_OK) {
                m_pCanvas->AddRef();
        }
        // \83\86\81[\83U\81[\92è\8b`\98A\91z\94z\97ñ\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\90\90¬
        m_pObject = NULL;
-       if(m_pObject->CreateInstance(&m_pObject) == S_OK){
+       if (m_pObject->CreateInstance(&m_pObject) == S_OK) {
                m_pObject->AddRef();
        }
        // \83E\83F\83C\83g\83J\81[\83\\83\8b\82Ì\8f\89\8aú\89»
@@ -85,72 +88,72 @@ void COverlappedWindow::FinalRelease()
        ClassObjectInvoke(L"ExitWindow");
 
        // \83N\83\89\83X\83I\83u\83W\83F\83N\83g\82Ì\95ú\8aü
-       if(     m_pClassDisp ){
+       if (m_pClassDisp) {
                m_pClassDisp->Release();
                m_pClassDisp = NULL;
        }
 
        // \83A\83C\83R\83\93\82Ì\94j\8aü
-       if(m_hIcon){
+       if (m_hIcon) {
                ::DestroyIcon(m_hIcon);
        }
        // \83`\83\83\83C\83\8b\83h\83|\83b\83v\83A\83b\83v\82Ì\94j\8aü
        list<CComObject<COverlappedWindow>*>::iterator pWnd = m_lstChild.begin();
-       while(pWnd != m_lstChild.end()){
+       while (pWnd != m_lstChild.end()) {
                (*pWnd)->Close();
                (*pWnd)->Release();
                pWnd = m_lstChild.erase(pWnd);
        }
        // \83C\83x\83\93\83g\83I\83u\83W\83F\83N\83g\82Ì\94j\8aü
-       if(m_pEvent){
+       if (m_pEvent) {
                m_pEvent->Release();
                m_pEvent = NULL;
        }
 
        // \83h\83\8d\81[\83C\83\93\83O\83I\83u\83W\83F\83N\83g\82Ì\83f\83^\83b\83`\82Æ\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\95ú\8aü
-       if(m_pCanvas){
+       if (m_pCanvas) {
                m_pCanvas->DetachOwner();
                m_pCanvas->Release();
                m_pCanvas = NULL;
        }
        // \83t\83H\81[\83\80\82Ì\94j\8aü
-       if(m_pForm){
+       if (m_pForm) {
                m_pForm->DetachOwner();
                m_pForm->Release();
                m_pForm = NULL;
        }
        // \83\86\81[\83U\81[\92è\8b`\98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82Ì\94j\8aü
-       if(m_pObject){
+       if (m_pObject) {
                m_pObject->Release();
                m_pObject = NULL;
        }
 
        // \94w\8ci\83u\83\89\83V\82Ì\89ð\95ú
-       if(m_hBkBrush){
+       if (m_hBkBrush) {
                DeleteObject(m_hBkBrush);
        }
 
        EnterCriticalSection(&m_objEventDataProtection);
        // \83C\83x\83\93\83g\83f\81[\83^\82Ì\89ð\95ú
        list<CComObject<CEvent>*>::iterator pEv = m_lstEvent.begin();
-       while(pEv != m_lstEvent.end()){
+       while (pEv != m_lstEvent.end()) {
                (*pEv)->Release();
                pEv = m_lstEvent.erase(pEv);
        }
        LeaveCriticalSection(&m_objEventDataProtection);
 
        // \83C\83x\83\93\83g\83n\83\93\83h\83\8b\82Ì\89ð\95ú
-       if(m_hWaitEvent){
+       if (m_hWaitEvent) {
                CloseHandle(m_hWaitEvent);
                m_hWaitEvent = NULL;
        }
        // \83\81\83j\83\85\81[\82Ì\94j\8aü
-       if(m_hMenu){
+       if (m_hMenu) {
                DestroyMenu(m_hMenu);
                m_hMenu = NULL;
        }
        // \83\81\83C\83\93\83E\83B\83\93\83h\83E\82Ì\94j\8aü
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                ::DestroyWindow(m_hPopupWnd);
                m_hPopupWnd = NULL;
        }
@@ -169,7 +172,7 @@ STDMETHODIMP COverlappedWindow::get_Caption(BSTR* pVal)
 
 STDMETHODIMP COverlappedWindow::put_Caption(BSTR newVal)
 {
-       SysReAllocString(&m_bstrCaption,newVal);
+       SysReAllocString(&m_bstrCaption, newVal);
        SetTitle();
        return S_OK;
 }
@@ -183,12 +186,12 @@ STDMETHODIMP COverlappedWindow::get_backColor(long *pVal)
 STDMETHODIMP COverlappedWindow::put_backColor(long newVal)
 {
        m_dwBackColor = newVal;
-       if(m_hBkBrush){
+       if (m_hBkBrush) {
                DeleteObject(m_hBkBrush);
        }
-       m_hBkBrush  = CreateSolidBrush(COLORREF(newVal));
-       if(m_hPopupWnd){
-               ::InvalidateRect(m_hPopupWnd,NULL,true);
+       m_hBkBrush = CreateSolidBrush(COLORREF(newVal));
+       if (m_hPopupWnd) {
+               ::InvalidateRect(m_hPopupWnd, NULL, true);
                ::UpdateWindow(m_hPopupWnd);
        }
        return S_OK;
@@ -197,36 +200,36 @@ STDMETHODIMP COverlappedWindow::put_backColor(long newVal)
 HWND COverlappedWindow::SafeCreateWnd()
 {
        // \90\90¬\8dÏ\82Ý\82Å\82 \82ê\82Î\89½\82à\82µ\82È\82¢\81B
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                return m_hPopupWnd;
        }
        // \83E\83B\83\93\83h\83E\90\90¬\82É\95K\97v\82È\91S\83p\83\89\83\81\81[\83^\81[\82Í\83R\83\93\83X\83g\83\89\83N\83^\82Å\8dì\90¬\8dÏ\82Ý
        // \82 \82Æ\82Í\83E\83B\83\93\83h\83E\82ª\95K\97v\82É\82È\82Á\82½\83^\83C\83~\83\93\83O\82Å\90\90¬\82ð\8ds\82¤
 
-       if(windowParam.noclose){
+       if (windowParam.noclose) {
                // \95Â\82\82é\83{\83^\83\93\82È\82µ\83^\83C\83v
                windowParam.SetWindowClassName(_TEXT("SeraphyScriptToolsOverlappedWindowNC"));
                windowParam.wndstyle = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_NOCLOSE;
        }
-       else{
+       else {
                windowParam.SetWindowClassName(_TEXT("SeraphyScriptToolsOverlappedWindow"));
                windowParam.wndstyle = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
        }
-       
+
        WNDCLASSEX wcex = {0};
-       wcex.cbSize = sizeof(WNDCLASSEX); 
-       wcex.lpfnWndProc        = (WNDPROC)WindowProc;
-       wcex.cbClsExtra         = 0;
-       wcex.cbWndExtra         = 0;
-       wcex.hInstance          = _Module.m_hInst;
-       wcex.hIcon                      = NULL;//(HICON)LoadImage(NULL,"SETUPICON.ICO",IMAGE_ICON,16,16,LR_LOADFROMFILE);//LoadIcon(hInstance, (LPCTSTR)IDI_INSTPAC);
-       wcex.hIconSm            = m_hIcon;//LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
-       wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);
-       wcex.hbrBackground      = NULL;
-       wcex.lpszMenuName       = NULL;
-       wcex.lpszClassName      = windowParam.szClassName;
-       wcex.style          = windowParam.wndstyle;
-       ATOM atm = RegisterClassEx( &wcex );
+       wcex.cbSize = sizeof(WNDCLASSEX);
+       wcex.lpfnWndProc = (WNDPROC)WindowProc;
+       wcex.cbClsExtra = 0;
+       wcex.cbWndExtra = 0;
+       wcex.hInstance = _Module.m_hInst;
+       wcex.hIcon = NULL;//(HICON)LoadImage(NULL,"SETUPICON.ICO",IMAGE_ICON,16,16,LR_LOADFROMFILE);//LoadIcon(hInstance, (LPCTSTR)IDI_INSTPAC);
+       wcex.hIconSm = m_hIcon;//LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
+       wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+       wcex.hbrBackground = NULL;
+       wcex.lpszMenuName = NULL;
+       wcex.lpszClassName = windowParam.szClassName;
+       wcex.style = windowParam.wndstyle;
+       ATOM atm = RegisterClassEx(&wcex);
 
        HWND hWnd = CreateWindowEx(
                WS_EX_CONTROLPARENT,
@@ -242,22 +245,22 @@ HWND COverlappedWindow::SafeCreateWnd()
        ::SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) this); // \83N\83\89\83X\82Æ\8aÖ\98A\95t\82¯\82é
        m_hPopupWnd = hWnd;
        // \83E\83B\83\93\83h\83E\83X\83^\83C\83\8b\82Ì\8dÄ\90Ý\92è
-       ::SetWindowLong(m_hPopupWnd,GWL_STYLE,windowParam.GetStyle());
+       ::SetWindowLong(m_hPopupWnd, GWL_STYLE, windowParam.GetStyle());
        Refresh();
 
        // \83V\83X\83e\83\80\83\81\83j\83\85\81[\82É\83t\83\8c\81[\83\80\88Ú\93®\83\81\83j\83\85\81[\82ð\82Â\82¯\82é
-       HMENU hMenu = ::GetSystemMenu(m_hPopupWnd,false);
+       HMENU hMenu = ::GetSystemMenu(m_hPopupWnd, false);
        int cnt = ::GetMenuItemCount(hMenu);
        MENUITEMINFO minfo = {0};
        minfo.cbSize = sizeof(MENUITEMINFO);
-       minfo.fMask  = MIIM_TYPE|MIIM_ID;
-       minfo.fType  = MFT_STRING;
-       minfo.wID    = WM_MOVENEXT_OVERLAPPED;
+       minfo.fMask = MIIM_TYPE | MIIM_ID;
+       minfo.fType = MFT_STRING;
+       minfo.wID = WM_MOVENEXT_OVERLAPPED;
        minfo.dwTypeData = _TEXT("\8e\9f\82Ì\83E\83B\83\93\83h\83E\82É\88Ú\93®\tF6"); //FIXME: \83\8a\83\\81[\83X\82É\88Ú\93®\82·\82é
-       ::InsertMenuItem(hMenu,cnt,true,&minfo);
-       
+       ::InsertMenuItem(hMenu, cnt, true, &minfo);
+
        // \83t\83H\81[\83\80\82Ì\83\81\83C\83\93\83E\83B\83\93\83h\83E\97p\82Æ\82µ\82Ä\83A\83^\83b\83`\82·\82é
-       if(m_pForm){
+       if (m_pForm) {
                // \83R\83\93\83g\83\8d\81[\83\8b\82Ì\8e\96\91O\8dì\90¬\95ª\82à\8e©\93®\90\90¬\82³\82ê\82é
                m_pForm->AttachOwner(m_hPopupWnd);
        }
@@ -274,182 +277,181 @@ LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
        COverlappedWindow* me = (COverlappedWindow*)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        // \8bÙ\8b}\92â\8e~\82Ì\94»\92è
-       if(GetAsyncKeyState(VK_PAUSE) & 0x8000){
-               ::EnableWindow(hWnd,true);
+       if (GetAsyncKeyState(VK_PAUSE) & 0x8000) {
+               ::EnableWindow(hWnd, true);
                me->m_bQuit = 1;
                me->m_dModalExitCode = 3;
        }
 
-       switch(uMsg)
-       {
-       case WM_MOVENEXT_OVERLAPPED:
+       switch (uMsg) {
+               case WM_MOVENEXT_OVERLAPPED:
                {
                        me->MoveNextOverlapped();
                        return 0;
                }
-       case WM_CREATE:
+               case WM_CREATE:
                {
                        // \83f\83B\83t\83H\83\8b\83g\82Ì\93®\8dì\82ð\8ds\82¤
                        break;
                }
-       case WM_PAINT:
+               case WM_PAINT:
                {
                        PAINTSTRUCT ps;
                        RECT rt;
-                       ::GetClientRect( hWnd, &rt );
-                       HDC hdc  = ::BeginPaint (hWnd, &ps);
+                       ::GetClientRect(hWnd, &rt);
+                       HDC hdc = ::BeginPaint(hWnd, &ps);
                        HDC hdc2 = hdc;
                        HBITMAP bmp;
                        BOOL bDblBuf = me->windowParam.doublebuffer;
-                       if(bDblBuf){
+                       if (bDblBuf) {
                                // \82¿\82ç\82Â\82«\82ð\96³\82­\82·\82é\82½\82ß\82É\83o\83u\83\8b\83o\83b\83t\83@\95\97\82É\82·\82é\82©\81H
                                hdc2 = ::CreateCompatibleDC(NULL);
-                               bmp = ::CreateCompatibleBitmap(hdc,rt.right,rt.bottom);
-                               ::SelectObject(hdc2,bmp);
+                               bmp = ::CreateCompatibleBitmap(hdc, rt.right, rt.bottom);
+                               ::SelectObject(hdc2, bmp);
                        }
                        // \94w\8ci\82ð\93h\82è\82Â\82Ô\82·
-                       ::SetBkColor(hdc2,COLORREF(me->m_dwBackColor));
-                       ::SetBkMode(hdc2,TRANSPARENT);
-                       ::SetPolyFillMode(hdc2,ALTERNATE);
-                       FillRect(hdc2,&rt,me->m_hBkBrush);
+                       ::SetBkColor(hdc2, COLORREF(me->m_dwBackColor));
+                       ::SetBkMode(hdc2, TRANSPARENT);
+                       ::SetPolyFillMode(hdc2, ALTERNATE);
+                       FillRect(hdc2, &rt, me->m_hBkBrush);
 
                        // \83h\83\8d\81[\83C\83\93\83O\83f\81[\83^\81[\82Ì\95`\89æ
-                       if(me->m_pCanvas){
-                               me->m_pCanvas->Draw(hdc2,rt);
+                       if (me->m_pCanvas) {
+                               me->m_pCanvas->Draw(hdc2, rt);
                        }
 
-                       if(bDblBuf){
+                       if (bDblBuf) {
                                // \83_\83u\83\8b\83o\83b\83t\83@\82Ì\93]\91\97
-                               ::BitBlt(hdc,0,0,rt.right,rt.bottom,hdc2,0,0,SRCCOPY);
+                               ::BitBlt(hdc, 0, 0, rt.right, rt.bottom, hdc2, 0, 0, SRCCOPY);
                                DeleteDC(hdc2);
                                DeleteObject(bmp);
                        }
-                       ::EndPaint( hWnd, &ps );
+                       ::EndPaint(hWnd, &ps);
                        break;
                }
-       case WM_SYSCOMMAND:
+               case WM_SYSCOMMAND:
                {
-                       if(wParam == SC_CLOSE){
-                               if(me->windowParam.autoclose){
+                       if (wParam == SC_CLOSE) {
+                               if (me->windowParam.autoclose) {
                                        me->Close();
                                }
                                me->m_bQuit = true;
                                me->m_dModalExitCode = IDABORT;
-                               me->AddEventSingle(WM_COMMAND,IDABORT,0);
+                               me->AddEventSingle(WM_COMMAND, IDABORT, 0);
                                return false;
                        }
-                       else if(wParam == WM_MOVENEXT_OVERLAPPED){
-                               SendMessage(hWnd,WM_MOVENEXT_OVERLAPPED,0,0);
+                       else if (wParam == WM_MOVENEXT_OVERLAPPED) {
+                               SendMessage(hWnd, WM_MOVENEXT_OVERLAPPED, 0, 0);
                                return 0;
                        }
                        break;
                }
-       case WM_MOUSEMOVE:
+               case WM_MOUSEMOVE:
                {
-                       me->AddEventSingle(WM_MOUSEMOVE,0,0);
+                       me->AddEventSingle(WM_MOUSEMOVE, 0, 0);
                        break;
                }
-       case WM_LBUTTONDBLCLK:
+               case WM_LBUTTONDBLCLK:
                {
-                       me->AddEvent(WM_LBUTTONDBLCLK,0,0);
+                       me->AddEvent(WM_LBUTTONDBLCLK, 0, 0);
                        break;
                }
-       case WM_RBUTTONDBLCLK:
+               case WM_RBUTTONDBLCLK:
                {
-                       me->AddEvent(WM_RBUTTONDBLCLK,0,0);
+                       me->AddEvent(WM_RBUTTONDBLCLK, 0, 0);
                        break;
                }
-       case WM_LBUTTONDOWN:
+               case WM_LBUTTONDOWN:
                {
-                       if(me->m_dCaptureMode == 0){
-                               me->AddEvent(WM_LBUTTONDOWN,0,0);
+                       if (me->m_dCaptureMode == 0) {
+                               me->AddEvent(WM_LBUTTONDOWN, 0, 0);
                                ::SetCapture(hWnd);
                                me->m_dCaptureMode |= 0x01;
                        }
-                       else{
+                       else {
                                ReleaseCapture();
                        }
                        break;
                }
-       case WM_LBUTTONUP:
+               case WM_LBUTTONUP:
                {
-                       if(me->m_dCaptureMode & 0x01){
-                               me->AddEvent(WM_LBUTTONUP,0,0);
+                       if (me->m_dCaptureMode & 0x01) {
+                               me->AddEvent(WM_LBUTTONUP, 0, 0);
                                me->m_dCaptureMode &= ~0x01;
                                ReleaseCapture();
                        }
                        break;
                }
-       case WM_RBUTTONDOWN:
+               case WM_RBUTTONDOWN:
                {
-                       if(me->m_dCaptureMode == 0){
-                               me->AddEvent(WM_RBUTTONDOWN,0,0);
+                       if (me->m_dCaptureMode == 0) {
+                               me->AddEvent(WM_RBUTTONDOWN, 0, 0);
                                ::SetCapture(hWnd);
                                me->m_dCaptureMode |= 0x02;
                        }
-                       else{
+                       else {
                                ReleaseCapture();
                        }
                        break;
                }
-       case WM_RBUTTONUP:
+               case WM_RBUTTONUP:
                {
-                       if(me->m_dCaptureMode & 0x02){
-                               me->AddEvent(WM_RBUTTONUP,0,0);
+                       if (me->m_dCaptureMode & 0x02) {
+                               me->AddEvent(WM_RBUTTONUP, 0, 0);
                                me->m_dCaptureMode &= ~0x02;
                                ReleaseCapture();
                        }
                        break;
                }
-       case WM_CAPTURECHANGED:
+               case WM_CAPTURECHANGED:
                {
-                       if(me->m_dCaptureMode & 0x01){
-                               me->AddEvent(WM_CAPTURECHANGED,1,0);
+                       if (me->m_dCaptureMode & 0x01) {
+                               me->AddEvent(WM_CAPTURECHANGED, 1, 0);
                        }
-                       if(me->m_dCaptureMode & 0x02){
-                               me->AddEvent(WM_CAPTURECHANGED,2,0);
+                       if (me->m_dCaptureMode & 0x02) {
+                               me->AddEvent(WM_CAPTURECHANGED, 2, 0);
                        }
                        me->m_dCaptureMode = 0;
                        break;
                }
-       case WM_SIZE:
+               case WM_SIZE:
                {
-                       me->AddEventSingle(WM_SIZE,0,0);
+                       me->AddEventSingle(WM_SIZE, 0, 0);
                        break;
                }
-       case WM_TIMER:
+               case WM_TIMER:
                {
-                       if(wParam == 1){
-                               me->AddEventSingle(WM_TIMER,0,0);
+                       if (wParam == 1) {
+                               me->AddEventSingle(WM_TIMER, 0, 0);
                        }
                        break;
                }
-       case WM_DROPFILES:
+               case WM_DROPFILES:
                {
                        HDROP hDrop = (HDROP)wParam;
                        me->m_dropfiles.DropFiles(hDrop);
-                       me->AddEvent(WM_DROPFILES,0,0);
+                       me->AddEvent(WM_DROPFILES, 0, 0);
                        break;
                }
-       case WM_KEYDOWN:
+               case WM_KEYDOWN:
                {
                        DWORD st = 0;
-                       if(GetKeyState(VK_SHIFT  ) & 0x8000) st |= 0x01;
-                       if(GetKeyState(VK_CONTROL) & 0x8000) st |= 0x02;
-                       if(GetKeyState(VK_MENU   ) & 0x8000) st |= 0x04;
-                       me->AddEventSingle(WM_KEYDOWN,wParam,st);
+                       if (GetKeyState(VK_SHIFT) & 0x8000) st |= 0x01;
+                       if (GetKeyState(VK_CONTROL) & 0x8000) st |= 0x02;
+                       if (GetKeyState(VK_MENU) & 0x8000) st |= 0x04;
+                       me->AddEventSingle(WM_KEYDOWN, wParam, st);
                        return 0;
                }
-       case WM_KEYDOWN_EX:
+               case WM_KEYDOWN_EX:
                {
                        DWORD st = 0;
-                       if(GetKeyState(VK_SHIFT  ) & 0x8000) st |= 0x01;
-                       if(GetKeyState(VK_CONTROL) & 0x8000) st |= 0x02;
-                       if(GetKeyState(VK_MENU   ) & 0x8000) st |= 0x04;
-                       me->AddEventSingle(WM_KEYDOWN_EX,wParam,st);
+                       if (GetKeyState(VK_SHIFT) & 0x8000) st |= 0x01;
+                       if (GetKeyState(VK_CONTROL) & 0x8000) st |= 0x02;
+                       if (GetKeyState(VK_MENU) & 0x8000) st |= 0x04;
+                       me->AddEventSingle(WM_KEYDOWN_EX, wParam, st);
                        return 0;
                }
-       case WM_COMMAND:
+               case WM_COMMAND:
                {
 #ifdef _DEBUG
                        TCHAR mes[MAX_PATH];
@@ -457,64 +459,62 @@ LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
                        OutputDebugString(mes);
 #endif
                        HWND hControl = (HWND)lParam;
-                       int nID    = LOWORD(wParam);
+                       int nID = LOWORD(wParam);
                        int notify = HIWORD(wParam);
-                       if(!notify){
-                               if(nID == IDABORT){
+                       if (!notify) {
+                               if (nID == IDABORT) {
                                        // IDABORT\82Æ\93¯\88ê\82È\82çquit\82ð\97§\82Ä\82é
                                        me->m_bQuit = true;
                                }
-                               me->AddEventSingle(WM_COMMAND,nID,0);
+                               me->AddEventSingle(WM_COMMAND, nID, 0);
                        }
-                       else{
+                       else {
                                // \83R\83\93\83g\83\8d\81[\83\8b\92Ê\92m
-                               switch(notify)
-                               {
-                               case CBN_SETFOCUS:
-                               case LBN_SETFOCUS:
-                               case EN_SETFOCUS:
-                               case BN_SETFOCUS:
+                               switch (notify) {
+                                       case CBN_SETFOCUS:
+                                       case LBN_SETFOCUS:
+                                       case EN_SETFOCUS:
+                                       case BN_SETFOCUS:
                                        // TreeView - ListView\88È\8aO\82Ì\83R\83\93\83g\83\8d\81[\83\8b\82ª\83t\83H\81[\83J\83X\82ð\8eó\82¯\8eæ\82Á\82½\82±\82Æ\82ð\92Ê\92m\82·\82é
                                        me->m_hLastFocusControl = hControl;
                                        break;
-                               case LBN_DBLCLK:
+                                       case LBN_DBLCLK:
                                        // LISTBOX\82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
-                                       me->AddEvent(WM_COMMAND,nID,0);
-                               default:
+                                       me->AddEvent(WM_COMMAND, nID, 0);
+                                       default:
                                        break;
                                }
                        }
                        break;
                }
-       case WM_NOTIFY:
+               case WM_NOTIFY:
                {
                        NMHDR* notify = (NMHDR*)lParam;
-                       switch(notify->code)
-                       {
-                       case NM_SETFOCUS:
+                       switch (notify->code) {
+                               case NM_SETFOCUS:
                                {
                                        // TreeView - ListView\82ª\83t\83H\81[\83J\83X\82ð\8eó\82¯\8eæ\82Á\82½\82±\82Æ\82ð\92Ê\92m\82·\82é
                                        me->m_hLastFocusControl = notify->hwndFrom;
                                        return 0;
                                }
-                       case TVN_SELCHANGED:
+                               case TVN_SELCHANGED:
                                {
                                        // TreeView\82Ì\91I\91ð\82ª\95Ï\8dX\82³\82ê\82½\82±\82Æ\82ð\92Ê\92m\82³\82ê\82é
                                        LPNMTREEVIEW pnmTv = (LPNMTREEVIEW)lParam;
-                                       me->AddEvent(WM_COMMAND,pnmTv->hdr.idFrom,0);
+                                       me->AddEvent(WM_COMMAND, pnmTv->hdr.idFrom, 0);
                                        return 0;
                                }
-                       case NM_DBLCLK:
+                               case NM_DBLCLK:
                                {
                                        // ListView - TreeView\82Å\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½\82±\82Æ\82ð\92Ê\92m\82³\82ê\82½
-                                       LPNMITEMACTIVATE pnmLv = (LPNMITEMACTIVATE) lParam;
-                                       me->AddEvent(WM_COMMAND,pnmLv->hdr.idFrom,0);
+                                       LPNMITEMACTIVATE pnmLv = (LPNMITEMACTIVATE)lParam;
+                                       me->AddEvent(WM_COMMAND, pnmLv->hdr.idFrom, 0);
                                        return 0;
                                }
-                       case LVN_COLUMNCLICK:
+                               case LVN_COLUMNCLICK:
                                {
                                        // ListView\82Å\83J\83\89\83\80\82ª\83N\83\8a\83b\83N\82³\82ê\82½\82±\82Æ\82ð\92Ê\92m\82·\82é
-                                       LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
+                                       LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;
                                        LONG_PTR addr = ::GetWindowLongPtr(pnmv->hdr.hwndFrom, GWLP_USERDATA);
                                        if (addr) {
                                                // \83J\83\89\83\80\83N\83\8a\83b\83N\82É\82æ\82é\83\\81[\83e\83B\83\93\83O\82ð\8ds\82¤
@@ -523,90 +523,90 @@ LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
                                        }
                                        return 0;
                                }
-                       case LVN_ENDLABELEDIT:
+                               case LVN_ENDLABELEDIT:
                                {
                                        // ListView\82Å\8d\80\96Ú\82ª\95Ò\8fW\82³\82ê\82½\82±\82Æ\82ð\92Ê\92m\82·\82é
-                                       NMLVDISPINFO* pdi = (NMLVDISPINFO*) lParam;
-                                       if(pdi->item.mask & LVIF_TEXT){
-                                               ListView_SetItemText(pdi->hdr.hwndFrom,pdi->item.iItem,0,pdi->item.pszText);
+                                       NMLVDISPINFO* pdi = (NMLVDISPINFO*)lParam;
+                                       if (pdi->item.mask & LVIF_TEXT) {
+                                               ListView_SetItemText(pdi->hdr.hwndFrom, pdi->item.iItem, 0, pdi->item.pszText);
                                        }
                                        return 0;
                                }
-                       case LVN_KEYDOWN:
+                               case LVN_KEYDOWN:
                                {
                                        // ListView\82Å\83L\81[\83{\81[\83h\82ª\89\9f\82³\82ê\82½\82±\82Æ\82ð\92Ê\92m\82·\82é
-                                       LPNMLVKEYDOWN pnkd = (LPNMLVKEYDOWN) lParam;
-                                       if(pnkd->wVKey == VK_SPACE){
+                                       LPNMLVKEYDOWN pnkd = (LPNMLVKEYDOWN)lParam;
+                                       if (pnkd->wVKey == VK_SPACE) {
                                                // \83X\83y\81[\83X\83L\81[\82Å\83_\83u\83\8b\83N\83\8a\83b\83N\82Æ\93¯\82\8cø\89Ê\82ð\8e\9d\82½\82¹\82é
-                                               me->AddEvent(WM_COMMAND,pnkd->hdr.idFrom,0);
+                                               me->AddEvent(WM_COMMAND, pnkd->hdr.idFrom, 0);
                                        }
-                                       else if(pnkd->wVKey == VK_DELETE){
+                                       else if (pnkd->wVKey == VK_DELETE) {
                                                // \83f\83\8a\81[\83g
-                                               me->AddEvent(WM_NOTIFY,pnkd->hdr.idFrom,VK_DELETE);
+                                               me->AddEvent(WM_NOTIFY, pnkd->hdr.idFrom, VK_DELETE);
                                        }
-                                       else if(pnkd->wVKey == VK_F2){
+                                       else if (pnkd->wVKey == VK_F2) {
                                                // \83\89\83x\83\8b\95Ò\8fW\8aJ\8en
-                                               int idx = ListView_GetNextItem(pnkd->hdr.hwndFrom,-1,LVNI_FOCUSED);
-                                               ListView_EditLabel(pnkd->hdr.hwndFrom,idx);
+                                               int idx = ListView_GetNextItem(pnkd->hdr.hwndFrom, -1, LVNI_FOCUSED);
+                                               ListView_EditLabel(pnkd->hdr.hwndFrom, idx);
                                        }
                                        return 0;
                                }
-                       case TVN_KEYDOWN:
+                               case TVN_KEYDOWN:
                                {
-                                       LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN) lParam;
-                                       if(ptvkd->wVKey == VK_DELETE){
+                                       LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN)lParam;
+                                       if (ptvkd->wVKey == VK_DELETE) {
                                                // \83f\83\8a\81[\83g
-                                               me->AddEvent(WM_NOTIFY,ptvkd->hdr.idFrom,VK_DELETE);
+                                               me->AddEvent(WM_NOTIFY, ptvkd->hdr.idFrom, VK_DELETE);
                                        }
                                        return 0;
                                }
-                       case NM_RCLICK:
+                               case NM_RCLICK:
                                {
                                        // ListView - TreeView \82Å\89E\83N\83\8a\83b\83N\82³\82ê\82½\82±\82Æ\82ð\92Ê\92m\82·\82é
-                                       LPNMHDR lpnmh = (LPNMHDR) lParam;
-                                       LONG_PTR addr = ::GetWindowLong(lpnmh->hwndFrom, GWLP_USERDATA);
+                                       LPNMHDR lpnmh = (LPNMHDR)lParam;
+                                       LONG_PTR addr = ::GetWindowLongPtr(lpnmh->hwndFrom, GWLP_USERDATA);
                                        if (addr) {
                                                CComObject<CControl>* pCtrl = (CComObject<CControl>*)addr;
                                                pCtrl->OnRClick(); // \83R\83\93\83g\83\8d\81[\83\8b\82É\89E\83N\83\8a\83b\83N\82ð\92Ê\92m\82µ\91O\8f\88\97\9d\82ð\8ds\82í\82¹\82é
                                        }
-                                       me->AddEvent(WM_NOTIFY,lpnmh->idFrom,VK_RBUTTON);
+                                       me->AddEvent(WM_NOTIFY, lpnmh->idFrom, VK_RBUTTON);
                                        return 0;
                                }
-                       default:
+                               default:
                                break;
                        }
                        break;
                }
-       case WM_CTLCOLORSTATIC:
+               case WM_CTLCOLORSTATIC:
                {
                        HDC hdc = (HDC)wParam;
-                       ::SetBkColor(hdc,me->m_dwBackColor);
-                       ::SetTextColor(hdc,::GetSysColor(COLOR_WINDOWTEXT));
+                       ::SetBkColor(hdc, me->m_dwBackColor);
+                       ::SetTextColor(hdc, ::GetSysColor(COLOR_WINDOWTEXT));
                        return (LPARAM)me->m_hBkBrush;
                }
-       case WM_CTLCOLOREDIT:
-       case WM_CTLCOLORLISTBOX:
-       case WM_CTLCOLORMSGBOX:
+               case WM_CTLCOLOREDIT:
+               case WM_CTLCOLORLISTBOX:
+               case WM_CTLCOLORMSGBOX:
                {
-                       if(me->m_pForm){
+                       if (me->m_pForm) {
                                // \83t\83H\81[\83\80\82Å\8ew\92è\82³\82ê\82½\83R\83\93\83g\83\8d\81[\83\8b\94w\8ci\83u\83\89\83V\82ð\8eæ\93¾\82·\82é
                                HDC hdc = (HDC)wParam;
-                               ::SetBkColor(hdc,me->m_pForm->GetControlColor());
-                               ::SetTextColor(hdc,::GetSysColor(COLOR_WINDOWTEXT));
+                               ::SetBkColor(hdc, me->m_pForm->GetControlColor());
+                               ::SetTextColor(hdc, ::GetSysColor(COLOR_WINDOWTEXT));
                                return (LPARAM)me->m_pForm->GetControlColorBrush();
                        }
                        break;
                }
-       case WM_SETCURSOR:
+               case WM_SETCURSOR:
                {
-                       if(me->m_dWaitCursor > 0){
-                               ::SetCursor(::LoadCursor(NULL,IDC_WAIT));
+                       if (me->m_dWaitCursor > 0) {
+                               ::SetCursor(::LoadCursor(NULL, IDC_WAIT));
                                return true;
                        }
                        break;
                }
        }
-       return ::DefWindowProc( hWnd, uMsg, wParam, lParam );
+       return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
 }
 
 STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
@@ -619,35 +619,35 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
        // \83C\83x\83\93\83L\83\85\81[\82Ì\8eæ\93¾
        EnterCriticalSection(&m_objEventDataProtection);
        CComObject<CEvent>* pEv = NULL;
-       if(!m_lstEvent.empty()){
+       if (!m_lstEvent.empty()) {
                // \83C\83x\83\93\83g\83\8a\83X\83g\82É\83f\81[\83^\81[\82ª\93ü\82Á\82Ä\82¢\82é
                pEv = m_lstEvent.front();
                m_lstEvent.pop_front();
        }
-       if(m_lstEvent.empty()){
+       if (m_lstEvent.empty()) {
                // \82±\82ê\88È\8fã\83\81\83b\83Z\81[\83W\82ª\82È\82¢\82Ì\82È\82ç\82Î\81A\83C\83x\83\93\83g\83t\83\89\83O\82ð\83\8a\83Z\83b\83g\82·\82é
                ResetEvent(m_hWaitEvent);
        }
-       else{
+       else {
                // \82Ü\82¾\83\81\83b\83Z\81[\83W\82ª\82 \82é\82Ì\82Å\83C\83x\83\93\83g\82ð\82½\82Ä\82é
                SetEvent(m_hWaitEvent);
        }
        LeaveCriticalSection(&m_objEventDataProtection);
 
        // \8eæ\82è\8fo\82µ\82½\83C\83x\83\93\83g\82Ì\8f\88\97\9d
-       if(pEv){
+       if (pEv) {
                // \95Ô\93\9a\83C\83x\83\93\83g\83R\81[\83h
                ret = pEv->GetMessage();
                //
-               if(pEv->GetMessage() == WM_TIMER){
+               if (pEv->GetMessage() == WM_TIMER) {
                        // \83^\83C\83}\81[\83C\83x\83\93\83g\82ÍUI\82É\8aÖ\8cW\82È\82­\8a\84\82è\8d\9e\82Ü\82ê\82é\82½\82ß
                        // \83C\83x\83\93\83g\83v\83\8d\83p\83e\83B\81[\82É\82Í\83Z\83b\83g\82¹\82¸\81A\83\89\83C\83Y\82·\82é\82¾\82¯\81B
                        Fire_OnTimer();
                        ClassObjectInvoke(L"OnTimer");
                }
-               else{
+               else {
                        // \82»\82Ì\82Ù\82©\82Ì\83C\83x\83\93\83g\82Í \8c»\8dÝ\82Ì\83C\83x\83\93\83g\83I\83u\83W\83F\83N\83g\82ð\83v\83\8d\83p\83e\83B\81[\82É\83Z\83b\83g\82·\82é
-                       if(m_pEvent){
+                       if (m_pEvent) {
                                // \8cÃ\82¢\83I\83u\83W\83F\83N\83g\82Ì\94j\8aü
                                m_pEvent->Release();
                                m_pEvent = NULL;
@@ -656,101 +656,99 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
                        m_pEvent->AddRef();
                        // \82±\82Ì\83I\83u\83W\83F\83N\83g\82ð\88ø\90\94\82Æ\82µ\82Ä\93n\82·\82½\82ß\82É\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\90\90¬\82·\82é
                        IUnknown* pUnk = NULL;
-                       QueryInterface(IID_IUnknown,(void**)&pUnk);
+                       QueryInterface(IID_IUnknown, (void**)&pUnk);
                        // \83C\83x\83\93\83g\82É\91Î\82·\82é\83\89\83C\83Y
-                       switch(pEv->GetMessage())
-                       {
-                       case WM_KEYDOWN:
+                       switch (pEv->GetMessage()) {
+                               case WM_KEYDOWN:
                                {
                                        Fire_OnKeydown();
                                        Fire_OnKeydownEx(pUnk);
                                        ClassObjectInvoke(L"OnKeydown");
                                        break;
                                }
-                       case WM_KEYDOWN_EX:
+                               case WM_KEYDOWN_EX:
                                {
                                        Fire_OnKeydown2();
                                        Fire_OnKeydown2Ex(pUnk);
                                        ClassObjectInvoke(L"OnKeydown2");
                                        break;
                                }
-                       case WM_MOUSEMOVE:
+                               case WM_MOUSEMOVE:
                                {
                                        Fire_OnMouseMove();
                                        Fire_OnMouseMoveEx(pUnk);
                                        ClassObjectInvoke(L"OnMouseMove");
                                        break;
                                }
-                       case WM_LBUTTONDBLCLK:
+                               case WM_LBUTTONDBLCLK:
                                {
                                        Fire_OnDblClick();
                                        Fire_OnDblClickEx(pUnk);
                                        ClassObjectInvoke(L"OnDblClick");
                                        break;
                                }
-                       case WM_LBUTTONDOWN:
+                               case WM_LBUTTONDOWN:
                                {
                                        Fire_OnClick();
                                        Fire_OnClickEx(pUnk);
                                        ClassObjectInvoke(L"OnClick");
                                        break;
                                }
-                       case WM_RBUTTONDBLCLK:
+                               case WM_RBUTTONDBLCLK:
                                {
                                        Fire_OnRDblClick();
                                        Fire_OnRDblClickEx(pUnk);
                                        ClassObjectInvoke(L"OnRDblClick");
                                        break;
                                }
-                       case WM_RBUTTONDOWN:
+                               case WM_RBUTTONDOWN:
                                {
                                        Fire_OnRClick();
                                        Fire_OnRClickEx(pUnk);
                                        ClassObjectInvoke(L"OnRClick");
                                        break;
                                }
-                       case WM_LBUTTONUP:
+                               case WM_LBUTTONUP:
                                {
                                        Fire_OnClickOut();
                                        Fire_OnClickOutEx(pUnk);
                                        ClassObjectInvoke(L"OnClickOut");
                                        break;
                                }
-                       case WM_RBUTTONUP:
+                               case WM_RBUTTONUP:
                                {
                                        Fire_OnRClickOut();
                                        Fire_OnRClickOutEx(pUnk);
                                        ClassObjectInvoke(L"OnRClickOut");
                                        break;
                                }
-                       case WM_CAPTURECHANGED:
+                               case WM_CAPTURECHANGED:
                                {
-                                       if(pEv->GetParam() == 1){
+                                       if (pEv->GetParam() == 1) {
                                                Fire_OnClickCancel();
                                                Fire_OnClickCancelEx(pUnk);
                                                ClassObjectInvoke(L"OnClickCancel");
                                        }
-                                       else{
+                                       else {
                                                Fire_OnRClickCancel();
                                                Fire_OnRClickCancelEx(pUnk);
                                                ClassObjectInvoke(L"OnRClickCancel");
                                        }
                                        break;
                                }
-                       case WM_SIZE:
+                               case WM_SIZE:
                                {
                                        Fire_OnSize();
                                        Fire_OnSizeEx(pUnk);
                                        ClassObjectInvoke(L"OnSize");
                                        break;
                                }
-                       case WM_COMMAND:
+                               case WM_COMMAND:
                                {
                                        int nID = pEv->GetParam();
-                                       switch(nID)
-                                       {
-                                       case IDOK:
-                                               if(m_bDefaultAction){
+                                       switch (nID) {
+                                               case IDOK:
+                                               if (m_bDefaultAction) {
                                                        m_bQuit = true;
                                                }
                                                m_dModalExitCode = IDOK;
@@ -758,8 +756,8 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
                                                Fire_OnOKEx(pUnk);
                                                ClassObjectInvoke(L"OnOK");
                                                break;
-                                       case IDCANCEL:
-                                               if(m_bDefaultAction){
+                                               case IDCANCEL:
+                                               if (m_bDefaultAction) {
                                                        m_bQuit = true;
                                                }
                                                m_dModalExitCode = IDCANCEL;
@@ -767,23 +765,23 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
                                                Fire_OnCancelEx(pUnk);
                                                ClassObjectInvoke(L"OnCancel");
                                                break;
-                                       case IDABORT:
+                                               case IDABORT:
                                                m_bQuit = true;
                                                m_dModalExitCode = IDABORT;
                                                Fire_OnExit();
                                                Fire_OnExitEx(pUnk);
                                                ClassObjectInvoke(L"OnExit");
                                                break;
-                                       default:
+                                               default:
                                                Fire_OnCommand();
                                                Fire_OnCommandEx(pUnk);
                                                ClassObjectInvoke(L"OnCommand");
                                        }
                                        // \8aÖ\98A\82Ã\82¯\82ç\82ê\82½\83R\83\93\83g\83\8d\81[\83\8b\82ª\82 \82é\82Ì\82©\81H
-                                       if(m_pForm){
+                                       if (m_pForm) {
                                                BSTR eventname = NULL;
-                                               if(m_pForm->FindControlEventName(nID,&eventname)){
-                                                       if(SysStringLen(eventname) > 0){
+                                               if (m_pForm->FindControlEventName(nID, &eventname)) {
+                                                       if (SysStringLen(eventname) > 0) {
                                                                ClassObjectInvoke(eventname);
                                                        }
                                                        SysFreeString(eventname);
@@ -799,23 +797,22 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
                                        }
                                        break;
                                }
-                       case WM_DROPFILES:
+                               case WM_DROPFILES:
                                {
                                        Fire_OnDropFiles();
                                        Fire_OnDropFilesEx(pUnk);
                                        ClassObjectInvoke(L"OnDropFiles");
                                        break;
                                }
-                       case WM_NOTIFY:
+                               case WM_NOTIFY:
                                {
-                                       switch(pEv->GetLParam())
-                                       {
-                                       case VK_DELETE:
+                                       switch (pEv->GetLParam()) {
+                                               case VK_DELETE:
                                                Fire_OnContextDelete();
                                                Fire_OnContextDeleteEx(pUnk);
                                                ClassObjectInvoke(L"OnContextDelete");
                                                break;
-                                       case VK_RBUTTON:
+                                               case VK_RBUTTON:
                                                Fire_OnContextMenu();
                                                Fire_OnContextMenuEx(pUnk);
                                                ClassObjectInvoke(L"OnContextMenu");
@@ -825,16 +822,16 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
                                }
                        }
                        // \82±\82Ì\88ø\90\94\82Æ\82µ\82Ä\93n\82µ\82½\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\89ð\95ú\82·\82é
-                       if(pUnk){
+                       if (pUnk) {
                                pUnk->Release();
                        }
                }
                // \8f\88\97\9d\82³\82ê\82½\83C\83x\83\93\83g\82Í\89ð\95ú\82·\82é
                pEv->Release();
        }
-       else{
+       else {
                // \83C\83x\83\93\83g\82ª\82È\82¢\8fê\8d\87\82Í\83C\83x\83\93\83g\82Ì\83N\83\8a\83A
-               if(m_pEvent){
+               if (m_pEvent) {
                        // \8cÃ\82¢\83I\83u\83W\83F\83N\83g\82Ì\94j\8aü
                        m_pEvent->Release();
                        m_pEvent = NULL;
@@ -851,51 +848,51 @@ void COverlappedWindow::AddEventSingle(int message, WPARAM wParam, LPARAM lParam
        BOOL bFind = false;
        EnterCriticalSection(&m_objEventDataProtection);
        list<CComObject<CEvent>*>::iterator p = m_lstEvent.begin();
-       while(p != m_lstEvent.end()){
-               if((*p)->GetMessage() == message && (*p)->GetParam() == wParam){
+       while (p != m_lstEvent.end()) {
+               if ((*p)->GetMessage() == message && (*p)->GetParam() == wParam) {
                        bFind = true;
                        break;
                }
                p++;
        }
        LeaveCriticalSection(&m_objEventDataProtection);
-       if(!bFind){
+       if (!bFind) {
                // \93¯\88ê\83C\83x\83\93\83g\82ª\82È\82¯\82ê\82Î\83C\83x\83\93\83g\82Ì\94­\8ds\82ð\8ds\82¤
-               AddEvent(message,wParam,lParam);
+               AddEvent(message, wParam, lParam);
        }
 }
 
-void COverlappedWindow::AddEvent(int message,WPARAM wParam,LPARAM lParam)
+void COverlappedWindow::AddEvent(int message, WPARAM wParam, LPARAM lParam)
 {
        // \83C\83x\83\93\83g\94­\90\8e\9e\82Ì\83}\83E\83X\88Ê\92u\82ð\83N\83\89\83C\83G\83\93\83g\8dÀ\95W\82É\95Ï\8a·\82·\82é
-       POINT pt,lp;
+       POINT pt, lp;
        DWORD pos = GetMessagePos();
        pt.x = LOWORD(pos);
        pt.y = HIWORD(pos);
        lp.x = lp.y = 0;
-       if(m_hPopupWnd){
-               ::ScreenToClient(m_hPopupWnd,&pt);
+       if (m_hPopupWnd) {
+               ::ScreenToClient(m_hPopupWnd, &pt);
                // \8dÀ\95W\8cn\82Ì\95Ï\8a·
                lp = pt;
                HDC hdc = ::GetDC(m_hPopupWnd);
                POINT org;
                RECT rct;
-               ::GetClientRect(m_hPopupWnd,&rct);
-               ::SetViewportOrgEx(hdc,0,rct.bottom,&org);
+               ::GetClientRect(m_hPopupWnd, &rct);
+               ::SetViewportOrgEx(hdc, 0, rct.bottom, &org);
                int md = ::GetMapMode(hdc);
-               ::SetMapMode(hdc,MM_LOMETRIC);
-               ::DPtoLP(hdc,&lp,1);
-               ::SetMapMode(hdc,md);
-               ::SetViewportOrgEx(hdc,org.x,org.y,NULL);
-               ::ReleaseDC(m_hPopupWnd,hdc);
+               ::SetMapMode(hdc, MM_LOMETRIC);
+               ::DPtoLP(hdc, &lp, 1);
+               ::SetMapMode(hdc, md);
+               ::SetViewportOrgEx(hdc, org.x, org.y, NULL);
+               ::ReleaseDC(m_hPopupWnd, hdc);
        }
 
        // \83C\83x\83\93\83g\82Ì\90Ï\82Ý\8fã\82°
        EnterCriticalSection(&m_objEventDataProtection);
        CComObject<CEvent>* pEvent;
-       if(pEvent->CreateInstance(&pEvent) == S_OK){
+       if (pEvent->CreateInstance(&pEvent) == S_OK) {
                pEvent->AddRef();
-               pEvent->SetData(message,wParam,lParam,pt,lp);
+               pEvent->SetData(message, wParam, lParam, pt, lp);
                m_lstEvent.push_back(pEvent);
        }
        LeaveCriticalSection(&m_objEventDataProtection);
@@ -903,7 +900,7 @@ void COverlappedWindow::AddEvent(int message,WPARAM wParam,LPARAM lParam)
        // \83C\83x\83\93\83g\83n\83\93\83h\83\8b\82ð\83V\83O\83i\83\8b\82É\82·\82é
        SetEvent(m_hWaitEvent);
 
-       if(windowParam.automessageloop){
+       if (windowParam.automessageloop) {
                // \82½\82¾\82¿\82É\83C\83x\83\93\83g\8f\88\97\9d\82ð\8ds\82¤
                CComVariant tmp;
                DoEvent(&tmp);
@@ -914,8 +911,8 @@ void COverlappedWindow::AddEvent(int message,WPARAM wParam,LPARAM lParam)
 STDMETHODIMP COverlappedWindow::Draw()
 {
        // \95`\89æ\82·\82é
-       if(m_hPopupWnd){
-               ::InvalidateRect(m_hPopupWnd,NULL,true);
+       if (m_hPopupWnd) {
+               ::InvalidateRect(m_hPopupWnd, NULL, true);
                ::UpdateWindow(m_hPopupWnd);
        }
        return S_OK;
@@ -925,20 +922,20 @@ STDMETHODIMP COverlappedWindow::Draw()
 STDMETHODIMP COverlappedWindow::get_IsEventEmpty(BOOL *pVal)
 {
        // \83C\83x\83\93\83g\82ª\8bó\82È\82çtrue
-       *pVal = m_lstEvent.empty()?VB_TRUE:VB_FALSE;
+       *pVal = m_lstEvent.empty() ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
-STDMETHODIMP COverlappedWindow::Open(VARIANT caption,VARIANT* pvarUnk)
+STDMETHODIMP COverlappedWindow::Open(VARIANT caption, VARIANT* pvarUnk)
 {
        SafeCreateWnd();
        CComVariant tmp;
-       if((caption.vt != VT_ERROR && caption.vt != VT_NULL) && tmp.ChangeType(VT_BSTR,&caption) == S_OK){
+       if ((caption.vt != VT_ERROR && caption.vt != VT_NULL) && tmp.ChangeType(VT_BSTR, &caption) == S_OK) {
                put_Caption(tmp.bstrVal);
        }
        put_Enable(true);
        put_Visible(true);
-       m_bQuit          = false;
+       m_bQuit = false;
        m_dModalExitCode = 0;     // \83\82\81[\83_\83\8b\95Ô\93\9a\83R\81[\83h
        CreateThisInterface(pvarUnk);
        return S_OK;
@@ -948,7 +945,7 @@ STDMETHODIMP COverlappedWindow::Close()
 {
        // \83`\83\83\83C\83\8b\83h\82ð\8e\9d\82Á\82Ä\82¢\82é\8fê\8d\87\82Í\81A\83`\83\83\83C\83\8b\83h\82à\83N\83\8d\81[\83Y\82·\82é
        list<CComObject<COverlappedWindow>*>::iterator pWnd = m_lstChild.begin();
-       while(pWnd != m_lstChild.end()){
+       while (pWnd != m_lstChild.end()) {
                (*pWnd)->Close();
                pWnd++;
        }
@@ -957,17 +954,17 @@ STDMETHODIMP COverlappedWindow::Close()
        m_bQuit = true;
 
        // \83N\83\89\83X\83I\83u\83W\83F\83N\83g\82Ì\95ú\8aü
-       if(     m_pClassDisp && m_bAutoReleaseClassObject){
+       if (m_pClassDisp && m_bAutoReleaseClassObject) {
                m_pClassDisp->Release();
                m_pClassDisp = NULL;
        }
 
        // \83t\83H\81[\83J\83X\82ð\88Ú\93®\82·\82é
-       if(m_hParentWnd){
+       if (m_hParentWnd) {
                ::SetActiveWindow(m_hParentWnd);
                ::SetFocus(m_hParentWnd);
        }
-       else{
+       else {
                MoveNextOverlapped();
        }
        return S_OK;
@@ -975,7 +972,7 @@ STDMETHODIMP COverlappedWindow::Close()
 
 STDMETHODIMP COverlappedWindow::get_DoubleBuffer(BOOL *pVal)
 {
-       *pVal = windowParam.doublebuffer?VB_TRUE:VB_FALSE;
+       *pVal = windowParam.doublebuffer ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -989,24 +986,24 @@ STDMETHODIMP COverlappedWindow::put_DoubleBuffer(BOOL newVal)
 STDMETHODIMP COverlappedWindow::get_TopMost(BOOL *pVal)
 {
        SafeCreateWnd();
-       DWORD exstyle = ::GetWindowLong(m_hPopupWnd,GWL_EXSTYLE);
-       *pVal = (exstyle & WS_EX_TOPMOST)?VB_TRUE:VB_FALSE;
+       DWORD exstyle = ::GetWindowLong(m_hPopupWnd, GWL_EXSTYLE);
+       *pVal = (exstyle & WS_EX_TOPMOST) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_TopMost(BOOL newVal)
 {
        SafeCreateWnd();
-       ::SetWindowPos(m_hPopupWnd,newVal?HWND_TOPMOST:HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
+       ::SetWindowPos(m_hPopupWnd, newVal ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_PosX(short *pVal)
 {
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
                windowParam.posX = (int)pls.rcNormalPosition.left;
        }
        *pVal = windowParam.posX;
@@ -1016,24 +1013,24 @@ STDMETHODIMP COverlappedWindow::get_PosX(short *pVal)
 STDMETHODIMP COverlappedWindow::put_PosX(short newVal)
 {
        windowParam.posX = newVal;
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
-               ::SetWindowPos(m_hPopupWnd,NULL,
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
+               ::SetWindowPos(m_hPopupWnd, NULL,
                        windowParam.posX,
                        pls.rcNormalPosition.top,
-                       0,0,SWP_NOZORDER|SWP_NOSIZE);
+                       0, 0, SWP_NOZORDER | SWP_NOSIZE);
        }
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_PosY(short *pVal)
 {
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
                windowParam.posY = (int)pls.rcNormalPosition.top;
        }
        *pVal = windowParam.posY;
@@ -1043,24 +1040,24 @@ STDMETHODIMP COverlappedWindow::get_PosY(short *pVal)
 STDMETHODIMP COverlappedWindow::put_PosY(short newVal)
 {
        windowParam.posY = newVal;
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
-               ::SetWindowPos(m_hPopupWnd,NULL,
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
+               ::SetWindowPos(m_hPopupWnd, NULL,
                        pls.rcNormalPosition.left,
                        windowParam.posY,
-                       0,0,SWP_NOZORDER|SWP_NOSIZE);
+                       0, 0, SWP_NOZORDER | SWP_NOSIZE);
        }
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_Width(short *pVal)
 {
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
                windowParam.width = (int)(pls.rcNormalPosition.right - pls.rcNormalPosition.left);
        }
        *pVal = windowParam.width;
@@ -1070,28 +1067,29 @@ STDMETHODIMP COverlappedWindow::get_Width(short *pVal)
 STDMETHODIMP COverlappedWindow::put_Width(short newVal)
 {
        windowParam.width = newVal;
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
-               ::SetWindowPos(m_hPopupWnd,NULL,
-                       0,0,
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
+               ::SetWindowPos(m_hPopupWnd, NULL,
+                       0, 0,
                        windowParam.width,
-                       pls.rcNormalPosition.bottom - pls.rcNormalPosition.top,SWP_NOZORDER|SWP_NOMOVE);
+                       pls.rcNormalPosition.bottom - pls.rcNormalPosition.top, SWP_NOZORDER | SWP_NOMOVE);
        }
-       if(m_pForm){
+       if (m_pForm) {
                // \83t\83H\81[\83\80\82Ì\83T\83C\83Y\82ð\95Ï\8dX\82·\82é
-               m_pForm->SetWindowSize(windowParam.width,windowParam.height,windowParam.GetStyle() & WS_THICKFRAME);
+               m_pForm->SetWindowSize(windowParam.width, windowParam.height,
+                       windowParam.GetStyle(), windowParam.exstyle);
        }
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_Height(short *pVal)
 {
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
                windowParam.height = (short)(pls.rcNormalPosition.right - pls.rcNormalPosition.left);
        }
        *pVal = windowParam.height;
@@ -1101,18 +1099,19 @@ STDMETHODIMP COverlappedWindow::get_Height(short *pVal)
 STDMETHODIMP COverlappedWindow::put_Height(short newVal)
 {
        windowParam.height = newVal;
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                WINDOWPLACEMENT pls = {0};
                pls.length = sizeof(WINDOWPLACEMENT);
-               ::GetWindowPlacement(m_hPopupWnd,&pls);
-               ::SetWindowPos(m_hPopupWnd,NULL,0,0,
+               ::GetWindowPlacement(m_hPopupWnd, &pls);
+               ::SetWindowPos(m_hPopupWnd, NULL, 0, 0,
                        pls.rcNormalPosition.right - pls.rcNormalPosition.left,
                        windowParam.height,
-                       SWP_NOZORDER|SWP_NOMOVE);
+                       SWP_NOZORDER | SWP_NOMOVE);
        }
-       if(m_pForm){
+       if (m_pForm) {
                // \83t\83H\81[\83\80\82Ì\83T\83C\83Y\82ð\95Ï\8dX\82·\82é
-               m_pForm->SetWindowSize(windowParam.width,windowParam.height,windowParam.GetStyle() & WS_THICKFRAME);
+               m_pForm->SetWindowSize(windowParam.width, windowParam.height,
+                       windowParam.GetStyle(), windowParam.exstyle);
        }
        return S_OK;
 }
@@ -1120,18 +1119,18 @@ STDMETHODIMP COverlappedWindow::put_Height(short newVal)
 STDMETHODIMP COverlappedWindow::get_AcceptFiles(BOOL *pVal)
 {
        SafeCreateWnd();
-       DWORD exstyle = ::GetWindowLong(m_hPopupWnd,GWL_EXSTYLE);
-       *pVal = (exstyle & WS_EX_ACCEPTFILES)?VB_TRUE:VB_FALSE;
+       DWORD exstyle = ::GetWindowLong(m_hPopupWnd, GWL_EXSTYLE);
+       *pVal = (exstyle & WS_EX_ACCEPTFILES) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_AcceptFiles(BOOL newVal)
 {
        SafeCreateWnd();
-       DWORD exstyle = ::GetWindowLong(m_hPopupWnd,GWL_EXSTYLE);
+       DWORD exstyle = ::GetWindowLong(m_hPopupWnd, GWL_EXSTYLE);
        exstyle &= ~WS_EX_ACCEPTFILES;
-       exstyle |= newVal?WS_EX_ACCEPTFILES:0;
-       ::SetWindowLong(m_hPopupWnd,GWL_EXSTYLE,exstyle);
+       exstyle |= newVal ? WS_EX_ACCEPTFILES : 0;
+       ::SetWindowLong(m_hPopupWnd, GWL_EXSTYLE, exstyle);
        return S_OK;
 }
 
@@ -1152,15 +1151,15 @@ STDMETHODIMP COverlappedWindow::SetFocus()
 STDMETHODIMP COverlappedWindow::get_Enable(BOOL *pVal)
 {
        SafeCreateWnd();
-       *pVal = ::IsWindowEnabled(m_hPopupWnd)?VB_TRUE:VB_FALSE;
+       *pVal = ::IsWindowEnabled(m_hPopupWnd) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_Enable(BOOL newVal)
 {
        SafeCreateWnd();
-       ::EnableWindow(m_hPopupWnd,newVal);
-       if(m_pForm){
+       ::EnableWindow(m_hPopupWnd, newVal);
+       if (m_pForm) {
                m_pForm->EnableAllControl(newVal);
                ::SetActiveWindow(m_hPopupWnd);
        }
@@ -1171,14 +1170,14 @@ STDMETHODIMP COverlappedWindow::put_Enable(BOOL newVal)
 STDMETHODIMP COverlappedWindow::get_Iconic(BOOL *pVal)
 {
        SafeCreateWnd();
-       *pVal = ::IsIconic(m_hPopupWnd)?VB_TRUE:VB_FALSE;
+       *pVal = ::IsIconic(m_hPopupWnd) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_Iconic(BOOL newVal)
 {
        SafeCreateWnd();
-       ::ShowWindow(m_hPopupWnd,newVal?SW_MINIMIZE:SW_SHOWNORMAL);
+       ::ShowWindow(m_hPopupWnd, newVal ? SW_MINIMIZE : SW_SHOWNORMAL);
        return S_OK;
 }
 
@@ -1186,41 +1185,41 @@ STDMETHODIMP COverlappedWindow::put_Iconic(BOOL newVal)
 STDMETHODIMP COverlappedWindow::get_Zoomed(BOOL *pVal)
 {
        SafeCreateWnd();
-       *pVal = ::IsZoomed(m_hPopupWnd)?VB_TRUE:VB_FALSE;
+       *pVal = ::IsZoomed(m_hPopupWnd) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_Zoomed(BOOL newVal)
 {
        SafeCreateWnd();
-       ::ShowWindow(m_hPopupWnd,newVal?SW_SHOWMAXIMIZED:SW_SHOWNORMAL);
+       ::ShowWindow(m_hPopupWnd, newVal ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL);
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_Visible(BOOL *pVal)
 {
        *pVal = VB_FALSE;
-       if(::IsWindow(m_hPopupWnd)){
+       if (::IsWindow(m_hPopupWnd)) {
                // \83E\83B\83\93\83h\83E\82ª\8dì\90¬\8dÏ\82Ý\82Å\82 \82ê\82Î\92²\8d¸\82·\82é
-               DWORD style = ::GetWindowLong(m_hPopupWnd,GWL_STYLE);
-               *pVal = (style & WS_VISIBLE)?VB_TRUE:VB_FALSE;
+               DWORD style = ::GetWindowLong(m_hPopupWnd, GWL_STYLE);
+               *pVal = (style & WS_VISIBLE) ? VB_TRUE : VB_FALSE;
        }
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_Visible(BOOL newVal)
 {
-       if(!newVal && !::IsWindow(m_hPopupWnd)){
+       if (!newVal && !::IsWindow(m_hPopupWnd)) {
                // FALSE\82È\82ç\81A\82 \82¦\82Ä\8dì\90¬\82Í\8e\8e\82Ý\82È\82¢
                return S_OK;
        }
        SafeCreateWnd();
-       ::ShowWindow(m_hPopupWnd,newVal?SW_SHOWNORMAL:SW_HIDE);
+       ::ShowWindow(m_hPopupWnd, newVal ? SW_SHOWNORMAL : SW_HIDE);
        ::SetActiveWindow(m_hPopupWnd);
        return S_OK;
 }
 
-STDMETHODIMP COverlappedWindow::WaitEvent(VARIANT varTim,BOOL* pRet)
+STDMETHODIMP COverlappedWindow::WaitEvent(VARIANT varTim, BOOL* pRet)
 {
        SafeCreateWnd();
        *pRet = false;
@@ -1228,18 +1227,18 @@ STDMETHODIMP COverlappedWindow::WaitEvent(VARIANT varTim,BOOL* pRet)
        // \91Ò\8b@\8e\9e\8aÔ\82Ì\8eæ\93¾
        DWORD sleeptim = 1000;
        CComVariant tim;
-       if(tim.ChangeType(VT_I4,&varTim) == S_OK){
+       if (tim.ChangeType(VT_I4, &varTim) == S_OK) {
                sleeptim = (DWORD)tim.lVal;
        }
-       if(sleeptim == 0){
+       if (sleeptim == 0) {
                sleeptim = INFINITE;
        }
 
-       HANDLE hEvent[MAXIMUM_WAIT_OBJECTS] = { NULL };
-       HWND   hWnd  [MAXIMUM_WAIT_OBJECTS] = { NULL };
+       HANDLE hEvent[MAXIMUM_WAIT_OBJECTS] = {NULL};
+       HWND   hWnd[MAXIMUM_WAIT_OBJECTS] = {NULL};
        int cnt = 0;
-       SetWaitParam(&cnt,hWnd,hEvent);
-       *pRet = MessageLoop(sleeptim,cnt,hWnd,hEvent)?VB_TRUE:VB_FALSE;
+       SetWaitParam(&cnt, hWnd, hEvent);
+       *pRet = MessageLoop(sleeptim, cnt, hWnd, hEvent) ? VB_TRUE : VB_FALSE;
 
        return S_OK;
 }
@@ -1249,13 +1248,13 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
        SafeCreateWnd();
        HRESULT hRet = S_OK;
        CComVariant tmp;
-       if(tmp.ChangeType(VT_BSTR,&fmt) == S_OK){
+       if (tmp.ChangeType(VT_BSTR, &fmt) == S_OK) {
                ATL::CString buf(tmp.bstrVal);
 
                // \8cÃ\82¢\83\81\83j\83\85\81[\82ð\94j\8aü\82·\82é
                if (m_hMenu) {
                        m_cMenuMap.clear();
-                       ::SetMenu(m_hPopupWnd,NULL);
+                       ::SetMenu(m_hPopupWnd, NULL);
                        DestroyMenu(m_hMenu);
                        m_hMenu = NULL;
                }
@@ -1265,11 +1264,12 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
                        m_hMenu = CreateMenu();
                        TCHAR menuname[MAX_PATH];
                        TCHAR szSubmenu[MAX_PATH];
-                       LPTSTR p = buf.GetBuffer();
                        HMENU hPopupMenu = NULL;
                        int lv1 = 0;
                        int lv2 = 0;
                        int cmd = 0;
+
+                       LPTSTR p = buf.GetBuffer();
                        while (*p) {
                                while (*p == ' ' || *p == '\t') p++; // \83u\83\89\83\93\83N\83X\83L\83b\83v
                                if (*p == '/') {
@@ -1279,43 +1279,50 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
                                                // \8aù\91\82Ì\83|\83b\83v\83A\83b\83v\82ð\96\84\82ß\8d\9e\82Þ
                                                MENUITEMINFO inf = {0};
                                                inf.cbSize = sizeof(MENUITEMINFO);
-                                               inf.fMask  = MIIM_SUBMENU | MIIM_TYPE;
-                                               inf.fType  = MFT_STRING;
+                                               inf.fMask = MIIM_SUBMENU | MIIM_TYPE;
+                                               inf.fType = MFT_STRING;
                                                inf.dwTypeData = szSubmenu;
                                                inf.hSubMenu = hPopupMenu;
-                                               InsertMenuItem(m_hMenu,lv1,true,&inf);
+                                               InsertMenuItem(m_hMenu, lv1, true, &inf);
                                        }
                                        lv1++;
                                        lv2 = 0;
                                        cmd = 0;
+
                                        hPopupMenu = CreatePopupMenu();
-                                       LPTSTR d = p;
+                                       LPTSTR st = p;
                                        while (*p && *p != ',' && *p != '/' && *p != ':') {
                                                p = CharNext(p);
                                        }
                                        ZeroMemory(szSubmenu, MAX_PATH);
-                                       CopyMemory(szSubmenu, d, p-d);
+                                       int submenuLen = p - st;
+                                       if (submenuLen > 0) {
+                                               _tcsncpy_s(szSubmenu, MAX_PATH, st, submenuLen);
+                                       }
                                        if (*p == ',' || *p == ':') {
                                                p++;
                                        }
                                }
-                               else{
+                               else {
                                        // \83\81\83j\83\85\81[\82Ì\8dì\90¬
                                        if (hPopupMenu) {
-                                               LPTSTR d = p;
+                                               LPTSTR st = p;
                                                while (*p && *p != ',' && *p != '/' && *p != ':') {
                                                        p = CharNext(p);
                                                }
                                                ZeroMemory(menuname, MAX_PATH);
-                                               CopyMemory(menuname, d, p-d);
+                                               int menunameLen = p - st;
+                                               if (menunameLen > 0) {
+                                                       _tcsncpy_s(menuname, MAX_PATH, st, menunameLen);
+                                               }
                                                // \83R\83}\83\93\83h\83Z\83p\83\8c\81[\83^\81[\82ð\8c\9f\8d¸\82·\82é
                                                CComBSTR eventname;
                                                LPTSTR findcmd = _tcschr(menuname, _TEXT('@'));
-                                               if(findcmd){
+                                               if (findcmd) {
                                                        *findcmd = 0;
-                                                       eventname = (LPCSTR)(findcmd + 1);
+                                                       eventname = findcmd + 1;
                                                }
-                                               else{
+                                               else {
                                                        TCHAR tmp[64];
                                                        wsprintf(tmp, _TEXT("OnMenu%d"), lv1 * 100 + cmd);
                                                        eventname = tmp;
@@ -1324,23 +1331,23 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
                                                // \83\81\83j\83\85\81[\82Ì\8dì\90¬
                                                MENUITEMINFO inf = {0};
                                                inf.cbSize = sizeof(MENUITEMINFO);
-                                               inf.fMask  = MIIM_TYPE|MIIM_ID;
-                                               inf.fType  = MFT_STRING;
-                                               inf.wID    = lv1 * 100 + cmd;
+                                               inf.fMask = MIIM_TYPE | MIIM_ID;
+                                               inf.fType = MFT_STRING;
+                                               inf.wID = lv1 * 100 + cmd;
                                                inf.dwTypeData = menuname;
-                                               InsertMenuItem(hPopupMenu,lv2,true,&inf);
+                                               InsertMenuItem(hPopupMenu, lv2, true, &inf);
                                                lv2++;
                                                cmd++;
                                                // \83Z\83p\83\8c\81[\83^\81[\82Ì\8ew\92è\82©?
-                                               if(*p == ','){
+                                               if (*p == ',') {
                                                        p++;
                                                }
-                                               else if(*p == ':'){
+                                               else if (*p == ':') {
                                                        MENUITEMINFO inf = {0};
                                                        inf.cbSize = sizeof(MENUITEMINFO);
-                                                       inf.fMask  = MIIM_TYPE;
-                                                       inf.fType  = MFT_SEPARATOR;
-                                                       InsertMenuItem(hPopupMenu,lv2,true,&inf);
+                                                       inf.fMask = MIIM_TYPE;
+                                                       inf.fType = MFT_SEPARATOR;
+                                                       InsertMenuItem(hPopupMenu, lv2, true, &inf);
                                                        p++;
                                                        lv2++;
                                                }
@@ -1348,23 +1355,23 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
                                }
                        }
                        // \96¢\91}\93ü\82Ì\83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82Ì\91}\93ü
-                       if(hPopupMenu){
+                       if (hPopupMenu) {
                                // \8aù\91\82Ì\83|\83b\83v\83A\83b\83v\82ð\96\84\82ß\8d\9e\82Þ
                                MENUITEMINFO inf = {0};
                                inf.cbSize = sizeof(MENUITEMINFO);
-                               inf.fMask  = MIIM_SUBMENU | MIIM_TYPE;
-                               inf.fType  = MFT_STRING;
+                               inf.fMask = MIIM_SUBMENU | MIIM_TYPE;
+                               inf.fType = MFT_STRING;
                                inf.dwTypeData = szSubmenu;
                                inf.hSubMenu = hPopupMenu;
-                               InsertMenuItem(m_hMenu,lv1,true,&inf);
+                               InsertMenuItem(m_hMenu, lv1, true, &inf);
                        }
-                       ::SetMenu(m_hPopupWnd,m_hMenu);
+                       ::SetMenu(m_hPopupWnd, m_hMenu);
                }
        }
        return hRet;
 }
 
-STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT* pRet)
+STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd, VARIANT* pRet)
 {
        SafeCreateWnd();
 
@@ -1373,7 +1380,7 @@ STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT
 
        int nCommand = 0;
        CComVariant varCmd;
-       if (varCmd.ChangeType(VT_I2, &cmd) == S_OK){
+       if (varCmd.ChangeType(VT_I2, &cmd) == S_OK) {
                nCommand = varCmd.iVal;
        }
 
@@ -1389,7 +1396,7 @@ STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT
                int cmd = 0;
                HMENU hPopupMenu = CreatePopupMenu();
                while (*p) {
-                       LPTSTR d = p;
+                       LPTSTR st = p;
                        while (*p == ' ' || *p == '\t') {
                                p++;
                        }
@@ -1397,18 +1404,21 @@ STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT
                                p = CharNext(p);
                        }
                        ZeroMemory(menuname, MAX_PATH);
-                       CopyMemory(menuname, d, p-d);
+                       int menunameLen = p - st;
+                       if (menunameLen > 0) {
+                               _tcsncpy_s(menuname, MAX_PATH, st, menunameLen);
+                       }
                        MENUITEMINFO inf = {0};
                        inf.cbSize = sizeof(MENUITEMINFO);
-                       inf.fMask  = MIIM_TYPE|MIIM_ID;
-                       inf.fType  = MFT_STRING;
+                       inf.fMask = MIIM_TYPE | MIIM_ID;
+                       inf.fType = MFT_STRING;
                        if (nCommand != 0) {
                                inf.wID = nCommand + cmd;
                        }
                        else {
                                // \83R\83}\83\93\83h\83x\81[\83X\82ª0\82È\82ç\82Î\83R\83}\83\93\83h\83C\83x\83\93\83g\82Í\94­\90\82³\82¹\82È\82¢\81B
                                // TrackPopupMenu\82Í\83R\83}\83\93\83h\82ð\91I\91ð\82µ\82È\82©\82Á\82½\8fê\8d\87\82Í0\82ð\95Ô\82·\82½\82ß\81A0\82æ\82è\82à\91å\82«\82È\92l\82É\82·\82é\95K\97v\82ª\82 \82é\81B
-                               inf.wID    = nCommand + cmd + 1;
+                               inf.wID = nCommand + cmd + 1;
                        }
                        inf.dwTypeData = menuname;
                        InsertMenuItem(hPopupMenu, lv, true, &inf);
@@ -1418,8 +1428,8 @@ STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT
                                p++;
                        }
                        else if (*p == ':') {
-                               inf.fMask  = MIIM_TYPE;
-                               inf.fType  = MFT_SEPARATOR;
+                               inf.fMask = MIIM_TYPE;
+                               inf.fType = MFT_SEPARATOR;
                                InsertMenuItem(hPopupMenu, lv, true, &inf);
                                p++;
                                lv++;
@@ -1430,8 +1440,8 @@ STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT
                DWORD pos = GetMessagePos();
                ::SetFocus(m_hPopupWnd);
                varRet = (SHORT) ::TrackPopupMenuEx(hPopupMenu,
-                       TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON | 
-                        (nCommand == 0 ? (TPM_NONOTIFY | TPM_RETURNCMD) : 0), // \83R\83}\83\93\83h\83x\81[\83X\82ª0\82Å\82 \82ê\82Î\81A\83R\83}\83\93\83h\83C\83x\83\93\83g\82ð\92Ê\92m\82³\82¹\82È\82¢\81B
+                       TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON |
+                       (nCommand == 0 ? (TPM_NONOTIFY | TPM_RETURNCMD) : 0), // \83R\83}\83\93\83h\83x\81[\83X\82ª0\82Å\82 \82ê\82Î\81A\83R\83}\83\93\83h\83C\83x\83\93\83g\82ð\92Ê\92m\82³\82¹\82È\82¢\81B
                        LOWORD(pos),
                        HIWORD(pos),
                        m_hPopupWnd,
@@ -1453,26 +1463,26 @@ STDMETHODIMP COverlappedWindow::GetSysColor(VARIANT typ, VARIANT *col)
        // \83V\83X\83e\83\80\83J\83\89\81[\82Ì\8eæ\93¾
        CComVariant varType;
        CComVariant varRet;
-       varType.ChangeType(VT_I2,&typ);
+       varType.ChangeType(VT_I2, &typ);
        varRet = (long)::GetSysColor(varType.iVal);
        varRet.Detach(col);
        return S_OK;
 }
 
-STDMETHODIMP COverlappedWindow::SetTimer(VARIANT tim,BOOL* pVal)
+STDMETHODIMP COverlappedWindow::SetTimer(VARIANT tim, BOOL* pVal)
 {
        SafeCreateWnd();
 
        CComVariant varTim;
        long timer = 0;
-       if(varTim.ChangeType(VT_I4,&tim) == S_OK){
+       if (varTim.ChangeType(VT_I4, &tim) == S_OK) {
                timer = varTim.lVal;
        }
-       if(timer){
-               *pVal = ::SetTimer(m_hPopupWnd,1,timer,NULL)?VB_TRUE:VB_FALSE;
+       if (timer) {
+               *pVal = ::SetTimer(m_hPopupWnd, 1, timer, NULL) ? VB_TRUE : VB_FALSE;
        }
-       else{
-               *pVal = ::KillTimer(m_hPopupWnd,1)?VB_TRUE:VB_FALSE;
+       else {
+               *pVal = ::KillTimer(m_hPopupWnd, 1) ? VB_TRUE : VB_FALSE;
        }
        return S_OK;
 }
@@ -1481,26 +1491,25 @@ STDMETHODIMP COverlappedWindow::SetTimer(VARIANT tim,BOOL* pVal)
 STDMETHODIMP COverlappedWindow::CheckMenu(VARIANT cmd, VARIANT mode)
 {
        SafeCreateWnd();
-       if(!m_hMenu){
-               ErrorInfo(IDS_ERR_NOCREATEMENU);
-               return DISP_E_EXCEPTION;
+       if (!m_hMenu) {
+               return Error(IDS_ERR_NOCREATEMENU);
        }
        int nCmd = 0;
        int nMode = 0;
-       CComVariant varCmd,varMode;
-       if(varCmd.ChangeType(VT_I2,&cmd) == S_OK){
+       CComVariant varCmd, varMode;
+       if (varCmd.ChangeType(VT_I2, &cmd) == S_OK) {
                nCmd = varCmd.iVal;
        }
-       if(varMode.ChangeType(VT_I2,&mode) == S_OK){
+       if (varMode.ChangeType(VT_I2, &mode) == S_OK) {
                nMode = varMode.iVal;
        }
-       if(nCmd >= 100){
+       if (nCmd >= 100) {
                // \83\81\83j\83\85\81[\83R\83}\83\93\83h\82Í100\88È\8fã\82Å\82 \82é\82Ì\82Å\81B
                MENUITEMINFO inf = {0};
                inf.cbSize = sizeof(MENUITEMINFO);
-               inf.fMask  = MIIM_STATE;
-               inf.fState = nMode?MFS_CHECKED:MFS_UNCHECKED;
-               ::SetMenuItemInfo(m_hMenu,nCmd,false,&inf);
+               inf.fMask = MIIM_STATE;
+               inf.fState = nMode ? MFS_CHECKED : MFS_UNCHECKED;
+               ::SetMenuItemInfo(m_hMenu, nCmd, false, &inf);
        }
        return S_OK;
 }
@@ -1508,26 +1517,25 @@ STDMETHODIMP COverlappedWindow::CheckMenu(VARIANT cmd, VARIANT mode)
 STDMETHODIMP COverlappedWindow::EnableMenu(VARIANT cmd, VARIANT mode)
 {
        SafeCreateWnd();
-       if(!m_hMenu){
-               ErrorInfo(IDS_ERR_NOCREATEMENU);
-               return DISP_E_EXCEPTION;
+       if (!m_hMenu) {
+               return Error(IDS_ERR_NOCREATEMENU);
        }
        int nCmd = 0;
        int nMode = 0;
-       CComVariant varCmd,varMode;
-       if(varCmd.ChangeType(VT_I2,&cmd) == S_OK){
+       CComVariant varCmd, varMode;
+       if (varCmd.ChangeType(VT_I2, &cmd) == S_OK) {
                nCmd = varCmd.iVal;
        }
-       if(varMode.ChangeType(VT_I2,&mode) == S_OK){
+       if (varMode.ChangeType(VT_I2, &mode) == S_OK) {
                nMode = varMode.iVal;
        }
-       if(nCmd >= 100){
+       if (nCmd >= 100) {
                // \83\81\83j\83\85\81[\83R\83}\83\93\83h\82Í100\88È\8fã\82Å\82 \82é\82Ì\82Å\81B
                MENUITEMINFO inf = {0};
                inf.cbSize = sizeof(MENUITEMINFO);
-               inf.fMask  = MIIM_STATE;
-               inf.fState = nMode?MFS_ENABLED:MFS_GRAYED;
-               ::SetMenuItemInfo(m_hMenu,nCmd,false,&inf);
+               inf.fMask = MIIM_STATE;
+               inf.fState = nMode ? MFS_ENABLED : MFS_GRAYED;
+               ::SetMenuItemInfo(m_hMenu, nCmd, false, &inf);
        }
        return S_OK;
 }
@@ -1535,16 +1543,15 @@ STDMETHODIMP COverlappedWindow::EnableMenu(VARIANT cmd, VARIANT mode)
 STDMETHODIMP COverlappedWindow::get_CreateNoCloseWindow(BOOL *pVal)
 {
        // \83N\83\8d\81[\83Y\8bÖ\8e~\83E\83B\83\93\83h\83E?
-       *pVal = windowParam.noclose?VB_TRUE:VB_FALSE;
+       *pVal = windowParam.noclose ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_CreateNoCloseWindow(BOOL newVal)
 {
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                // \83E\83B\83\93\83h\83E\8dì\90¬\8cã\82É\82Í\8ew\92è\82Å\82«\82È\82¢
-               ErrorInfo(IDS_ERR_CREATEDWND);
-               return DISP_E_EXCEPTION;
+               return Error(IDS_ERR_CREATEDWND);
        }
        windowParam.noclose = newVal;
        return S_OK;
@@ -1555,9 +1562,9 @@ STDMETHODIMP COverlappedWindow::get_Canvas(VARIANT *pVal)
        // \83h\83\8d\81[\83C\83\93\83O\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\93n\82·
        ::VariantInit(pVal);
        IUnknown* pUnk = NULL;
-       if(m_pCanvas &&
-               m_pCanvas->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-               pVal->vt      = VT_UNKNOWN;
+       if (m_pCanvas &&
+               m_pCanvas->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+               pVal->vt = VT_UNKNOWN;
                pVal->punkVal = pUnk;
        }
        return S_OK;
@@ -1566,11 +1573,11 @@ STDMETHODIMP COverlappedWindow::get_Canvas(VARIANT *pVal)
 STDMETHODIMP COverlappedWindow::get_Event(VARIANT *pVal)
 {
        ::VariantInit(pVal);
-       if(m_pEvent){
+       if (m_pEvent) {
                // \83C\83x\83\93\83g\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\8eæ\93¾
                IUnknown* pUnk = NULL;
-               if(m_pEvent->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                       pVal->vt      = VT_UNKNOWN;
+               if (m_pEvent->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                       pVal->vt = VT_UNKNOWN;
                        pVal->punkVal = pUnk;
                }
        }
@@ -1585,14 +1592,14 @@ STDMETHODIMP COverlappedWindow::get_DropFiles(VARIANT *pVal)
 
 STDMETHODIMP COverlappedWindow::get_Quit(BOOL *pVal)
 {
-       *pVal = m_bQuit?VB_TRUE:VB_FALSE;
+       *pVal = m_bQuit ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::put_Quit(BOOL newVal)
 {
        m_bQuit = newVal;
-       if(m_hPopupWnd){
+       if (m_hPopupWnd) {
                // \83C\83x\83\93\83g\82ð\94­\90\82³\82¹\91Ò\8b@\8fó\91Ô\82ð\89ð\82­
                SetEvent(m_hWaitEvent);
        }
@@ -1603,10 +1610,10 @@ STDMETHODIMP COverlappedWindow::get_Form(VARIANT *pVal)
 {
        // \83t\83H\81[\83\80\82Ì\8cö\8aJ
        ::VariantInit(pVal);
-       if(m_pForm){
+       if (m_pForm) {
                IUnknown* pUnk = NULL;
-               if(m_pForm->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                       pVal->vt      = VT_UNKNOWN;
+               if (m_pForm->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                       pVal->vt = VT_UNKNOWN;
                        pVal->punkVal = pUnk;
                }
        }
@@ -1615,8 +1622,8 @@ STDMETHODIMP COverlappedWindow::get_Form(VARIANT *pVal)
 
 STDMETHODIMP COverlappedWindow::get_Style(long *pVal)
 {
-       if(m_hPopupWnd){
-               windowParam.style = ::GetWindowLong(m_hPopupWnd,GWL_STYLE);
+       if (m_hPopupWnd) {
+               windowParam.style = ::GetWindowLong(m_hPopupWnd, GWL_STYLE);
        }
        *pVal = (long)windowParam.style;
        return S_OK;
@@ -1625,16 +1632,16 @@ STDMETHODIMP COverlappedWindow::get_Style(long *pVal)
 STDMETHODIMP COverlappedWindow::put_Style(long newVal)
 {
        windowParam.style = (DWORD)newVal;
-       if(m_hPopupWnd){
-               ::SetWindowLong(m_hPopupWnd,GWL_STYLE,windowParam.style);
+       if (m_hPopupWnd) {
+               ::SetWindowLong(m_hPopupWnd, GWL_STYLE, windowParam.style);
        }
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_Exstyle(long *pVal)
 {
-       if(m_hPopupWnd){
-               windowParam.exstyle = ::GetWindowLong(m_hPopupWnd,GWL_EXSTYLE);
+       if (m_hPopupWnd) {
+               windowParam.exstyle = ::GetWindowLong(m_hPopupWnd, GWL_EXSTYLE);
        }
        *pVal = (long)windowParam.exstyle;
        return S_OK;
@@ -1680,31 +1687,32 @@ void COverlappedWindow::SetTitle()
 STDMETHODIMP COverlappedWindow::SetPlacement(VARIANT x, VARIANT y, VARIANT w, VARIANT h, VARIANT *pvarUnk)
 {
        // \83T\83C\83Y\95Ï\8dX
-       CComVariant varX,varY,varW,varH;
+       CComVariant varX, varY, varW, varH;
        UINT flag = SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE;
-       if((x.vt != VT_EMPTY && x.vt != VT_NULL && x.vt != VT_ERROR) && varX.ChangeType(VT_I2,&x) == S_OK){
+       if ((x.vt != VT_EMPTY && x.vt != VT_NULL && x.vt != VT_ERROR) && varX.ChangeType(VT_I2, &x) == S_OK) {
                windowParam.posX = varX.iVal;
                flag &= ~SWP_NOMOVE;
        }
-       if((y.vt != VT_EMPTY && y.vt != VT_NULL && y.vt != VT_ERROR) && varY.ChangeType(VT_I2,&y) == S_OK){
+       if ((y.vt != VT_EMPTY && y.vt != VT_NULL && y.vt != VT_ERROR) && varY.ChangeType(VT_I2, &y) == S_OK) {
                windowParam.posY = varY.iVal;
                flag &= ~SWP_NOMOVE;
        }
-       if((w.vt != VT_EMPTY && w.vt != VT_NULL && w.vt != VT_ERROR) && varW.ChangeType(VT_I2,&w) == S_OK){
+       if ((w.vt != VT_EMPTY && w.vt != VT_NULL && w.vt != VT_ERROR) && varW.ChangeType(VT_I2, &w) == S_OK) {
                windowParam.width = varW.iVal;
                flag &= ~SWP_NOSIZE;
        }
-       if((h.vt != VT_EMPTY && h.vt != VT_NULL && h.vt != VT_ERROR) && varH.ChangeType(VT_I2,&h) == S_OK){
+       if ((h.vt != VT_EMPTY && h.vt != VT_NULL && h.vt != VT_ERROR) && varH.ChangeType(VT_I2, &h) == S_OK) {
                windowParam.height = varH.iVal;
                flag &= ~SWP_NOSIZE;
        }
        // \83E\83B\83\93\83h\83E\82ª\95\\8e¦\82³\82ê\82Ä\82¢\82ê\82Î\82½\82¾\82¿\82É\94½\89f
-       if(m_hPopupWnd){
-               ::SetWindowPos(m_hPopupWnd,NULL,windowParam.posX,windowParam.posY,windowParam.width,windowParam.height,flag);
+       if (m_hPopupWnd) {
+               ::SetWindowPos(m_hPopupWnd, NULL, windowParam.posX, windowParam.posY, windowParam.width, windowParam.height, flag);
        }
-       if(m_pForm){
+       if (m_pForm) {
                // \83t\83H\81[\83\80\82Ì\83T\83C\83Y\82ð\95Ï\8dX\82·\82é
-               m_pForm->SetWindowSize(windowParam.width,windowParam.height,windowParam.GetStyle() & WS_THICKFRAME);
+               m_pForm->SetWindowSize(windowParam.width, windowParam.height,
+                       windowParam.GetStyle(), windowParam.exstyle);
        }
        CreateThisInterface(pvarUnk);
        return S_OK;
@@ -1715,31 +1723,31 @@ void COverlappedWindow::CreateThisInterface(VARIANT* pvarUnk)
        // \82±\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\95Ô\82·
        ::VariantInit(pvarUnk);
        IUnknown* pUnk = NULL;
-       if(QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-               pvarUnk->vt       = VT_UNKNOWN;
+       if (QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+               pvarUnk->vt = VT_UNKNOWN;
                pvarUnk->punkVal = pUnk;
        }
 }
 
 STDMETHODIMP COverlappedWindow::SetWindowStyle(VARIANT frametype, VARIANT caption_system, VARIANT maxmin, VARIANT *pvarUnk)
 {
-       CComVariant varFrametype,varCaptionSystem,varMaxMin;
-       if(frametype.vt != VT_EMPTY && frametype.vt != VT_ERROR && frametype.vt != VT_NULL
-               && varFrametype.ChangeType(VT_I2,&frametype) == S_OK){
+       CComVariant varFrametype, varCaptionSystem, varMaxMin;
+       if (frametype.vt != VT_EMPTY && frametype.vt != VT_ERROR && frametype.vt != VT_NULL
+               && varFrametype.ChangeType(VT_I2, &frametype) == S_OK) {
                windowParam.frametype = varFrametype.iVal;
        }
-       if(caption_system.vt != VT_EMPTY && caption_system.vt != VT_ERROR && caption_system.vt != VT_NULL
-               && varCaptionSystem.ChangeType(VT_I2,&caption_system) == S_OK){
+       if (caption_system.vt != VT_EMPTY && caption_system.vt != VT_ERROR && caption_system.vt != VT_NULL
+               && varCaptionSystem.ChangeType(VT_I2, &caption_system) == S_OK) {
                windowParam.captionbar = (varCaptionSystem.iVal > 0);
                windowParam.systemmenu = (varCaptionSystem.iVal > 1);
        }
-       if(maxmin.vt != VT_EMPTY && maxmin.vt != VT_ERROR && maxmin.vt != VT_NULL
-               && varMaxMin.ChangeType(VT_I2,&maxmin) == S_OK){
+       if (maxmin.vt != VT_EMPTY && maxmin.vt != VT_ERROR && maxmin.vt != VT_NULL
+               && varMaxMin.ChangeType(VT_I2, &maxmin) == S_OK) {
                windowParam.minbox = (varMaxMin.iVal & 0x01);
                windowParam.maxbox = (varMaxMin.iVal & 0x02);
        }
-       if(m_hPopupWnd){
-               ::SetWindowLong(m_hPopupWnd,GWL_STYLE,windowParam.GetStyle());
+       if (m_hPopupWnd) {
+               ::SetWindowLong(m_hPopupWnd, GWL_STYLE, windowParam.GetStyle());
                Refresh();
        }
        CreateThisInterface(pvarUnk);
@@ -1752,13 +1760,13 @@ STDMETHODIMP COverlappedWindow::CreateChild(VARIANT *pvarUnk)
        ::VariantInit(pvarUnk);
        // \8eQ\8fÆ\83J\83E\83\93\83g\82ª1\82Â\82µ\82©\82È\82¢\83E\83B\83\93\83h\83E\82Ì\94j\8aü\82ð\8ds\82¤
        list<CComObject<COverlappedWindow>*>::iterator p = m_lstChild.begin();
-       while(p != m_lstChild.end()){
+       while (p != m_lstChild.end()) {
                DWORD refCount = (*p)->m_dwRef;
-               if((*p)->m_dwRef == 1){
+               if ((*p)->m_dwRef == 1) {
                        // \8eQ\8fÆ\83J\83E\83\93\83g\82ª1\82µ\82©\82È\82¢ = \82±\82Ì\83N\83\89\83X\82µ\82©\8eg\82Á\82Ä\82¢\82È\82¢ = \95s\97v
                        BOOL bVisible = false;
                        (*p)->get_Visible(&bVisible);
-                       if(!bVisible){
+                       if (!bVisible) {
                                // \95\\8e¦\82³\82ê\82Ä\82¢\82È\82¯\82ê\82Î\8fÁ\82µ\82Ä\82æ\82µ\81B
                                (*p)->Release();
                                p = m_lstChild.erase(p);
@@ -1769,15 +1777,15 @@ STDMETHODIMP COverlappedWindow::CreateChild(VARIANT *pvarUnk)
        }
        //
        CComObject<COverlappedWindow>* pChild = NULL;
-       if(pChild->CreateInstance(&pChild) == S_OK){
+       if (pChild->CreateInstance(&pChild) == S_OK) {
                pChild->AddRef();
                pChild->SetParent(m_hPopupWnd);
                pChild->put_WaitCursor(m_dWaitCursor);
                m_lstChild.push_back(pChild);
                // \83C\83\93\83^\81[\83t\83F\83C\83X\82ð\95Ô\82·
                IUnknown* pUnk = NULL;
-               if(pChild->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
-                       pvarUnk->vt      = VT_UNKNOWN;
+               if (pChild->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                       pvarUnk->vt = VT_UNKNOWN;
                        pvarUnk->punkVal = pUnk;
                }
        }
@@ -1797,45 +1805,45 @@ HANDLE COverlappedWindow::GetEventHandle()
 void COverlappedWindow::SetWaitParam(int *count, HWND *hWnd, HANDLE *hEvent)
 {
        // \82·\82×\82Ä\82Ì\8eq\83I\81[\83o\81[\83\89\83b\83v\83E\83B\83\93\83h\83E\82Ì\83C\83x\83\93\83g\83n\83\93\83h\83\8b\82ð\8eæ\93¾
-       if(*count < MAXIMUM_WAIT_OBJECTS){
+       if (*count < MAXIMUM_WAIT_OBJECTS) {
                // \8e©\95ª\8e©\90g\82ð\93o\98^
                hEvent[*count] = m_hWaitEvent;
-               hWnd  [*count] = m_hPopupWnd;
+               hWnd[*count] = m_hPopupWnd;
                (*count)++;
                // \83`\83\83\83C\83\8b\83h\82ð\93o\98^
                list<CComObject<COverlappedWindow>*>::iterator p = m_lstChild.begin();
-               while( (p != m_lstChild.end()) && (*count < MAXIMUM_WAIT_OBJECTS) ){
+               while ((p != m_lstChild.end()) && (*count < MAXIMUM_WAIT_OBJECTS)) {
                        // \83`\83\83\83C\83\8b\83h\82ª\8f\8a\97L\82·\82é\83`\83\83\83C\83\8b\83h\82ð\8dÄ\8bN\93I\82É\8cÄ\82Ñ\8fo\82·
-                       (*p)->SetWaitParam(count,hWnd,hEvent);
+                       (*p)->SetWaitParam(count, hWnd, hEvent);
                        p++;
                }
        }
 }
 
-DWORD COverlappedWindow::MessageLoop(DWORD sleeptim,int cnt, HWND *hWnd, HANDLE* hEvent)
+DWORD COverlappedWindow::MessageLoop(DWORD sleeptim, int cnt, HWND *hWnd, HANDLE* hEvent)
 {
        // \83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\8f\88\97\9d\82·\82é
        DWORD ret = 0;
-       DWORD retWait = MsgWaitForMultipleObjects(cnt,hEvent,false,sleeptim,QS_ALLEVENTS|QS_ALLINPUT);
+       DWORD retWait = MsgWaitForMultipleObjects(cnt, hEvent, false, sleeptim, QS_ALLEVENTS | QS_ALLINPUT);
 
-       if(retWait != WAIT_TIMEOUT){
+       if (retWait != WAIT_TIMEOUT) {
                ret = 0;
-               if(retWait >= WAIT_OBJECT_0 && retWait < WAIT_OBJECT_0 + cnt){
+               if (retWait >= WAIT_OBJECT_0 && retWait < WAIT_OBJECT_0 + cnt) {
                        // \83C\83x\83\93\83g\82Ì\94­\90\82µ\82½\83n\83\93\83h\83\8b\82ð\8e¯\95Ê\82·\82é
                        ret = retWait - WAIT_OBJECT_0 + 1;
                }
                //
                MSG msg;
-               while(PeekMessage(&msg, NULL, 0, 0,PM_REMOVE)){
+               while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
                        BOOL bTranslated = false;
-                       HWND hOwner      = NULL;
-                       if(msg.hwnd){
+                       HWND hOwner = NULL;
+                       if (msg.hwnd) {
                                // \83\81\83b\83Z\81[\83W\82ª\91®\82·\82é\83I\81[\83i\81[\83E\83B\83\93\83h\83E\82ð\92T\82µ\8fo\82·
                                HWND hParent = msg.hwnd;
-                               while(!hOwner && hParent){
+                               while (!hOwner && hParent) {
                                        int i;
-                                       for(i=0 ; i<cnt && hWnd[i]  ; i++){
-                                               if(hParent == hWnd[i]){
+                                       for (i = 0; i < cnt && hWnd[i]; i++) {
+                                               if (hParent == hWnd[i]) {
                                                        hOwner = hWnd[i];
                                                        break;
                                                }
@@ -1843,38 +1851,38 @@ DWORD COverlappedWindow::MessageLoop(DWORD sleeptim,int cnt, HWND *hWnd, HANDLE*
                                        hParent = ::GetParent(hParent);
                                }
                        }
-                       if(hOwner){
+                       if (hOwner) {
                                BOOL bTranslatedDlg = false;
-                               if(msg.message == WM_KEYDOWN){
+                               if (msg.message == WM_KEYDOWN) {
                                        // \82Æ\82 \82¦\82¸\81A\8c»\8dÝ\82Ì\83L\81[\83R\81[\83h\82ð\83E\83B\83\93\83h\83E\83v\83\8d\83V\83W\83\83\82É\8f\88\97\9d\82³\82¹\82é
-                                       ::SendMessage(hOwner,WM_KEYDOWN_EX,msg.wParam,msg.lParam);
+                                       ::SendMessage(hOwner, WM_KEYDOWN_EX, msg.wParam, msg.lParam);
                                        bTranslated = true;
                                        // \83_\83C\83A\83\8d\83O\82à\82Ç\82«\8f\88\97\9d\82ð\8ds\82¤
-                                       BOOL bShift = GetKeyState(VK_SHIFT  ) & 0x8000;
-                                       BOOL bCtrl  = GetKeyState(VK_CONTROL) & 0x8000;
-                                       if(msg.wParam == VK_TAB){
+                                       BOOL bShift = GetKeyState(VK_SHIFT) & 0x8000;
+                                       BOOL bCtrl = GetKeyState(VK_CONTROL) & 0x8000;
+                                       if (msg.wParam == VK_TAB) {
                                                // TAB = MOVE FOCUS 
-                                               if(!bCtrl){
-                                                       HWND hNextFocus = ::GetNextDlgTabItem(hOwner,GetFocus(),bShift);
-                                                       if(hNextFocus){
+                                               if (!bCtrl) {
+                                                       HWND hNextFocus = ::GetNextDlgTabItem(hOwner, GetFocus(), bShift);
+                                                       if (hNextFocus) {
                                                                ::SetFocus(hNextFocus);
                                                        }
                                                }
                                                bTranslatedDlg = true;
                                        }
-                                       else if(msg.wParam == VK_F6){
+                                       else if (msg.wParam == VK_F6) {
                                                // ESCAPE = CANCEL
-                                               SendMessage(hOwner,WM_MOVENEXT_OVERLAPPED,0,0);
+                                               SendMessage(hOwner, WM_MOVENEXT_OVERLAPPED, 0, 0);
                                                bTranslatedDlg = true;
                                        }
                                }
-                               if(!bTranslatedDlg){
-                                       bTranslated |= ::IsDialogMessage(hOwner,&msg);
+                               if (!bTranslatedDlg) {
+                                       bTranslated |= ::IsDialogMessage(hOwner, &msg);
                                }
                        }
-                       if(!bTranslated){
-                               ::TranslateMessage( &msg );
-                               ::DispatchMessage( &msg );
+                       if (!bTranslated) {
+                               ::TranslateMessage(&msg);
+                               ::DispatchMessage(&msg);
                        }
                }
        }
@@ -1883,7 +1891,7 @@ DWORD COverlappedWindow::MessageLoop(DWORD sleeptim,int cnt, HWND *hWnd, HANDLE*
 
 STDMETHODIMP COverlappedWindow::get_AutoMessageLoop(BOOL *pVal)
 {
-       *pVal = windowParam.automessageloop?VB_TRUE:VB_FALSE;
+       *pVal = windowParam.automessageloop ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -1895,30 +1903,30 @@ STDMETHODIMP COverlappedWindow::put_AutoMessageLoop(BOOL newVal)
 
 STDMETHODIMP COverlappedWindow::DoModal(VARIANT* pRetCode)
 {
-       CComVariant dmy,retdmy;
-       dmy.vt    = VT_ERROR;
+       CComVariant dmy, retdmy;
+       dmy.vt = VT_ERROR;
        dmy.scode = DISP_E_PARAMNOTFOUND;
-       Open(dmy,&retdmy);
+       Open(dmy, &retdmy);
 
        CComVariant tim = (short)1000;
        BOOL ret;
-       while(!m_bQuit && ::IsWindow(m_hPopupWnd)){
-               WaitEvent(tim,&ret);
-               if(ret){
+       while (!m_bQuit && ::IsWindow(m_hPopupWnd)) {
+               WaitEvent(tim, &ret);
+               if (ret) {
                        DoEvent(&dmy);
                }
        }
        Close();
 
        ::VariantInit(pRetCode);
-       pRetCode->vt   = VT_I2;
+       pRetCode->vt = VT_I2;
        pRetCode->iVal = m_dModalExitCode;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_AutoClose(BOOL *pVal)
 {
-       *pVal = windowParam.autoclose?VB_TRUE:VB_FALSE;
+       *pVal = windowParam.autoclose ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -1928,30 +1936,30 @@ STDMETHODIMP COverlappedWindow::put_AutoClose(BOOL newVal)
        return S_OK;
 }
 
-void COverlappedWindow::CreateWindowList(list<HWND>& lstWnd,BOOL bSearchRoot)
+void COverlappedWindow::CreateWindowList(list<HWND>& lstWnd, BOOL bSearchRoot)
 {
        HWND* hWnds = NULL;
-       if(m_hParentWnd && bSearchRoot){
+       if (m_hParentWnd && bSearchRoot) {
                // \8dª\8c³\82Å\82È\82¯\82ê\82Î\81A\82³\82ç\82É\96â\82¢\8d\87\82í\82¹\82é
                COverlappedWindow* pParent = (COverlappedWindow*)::GetWindowLongPtr(m_hParentWnd, GWLP_USERDATA);
                if (pParent) {
-                       pParent->CreateWindowList(lstWnd,true);
+                       pParent->CreateWindowList(lstWnd, true);
                }
        }
-       else{
+       else {
                // \82±\82±\82ª\8dª\8c³\82Å\82 \82é
                list<CComObject<COverlappedWindow>*>::iterator p = m_lstChild.begin();
-               DWORD stl = ::GetWindowLong(m_hPopupWnd,GWL_STYLE);
-               if(stl & WS_VISIBLE){
+               DWORD stl = ::GetWindowLong(m_hPopupWnd, GWL_STYLE);
+               if (stl & WS_VISIBLE) {
                        // \95\\8e¦\82³\82ê\82Ä\82¢\82é\83E\83B\83\93\83h\83E\82Ì\82Ý\82ð\93o\98^\82·\82é
                        lstWnd.push_back(m_hPopupWnd);
                }
-               while(p != m_lstChild.end()){
+               while (p != m_lstChild.end()) {
                        // \82·\82×\82Ä\82Ì\8eq\83I\81[\83o\81[\83\89\83b\83v\82ð\97ñ\8b\93\82·\82é
                        HWND hWnd = NULL;
                        (*p)->get_HWND((long*)&hWnd);
-                       if(hWnd && ::IsWindow(hWnd)){
-                               (*p)->CreateWindowList(lstWnd,false);
+                       if (hWnd && ::IsWindow(hWnd)) {
+                               (*p)->CreateWindowList(lstWnd, false);
                        }
                        p++;
                }
@@ -1962,20 +1970,20 @@ void COverlappedWindow::MoveNextOverlapped()
 {
        // \8f\87\8f\98\83\8a\83X\83g\82Ì\90\90¬\82ð\88Ë\97\8a\82·\82é
        list<HWND>lstWnd;
-       CreateWindowList(lstWnd,true);
+       CreateWindowList(lstWnd, true);
        // \8c»\8dÝ\88Ê\92u\82ð\94c\88¬\82·\82é
        HWND hActiveWnd = ::GetActiveWindow();
        list<HWND>::iterator p = lstWnd.begin();
-       while(p != lstWnd.end()){
+       while (p != lstWnd.end()) {
                // \97ñ\8b\93
-               if(hActiveWnd == *p){
+               if (hActiveWnd == *p) {
                        // \83A\83N\83e\83B\83u\83E\83B\83\93\83h\83E\82ð\94­\8c©\82µ\82½
                        p++;
                        HWND hNext = lstWnd.front();
-                       if(p != lstWnd.end()){
+                       if (p != lstWnd.end()) {
                                hNext = *p;
                        }
-//                     ::SetActiveWindow(hNext);
+                       //                      ::SetActiveWindow(hNext);
                        ::SetFocus(hNext);
                        break;
                }
@@ -1987,8 +1995,8 @@ STDMETHODIMP COverlappedWindow::get_Object(VARIANT idx, VARIANT *pVal)
 {
        // \83I\81[\83o\81[\83\89\83b\83v\83I\83u\83W\83F\83N\83g\82É\83o\83C\83\93\83h\82·\82é\82±\82Æ\82Ì\82Å\82«\82é\98A\91z\94z\97ñ
        ::VariantInit(pVal);
-       pVal->vt      = VT_UNKNOWN;
-       m_pObject->QueryInterface(IID_IUnknown,(void**)&(pVal->punkVal));
+       pVal->vt = VT_UNKNOWN;
+       m_pObject->QueryInterface(IID_IUnknown, (void**)&(pVal->punkVal));
        return S_OK;
 }
 
@@ -2014,12 +2022,12 @@ STDMETHODIMP COverlappedWindow::get_WaitCursor(short *pVal)
 STDMETHODIMP COverlappedWindow::put_WaitCursor(short newVal)
 {
        m_dWaitCursor = newVal;
-       if(m_hPopupWnd){
-               ::SendMessage(m_hPopupWnd,WM_SETCURSOR,(WPARAM)m_hPopupWnd,0);
+       if (m_hPopupWnd) {
+               ::SendMessage(m_hPopupWnd, WM_SETCURSOR, (WPARAM)m_hPopupWnd, 0);
        }
        // \83`\83\83\83C\83\8b\83h\82ð\8e\9d\82Á\82Ä\82¢\82é\8fê\8d\87\82Í\81A\83`\83\83\83C\83\8b\83h\82É\82à\83E\83F\83C\83g\83J\81[\83\\83\8b\82ð\93K\97p\82·\82é
        list<CComObject<COverlappedWindow>*>::iterator pWnd = m_lstChild.begin();
-       while(pWnd != m_lstChild.end()){
+       while (pWnd != m_lstChild.end()) {
                (*pWnd)->put_WaitCursor(newVal);
                pWnd++;
        }
@@ -2053,33 +2061,33 @@ STDMETHODIMP COverlappedWindow::CenterWindow()
 {
        SafeCreateWnd();
        RECT rct;
-       if(m_hParentWnd){
+       if (m_hParentWnd) {
                // \90e\83E\83B\83\93\83h\83E\82ª\82 \82ê\82Î\81A\82»\82Ì\92\86\89\9b\82É\88Ê\92u\82 \82í\82¹\82·\82é
-               ::GetWindowRect(m_hParentWnd,&rct);
+               ::GetWindowRect(m_hParentWnd, &rct);
        }
-       else{
+       else {
                HWND hwnd = ::GetDesktopWindow();
-               if(!hwnd){
+               if (!hwnd) {
                        return S_OK;
                }
-               ::GetWindowRect(hwnd,&rct);
+               ::GetWindowRect(hwnd, &rct);
        }
-       int x = rct.left + (rct.right  - rct.left)/2 - windowParam.width  / 2;
-       int y = rct.top  + (rct.bottom - rct.top )/2 - windowParam.height / 2;
-       WINDOWPLACEMENT pls = { 0 };
+       int x = rct.left + (rct.right - rct.left) / 2 - windowParam.width / 2;
+       int y = rct.top + (rct.bottom - rct.top) / 2 - windowParam.height / 2;
+       WINDOWPLACEMENT pls = {0};
        pls.length = sizeof(WINDOWPLACEMENT);
-       pls.rcNormalPosition.top    = y;
-       pls.rcNormalPosition.left   = x;
+       pls.rcNormalPosition.top = y;
+       pls.rcNormalPosition.left = x;
        pls.rcNormalPosition.bottom = y + windowParam.height;
-       pls.rcNormalPosition.right  = x + windowParam.width;
-       ::SetWindowPlacement(m_hPopupWnd,&pls);
+       pls.rcNormalPosition.right = x + windowParam.width;
+       ::SetWindowPlacement(m_hPopupWnd, &pls);
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_ClassObject(VARIANT* pVal)
 {
        ::VariantInit(pVal);
-       if(m_pClassDisp){
+       if (m_pClassDisp) {
                m_pClassDisp->AddRef();
                pVal->pdispVal = m_pClassDisp;
                pVal->vt = VT_UNKNOWN;
@@ -2089,37 +2097,38 @@ STDMETHODIMP COverlappedWindow::get_ClassObject(VARIANT* pVal)
 
 STDMETHODIMP COverlappedWindow::put_ClassObject(VARIANT newVal)
 {
-       if(m_pClassDisp){
+       if (m_pClassDisp) {
                m_pClassDisp->Release();
        }
-       if(newVal.vt == VT_DISPATCH){
+       if (newVal.vt == VT_DISPATCH) {
                m_pClassDisp = newVal.pdispVal;
                m_pClassDisp->AddRef();
        }
-       else if(!(newVal.vt == VT_EMPTY || newVal.vt == VT_ERROR || newVal.vt == VT_NULL)){
+       else if (!(newVal.vt == VT_EMPTY || newVal.vt == VT_ERROR || newVal.vt == VT_NULL)) {
                return DISP_E_TYPEMISMATCH;
        }
        return S_OK;
 }
 
-void COverlappedWindow::ClassObjectInvoke(LPCWSTR handler)
+HRESULT COverlappedWindow::ClassObjectInvoke(LPCWSTR handler)
 {
-       if(!m_pClassDisp){
-               return;
+       if (!m_pClassDisp) {
+               return S_FALSE;
        }
        DISPID dispid;
-       if(m_pClassDisp->GetIDsOfNames(IID_NULL,(LPWSTR*)&handler,1,LOCALE_SYSTEM_DEFAULT,&dispid) != S_OK){
-               return;
+       HRESULT hr;
+       if (FAILED(hr = m_pClassDisp->GetIDsOfNames(IID_NULL, (LPWSTR*)&handler, 1, LOCALE_SYSTEM_DEFAULT, &dispid))) {
+               return hr;
        }
        DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
-       m_pClassDisp->Invoke(dispid,IID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD,&dispparamsNoArgs,NULL,NULL,NULL);
+       return m_pClassDisp->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, NULL, NULL, NULL);
 }
 
 STDMETHODIMP COverlappedWindow::get_ClientWidth(long *pVal)
 {
        SafeCreateWnd();
        RECT rct;
-       ::GetClientRect(m_hPopupWnd,&rct);
+       ::GetClientRect(m_hPopupWnd, &rct);
        *pVal = rct.right;
        return S_OK;
 }
@@ -2128,7 +2137,7 @@ STDMETHODIMP COverlappedWindow::get_ClientHeight(long *pVal)
 {
        SafeCreateWnd();
        RECT rct;
-       ::GetClientRect(m_hPopupWnd,&rct);
+       ::GetClientRect(m_hPopupWnd, &rct);
        *pVal = rct.bottom;
        return S_OK;
 }
@@ -2137,14 +2146,14 @@ STDMETHODIMP COverlappedWindow::get_innerWidth(double *pVal)
 {
        SafeCreateWnd();
        RECT rct;
-       ::GetClientRect(m_hPopupWnd,&rct);
-       POINT pt = {rct.right,0-rct.bottom};
+       ::GetClientRect(m_hPopupWnd, &rct);
+       POINT pt = {rct.right, 0 - rct.bottom};
        HDC hdc = ::GetWindowDC(m_hPopupWnd);
        int md = ::GetMapMode(hdc);
-       ::SetMapMode(hdc,MM_LOMETRIC);
-       ::DPtoLP(hdc,&pt,1);
-       ::SetMapMode(hdc,md);
-       ::ReleaseDC(m_hPopupWnd,hdc);
+       ::SetMapMode(hdc, MM_LOMETRIC);
+       ::DPtoLP(hdc, &pt, 1);
+       ::SetMapMode(hdc, md);
+       ::ReleaseDC(m_hPopupWnd, hdc);
        *pVal = pt.x / 10.;
        return S_OK;
 }
@@ -2153,21 +2162,21 @@ STDMETHODIMP COverlappedWindow::get_innerHeight(double *pVal)
 {
        SafeCreateWnd();
        RECT rct;
-       ::GetClientRect(m_hPopupWnd,&rct);
-       POINT pt = {rct.right,0-rct.bottom};
+       ::GetClientRect(m_hPopupWnd, &rct);
+       POINT pt = {rct.right, 0 - rct.bottom};
        HDC hdc = ::GetWindowDC(m_hPopupWnd);
        int md = ::GetMapMode(hdc);
-       ::SetMapMode(hdc,MM_LOMETRIC);
-       ::DPtoLP(hdc,&pt,1);
-       ::SetMapMode(hdc,md);
-       ::ReleaseDC(m_hPopupWnd,hdc);
+       ::SetMapMode(hdc, MM_LOMETRIC);
+       ::DPtoLP(hdc, &pt, 1);
+       ::SetMapMode(hdc, md);
+       ::ReleaseDC(m_hPopupWnd, hdc);
        *pVal = pt.y / 10.;
        return S_OK;
 }
 
 STDMETHODIMP COverlappedWindow::get_AutoReleaseClassObject(BOOL *pVal)
 {
-       *pVal = m_bAutoReleaseClassObject?VB_TRUE:VB_FALSE;
+       *pVal = m_bAutoReleaseClassObject ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -2179,7 +2188,7 @@ STDMETHODIMP COverlappedWindow::put_AutoReleaseClassObject(BOOL newVal)
 
 STDMETHODIMP COverlappedWindow::get_DefaultAction(BOOL *pVal)
 {
-       *pVal = m_bDefaultAction?VB_TRUE:VB_FALSE;
+       *pVal = m_bDefaultAction ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -2192,15 +2201,16 @@ STDMETHODIMP COverlappedWindow::put_DefaultAction(BOOL newVal)
 STDMETHODIMP COverlappedWindow::SetClipboardText(BSTR text)
 {
        SafeCreateWnd();
-       if(::OpenClipboard(m_hPopupWnd)){
+       if (::OpenClipboard(m_hPopupWnd)) {
                ::EmptyClipboard();
-               int len = SysStringByteLen(text);
-               HGLOBAL hGlobal = GlobalAlloc(GMEM_DDESHARE,len + 1);
-               LPSTR p = (LPSTR)GlobalLock(hGlobal);
-               WideCharToMultiByte(GetACP(),0,text,-1,p,len,NULL,NULL);
-               p[len] = 0;
-               GlobalUnlock(hGlobal);
-               ::SetClipboardData(CF_TEXT,hGlobal);
+               if (text) {
+                       int len = SysStringByteLen(text);
+                       HGLOBAL hGlobal = GlobalAlloc(GMEM_DDESHARE, (len + 1) * sizeof(WCHAR));
+                       LPWSTR p = (LPWSTR)GlobalLock(hGlobal);
+                       StringCchCopyW(p, len + 1, text);
+                       GlobalUnlock(hGlobal);
+                       ::SetClipboardData(CF_UNICODETEXT, hGlobal);
+               }
                ::CloseClipboard();
        }
        return S_OK;
@@ -2210,17 +2220,30 @@ STDMETHODIMP COverlappedWindow::GetClipboardText(VARIANT *pVarText)
 {
        SafeCreateWnd();
        ::VariantInit(pVarText);
-       if(::OpenClipboard(m_hPopupWnd)){
-               if(IsClipboardFormatAvailable(CF_TEXT)){
+       if (::OpenClipboard(m_hPopupWnd)) {
+               if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
+                       // UNICODE\95\8e\9a\97ñ\82ª\82 \82ê\82Î\81A\82»\82¿\82ç\82ð\97D\90æ\82µ\82Ä\8eæ\93¾\82·\82é
+                       HGLOBAL hGlobal = ::GetClipboardData(CF_UNICODETEXT);
+                       if (hGlobal) {
+                               LPWSTR p = (LPWSTR)GlobalLock(hGlobal);
+                               if (p) {
+                                       CComBSTR wstr(p);
+                                       GlobalUnlock(hGlobal);
+                                       pVarText->bstrVal = wstr.Detach();
+                                       pVarText->vt = VT_BSTR;
+                               }
+                       }
+               }
+               else if (IsClipboardFormatAvailable(CF_TEXT)) {
+                       // UNICODE\95\8e\9a\97ñ\82ª\82È\82¢\8fê\8d\87
                        HGLOBAL hGlobal = ::GetClipboardData(CF_TEXT);
-                       if(hGlobal){
+                       if (hGlobal) {
                                LPCSTR p = (LPSTR)GlobalLock(hGlobal);
-                               if(p){
-                                       int len = GlobalSize(hGlobal);
-                                       _bstr_t wstr(p);
+                               if (p) {
+                                       CComBSTR wstr(p);
                                        GlobalUnlock(hGlobal);
-                                       pVarText->bstrVal = wstr.copy();
-                                       pVarText->vt      = VT_BSTR;
+                                       pVarText->bstrVal = wstr.Detach();
+                                       pVarText->vt = VT_BSTR;
                                }
                        }
                }
index 4726908..1288894 100644 (file)
@@ -1,8 +1,7 @@
-       
+
 // OverlappedWindow.h : Declaration of the COverlappedWindow
 
-#ifndef __OverlappedWindow_H_
-#define __OverlappedWindow_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include <atlctl.h>
@@ -36,36 +35,36 @@ public:
        void Clear()
        {
                list<LPTSTR>::iterator p = m_lstPath.begin();
-               while(p != m_lstPath.end()){
-                       delete[] *p;
+               while (p != m_lstPath.end()) {
+                       delete[] * p;
                        p = m_lstPath.erase(p);
                }
        }
        void DropFiles(HDROP hDrop)
        {
                Clear();
-               int count = ::DragQueryFile(hDrop,-1,NULL,0);
+               int count = ::DragQueryFile(hDrop, -1, NULL, 0);
                int i;
-               for(i=0;i<count;i++){
-                       DWORD sz = ::DragQueryFile(hDrop,i,NULL,0);
-                       LPTSTR pBuf = new TCHAR[sz+1];
-                       ::DragQueryFile(hDrop,i,pBuf,MAX_PATH);
+               for (i = 0; i < count; i++) {
+                       DWORD sz = ::DragQueryFile(hDrop, i, NULL, 0);
+                       LPTSTR pBuf = new TCHAR[sz + 1];
+                       ::DragQueryFile(hDrop, i, pBuf, MAX_PATH);
                        m_lstPath.push_back(pBuf);
                }
        }
        void GetPathArray(VARIANT *pvarPathName)
        {
-               if(m_lstPath.empty()){
+               if (m_lstPath.empty()) {
                        // \8bó\82Å\82 \82é
                        pvarPathName->vt = VT_EMPTY;
                        return;
                }
-               SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT,0,m_lstPath.size());
+               SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT, 0, m_lstPath.size());
                VARIANT* pvars;
-               if(SafeArrayAccessData(pArray,(void**)&pvars) == S_OK){
+               if (SafeArrayAccessData(pArray, (void**)&pvars) == S_OK) {
                        int i = 0;
                        list<LPTSTR>::iterator p = m_lstPath.begin();
-                       while(p != m_lstPath.end()){
+                       while (p != m_lstPath.end()) {
                                CComVariant wbuf(*p);
                                wbuf.Detach(&pvars[i]);
                                p++;
@@ -88,40 +87,40 @@ class CreateOverlappedWindow
 public:
        CreateOverlappedWindow()
        {
-               style      = 0;
-               exstyle    = 0;
-               showMode   = 0;
-               noclose    = false;
-               frametype  = true;
+               style = 0;
+               exstyle = 0;
+               showMode = 0;
+               noclose = false;
+               frametype = true;
                captionbar = true;
                systemmenu = true;
-               minbox     = true;
-               maxbox     = true;
-               autoclose  = true;
+               minbox = true;
+               maxbox = true;
+               autoclose = true;
                automessageloop = true;
-               ZeroMemory(szClassName,MAX_PATH);
+               ZeroMemory(szClassName, MAX_PATH);
                posX = posY = width = height = 0;
        }
        DWORD GetStyle()
        {
                DWORD style = WS_CLIPCHILDREN | WS_OVERLAPPED;
-               if(captionbar){ style |= WS_CAPTION;    }
-               if(frametype ){ style |= WS_THICKFRAME; }
-               if(systemmenu){ style |= WS_SYSMENU|WS_CAPTION;    }
-               if(minbox    ){ style |= WS_MINIMIZEBOX|WS_SYSMENU|WS_CAPTION; }
-               if(maxbox    ){ style |= WS_MAXIMIZEBOX|WS_SYSMENU|WS_CAPTION|WS_THICKFRAME; }
+               if (captionbar) { style |= WS_CAPTION; }
+               if (frametype) { style |= WS_THICKFRAME; }
+               if (systemmenu) { style |= WS_SYSMENU | WS_CAPTION; }
+               if (minbox) { style |= WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION; }
+               if (maxbox) { style |= WS_MAXIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME; }
                return style;
        }
-       inline void SetWindowPlacement(int x,int y,int w,int h)
+       inline void SetWindowPlacement(int x, int y, int w, int h)
        {
-               posX   = x;
-               posY   = y;
-               width  = w;
+               posX = x;
+               posY = y;
+               width = w;
                height = h;
        }
        inline void SetWindowClassName(LPCTSTR name)
        {
-               lstrcpy(szClassName,name);
+               StringCchCopy(szClassName, MAX_PATH, name);
        }
        TCHAR szClassName[MAX_PATH];
        DWORD wndstyle;
@@ -143,8 +142,10 @@ public:
        BOOL autoclose;
 };
 
-class ATL_NO_VTABLE COverlappedWindow : 
+class ATL_NO_VTABLE COverlappedWindow :
        public CComObjectRootEx<CComSingleThreadModel>,
+       public CComCoClass<COverlappedWindow, &CLSID_OverlappedWindow>,
+       public ISupportErrorInfoImpl<&IID_IOverlappedWindow>,
        public CStockPropImpl<COverlappedWindow, IOverlappedWindow, &IID_IOverlappedWindow, &LIBID_SERAPHYSCRIPTTOOLSLib>,
        public CComControl<COverlappedWindow>,
        public IPersistStreamInitImpl<COverlappedWindow>,
@@ -153,7 +154,6 @@ class ATL_NO_VTABLE COverlappedWindow :
        public IOleInPlaceActiveObjectImpl<COverlappedWindow>,
        public IViewObjectExImpl<COverlappedWindow>,
        public IOleInPlaceObjectWindowlessImpl<COverlappedWindow>,
-       public ISupportErrorInfo,
        public IConnectionPointContainerImpl<COverlappedWindow>,
        public IPersistStorageImpl<COverlappedWindow>,
        public ISpecifyPropertyPagesImpl<COverlappedWindow>,
@@ -161,90 +161,77 @@ class ATL_NO_VTABLE COverlappedWindow :
        public IDataObjectImpl<COverlappedWindow>,
        public IProvideClassInfo2Impl<&CLSID_OverlappedWindow, &DIID__IOverlappedWindowEvents, &LIBID_SERAPHYSCRIPTTOOLSLib>,
        public IPropertyNotifySinkCP<COverlappedWindow>,
-       public CComCoClass<COverlappedWindow, &CLSID_OverlappedWindow>,
        public CProxy_IOverlappedWindowEvents< COverlappedWindow >
 {
 public:
        COverlappedWindow();
 
-DECLARE_GET_CONTROLLING_UNKNOWN()
-DECLARE_REGISTRY_RESOURCEID(IDR_OVERLAPPEDWINDOW)
+       DECLARE_GET_CONTROLLING_UNKNOWN()
+       DECLARE_REGISTRY_RESOURCEID(IDR_OVERLAPPEDWINDOW)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(COverlappedWindow)
-       COM_INTERFACE_ENTRY(IOverlappedWindow)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(IViewObjectEx)
-       COM_INTERFACE_ENTRY(IViewObject2)
-       COM_INTERFACE_ENTRY(IViewObject)
-       COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceObject)
-       COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
-       COM_INTERFACE_ENTRY(IOleControl)
-       COM_INTERFACE_ENTRY(IOleObject)
-       COM_INTERFACE_ENTRY(IPersistStreamInit)
-       COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(IConnectionPointContainer)
-       COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
-       COM_INTERFACE_ENTRY(IQuickActivate)
-       COM_INTERFACE_ENTRY(IPersistStorage)
-       COM_INTERFACE_ENTRY(IDataObject)
-       COM_INTERFACE_ENTRY(IProvideClassInfo)
-       COM_INTERFACE_ENTRY(IProvideClassInfo2)
-       COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
-       COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
-END_COM_MAP()
+       BEGIN_COM_MAP(COverlappedWindow)
+               COM_INTERFACE_ENTRY(IOverlappedWindow)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(IViewObjectEx)
+               COM_INTERFACE_ENTRY(IViewObject2)
+               COM_INTERFACE_ENTRY(IViewObject)
+               COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
+               COM_INTERFACE_ENTRY(IOleInPlaceObject)
+               COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
+               COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
+               COM_INTERFACE_ENTRY(IOleControl)
+               COM_INTERFACE_ENTRY(IOleObject)
+               COM_INTERFACE_ENTRY(IPersistStreamInit)
+               COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+               COM_INTERFACE_ENTRY(IConnectionPointContainer)
+               COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
+               COM_INTERFACE_ENTRY(IQuickActivate)
+               COM_INTERFACE_ENTRY(IPersistStorage)
+               COM_INTERFACE_ENTRY(IDataObject)
+               COM_INTERFACE_ENTRY(IProvideClassInfo)
+               COM_INTERFACE_ENTRY(IProvideClassInfo2)
+               COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
+               COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
+       END_COM_MAP()
 
-BEGIN_PROP_MAP(COverlappedWindow)
-       PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
-       PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
-       PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
-       // Example entries
-       // PROP_ENTRY("Property Description", dispid, clsid)
-       // PROP_PAGE(CLSID_StockColorPage)
-END_PROP_MAP()
+       BEGIN_PROP_MAP(COverlappedWindow)
+               PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
+               PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
+               PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
+               // Example entries
+               // PROP_ENTRY("Property Description", dispid, clsid)
+               // PROP_PAGE(CLSID_StockColorPage)
+       END_PROP_MAP()
 
-BEGIN_CONNECTION_POINT_MAP(COverlappedWindow)
-       CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
-       CONNECTION_POINT_ENTRY(DIID__IOverlappedWindowEvents)
-END_CONNECTION_POINT_MAP()
+       BEGIN_CONNECTION_POINT_MAP(COverlappedWindow)
+               CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
+               CONNECTION_POINT_ENTRY(DIID__IOverlappedWindowEvents)
+       END_CONNECTION_POINT_MAP()
 
-BEGIN_MSG_MAP(COverlappedWindow)
-       CHAIN_MSG_MAP(CComControl<COverlappedWindow>)
-       DEFAULT_REFLECTION_HANDLER()
-END_MSG_MAP()
-// Handler prototypes:
-//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
-//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
+       BEGIN_MSG_MAP(COverlappedWindow)
+               CHAIN_MSG_MAP(CComControl<COverlappedWindow>)
+               DEFAULT_REFLECTION_HANDLER()
+       END_MSG_MAP()
+       // Handler prototypes:
+       //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+       //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+       //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
 
        HRESULT FinalConstruct();
        void FinalRelease();
-       
-       CComPtr<IUnknown> m_pUnkMarshaler;
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
-       {
-               static const IID* arr[] = 
-               {
-                       &IID_IOverlappedWindow,
-               };
-               for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
-               {
-                       if (IsEqualGUID(*arr[i], riid))
-                               return S_OK;
-               }
-               return S_FALSE;
-       }
+       CComPtr<IUnknown> m_pUnkMarshaler;
 
-// IViewObjectEx
+       // IViewObjectEx
        DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
 
-// IOverlappedWindow
+protected:
+       HRESULT ClassObjectInvoke(LPCWSTR handler);
+
+       // IOverlappedWindow
 public:
        STDMETHOD(GetClipboardText)(/*[out]*/VARIANT* pVarText);
        STDMETHOD(SetClipboardText)(/*[in]*/BSTR text);
@@ -256,7 +243,6 @@ public:
        STDMETHOD(get_innerWidth)(/*[out, retval]*/ double *pVal);
        STDMETHOD(get_ClientHeight)(/*[out, retval]*/ long *pVal);
        STDMETHOD(get_ClientWidth)(/*[out, retval]*/ long *pVal);
-       void ClassObjectInvoke(LPCWSTR handler);
        STDMETHOD(get_ClassObject)(/*[out, retval]*/ VARIANT *pVal);
        STDMETHOD(put_ClassObject)(/*[in]*/ VARIANT newVal);
        STDMETHOD(CenterWindow)();
@@ -267,14 +253,14 @@ public:
        STDMETHOD(put_ExitCode)(/*[in]*/ short newVal);
        STDMETHOD(get_Object)(/*[in,optional]*/VARIANT idx, /*[out, retval]*/ VARIANT *pVal);
        void MoveNextOverlapped();
-       void CreateWindowList(list<HWND>& lstWnd,BOOL bSearchRoot);
+       void CreateWindowList(list<HWND>& lstWnd, BOOL bSearchRoot);
        STDMETHOD(get_AutoClose)(/*[out, retval]*/ BOOL *pVal);
        STDMETHOD(put_AutoClose)(/*[in]*/ BOOL newVal);
        STDMETHOD(DoModal)(/*[out,retval]*/VARIANT* retcode);
        STDMETHOD(get_AutoMessageLoop)(/*[out, retval]*/ BOOL *pVal);
        STDMETHOD(put_AutoMessageLoop)(/*[in]*/ BOOL newVal);
-       static DWORD MessageLoop(DWORD sleeptim,int count,HWND* hWnd,HANDLE* hEvent);
-       void SetWaitParam(int* count,HWND* phWnd,HANDLE* phWaitHandle);
+       static DWORD MessageLoop(DWORD sleeptim, int count, HWND* hWnd, HANDLE* hEvent);
+       void SetWaitParam(int* count, HWND* phWnd, HANDLE* phWaitHandle);
        HANDLE GetEventHandle();
        void SetParent(HWND hParent);
        STDMETHOD(CreateChild)(/*[out,retval]*/VARIANT* pvarUnk);
@@ -298,12 +284,12 @@ public:
                RECT& rc = *(RECT*)di.prcBounds;
                Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
 
-               SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
+               SetTextAlign(di.hdcDraw, TA_CENTER | TA_BASELINE);
                LPCTSTR pszText = _T("SeraphyScriptTools.OverlappedWindow");
-               TextOut(di.hdcDraw, 
-                       (rc.left + rc.right) / 2, 
-                       (rc.top + rc.bottom) / 2, 
-                       pszText, 
+               TextOut(di.hdcDraw,
+                       (rc.left + rc.right) / 2,
+                       (rc.top + rc.bottom) / 2,
+                       pszText,
                        lstrlen(pszText));
 
                return S_OK;
@@ -368,9 +354,9 @@ protected:
        BOOL m_bAutoReleaseClassObject;
        BOOL m_bDefaultAction;
 protected:
-       static LRESULT  CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
-       void AddEvent(int message,WPARAM wParam,LPARAM lParam);
-       void AddEventSingle(int message,WPARAM wParam,LPARAM lParam);
+       static LRESULT  CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+       void AddEvent(int message, WPARAM wParam, LPARAM lParam);
+       void AddEventSingle(int message, WPARAM wParam, LPARAM lParam);
        void CreateThisInterface(VARIANT* pvarUnk);
        void SetTitle();
 protected:
@@ -389,5 +375,3 @@ protected:
        HICON m_hIcon;
        map<int, CComBSTR> m_cMenuMap;
 };
-
-#endif //__OverlappedWindow_H_
index 95908c3..4e1ba03 100644 (file)
@@ -8,20 +8,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // CPrivateProfile
 
-STDMETHODIMP CPrivateProfile::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_IPrivateProfile
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 STDMETHODIMP CPrivateProfile::get_ProfilePath(BSTR *pVal)
 {
        return m_bstr_profilepath.CopyTo(pVal);
@@ -33,28 +19,36 @@ STDMETHODIMP CPrivateProfile::put_ProfilePath(BSTR newVal)
        return S_OK;
 }
 
-STDMETHODIMP CPrivateProfile::OpenSection(VARIANT text,VARIANT* pVal)
+STDMETHODIMP CPrivateProfile::OpenSection(VARIANT text, VARIANT* pVal)
 {
        ::VariantInit(pVal);
        CComVariant varText;
-       if(varText.ChangeType(VT_BSTR,&text) != S_OK){
-               return DISP_E_TYPEMISMATCH;
+
+       HRESULT hr;
+       if (FAILED(hr = varText.ChangeType(VT_BSTR, &text))) {
+               return hr;
        }
+
        if (m_bstr_profilepath.Length() <= 0) {
-               ErrorInfo(IDS_ERR_PROFILEPATH);
-               return DISP_E_EXCEPTION;
+               return Error(IDS_ERR_PROFILEPATH);
        }
+
        CComObject<CProfileSection>* pSection = NULL;
-       pSection->CreateInstance(&pSection);
+       if (FAILED(hr = CComObject<CProfileSection>::CreateInstance(&pSection))) {
+               return hr;
+       }
        ATLASSERT(pSection);
 
        pSection->m_szProfilePath = m_bstr_profilepath;
        pSection->m_szSectionName = varText.bstrVal;
 
        IUnknown* pUnk = NULL;
-       pSection->QueryInterface(IID_IUnknown,(void**)&pUnk);
+       if (FAILED(hr = pSection->QueryInterface(IID_IUnknown, (void**)&pUnk))) {
+               return hr;
+       }
        ATLASSERT(pUnk);
-       pVal->vt      = VT_UNKNOWN;
+
+       pVal->vt = VT_UNKNOWN;
        pVal->punkVal = pUnk;
        return S_OK;
 }
index c5bef6b..33fe74d 100644 (file)
@@ -1,16 +1,15 @@
 // PrivateProfile.h : CPrivateProfile \82Ì\90é\8c¾
 
-#ifndef __PRIVATEPROFILE_H_
-#define __PRIVATEPROFILE_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 
 /////////////////////////////////////////////////////////////////////////////
 // CPrivateProfile
-class ATL_NO_VTABLE CPrivateProfile : 
+class ATL_NO_VTABLE CPrivateProfile :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CPrivateProfile, &CLSID_PrivateProfile>,
-       public ISupportErrorInfo,
+       public ISupportErrorInfoImpl<&IID_IPrivateProfile>,
        public IDispatchImpl<IPrivateProfile, &IID_IPrivateProfile, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
@@ -18,26 +17,21 @@ public:
        {
        }
 
-DECLARE_REGISTRY_RESOURCEID(IDR_PRIVATEPROFILE)
+       DECLARE_REGISTRY_RESOURCEID(IDR_PRIVATEPROFILE)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CPrivateProfile)
-       COM_INTERFACE_ENTRY(IPrivateProfile)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
+       BEGIN_COM_MAP(CPrivateProfile)
+               COM_INTERFACE_ENTRY(IPrivateProfile)
+               COM_INTERFACE_ENTRY(IDispatch)
+       END_COM_MAP()
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// IPrivateProfile
+       // IPrivateProfile
 public:
        STDMETHOD(OpenSection)(/*[in]*/VARIANT text,/*[out,retval]*/VARIANT* pVal);
        STDMETHOD(get_ProfilePath)(/*[out, retval]*/ BSTR *pVal);
        STDMETHOD(put_ProfilePath)(/*[in]*/ BSTR newVal);
+
 protected:
        CComBSTR m_bstr_profilepath;
 };
-
-#endif //__PRIVATEPROFILE_H_
index abaaaf0..8f8bfb9 100644 (file)
@@ -6,38 +6,31 @@
 /////////////////////////////////////////////////////////////////////////////
 // CProfileSection
 
-STDMETHODIMP CProfileSection::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_ISeraphyScriptTools_ProfileSection
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 STDMETHODIMP CProfileSection::get_Value(VARIANT idx, VARIANT *pVal)
 {
        ::VariantInit(pVal);
 
        ATL::CString szKeyname;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_BSTR, &idx) == S_OK){
+       if (SUCCEEDED(varIdx.ChangeType(VT_BSTR, &idx))) {
                szKeyname = varIdx.bstrVal;
        }
 
-       const int siz = 1024 * 8; // 8KBytes
-       ATL::CString buf;
-       LPTSTR szReturn = buf.GetBufferSetLength(siz);
-       if (GetPrivateProfileString(m_szSectionName, szKeyname, _TEXT(""), szReturn, siz, m_szProfilePath)) {
+       DWORD siz = 1024 * 8; // 8KBytes
+       while (siz < 10 * 1024 * 1024) { // 10MBytes\82Ü\82Å
+               ATL::CString buf;
+               LPTSTR szReturn = buf.GetBufferSetLength(siz);
+               DWORD rdsiz = GetPrivateProfileString(
+                       m_szSectionName, szKeyname, _TEXT(""), szReturn, siz, m_szProfilePath);
+               if (rdsiz >= siz - 2) {
+                       // \83o\83b\83t\83@\83I\81[\83o\81[\82µ\82Ä\82¢\82é\89Â\94\\90«\82ª\82 \82é\82½\82ß\83o\83b\83t\83@\82ð\91å\82«\82­\82µ\82Ä\8dÄ\8e\8e\8ds\82·\82é
+                       siz *= 2;
+                       continue;
+               }
                CComVariant ret(szReturn);
-               ret.Detach(pVal);
+               return ret.Detach(pVal);
        }
-       return S_OK;
+       return E_OUTOFMEMORY;
 }
 
 STDMETHODIMP CProfileSection::put_Value(VARIANT idx, VARIANT newVal)
@@ -46,91 +39,109 @@ STDMETHODIMP CProfileSection::put_Value(VARIANT idx, VARIANT newVal)
 
        ATL::CString szKeyname;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_BSTR, &idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_BSTR, &idx))) {
                szKeyname = varIdx.bstrVal;
        }
 
        ATL::CString szWrite;
        CComVariant varNew;
-       if (varNew.ChangeType(VT_BSTR, &newVal) == S_OK){
+       if (SUCCEEDED(varNew.ChangeType(VT_BSTR, &newVal))) {
                szWrite = varNew.bstrVal;
        }
 
-       WritePrivateProfileString(m_szSectionName, szKeyname, szWrite, m_szProfilePath);
+       WritePrivateProfileString(
+               m_szSectionName, szKeyname, szWrite, m_szProfilePath);
        return S_OK;
 }
 
-STDMETHODIMP CProfileSection::GetValue(VARIANT idx, VARIANT def,VARIANT* pVal)
+STDMETHODIMP CProfileSection::GetValue(VARIANT idx, VARIANT def, VARIANT* pVal)
 {
        // \83f\83B\83t\83H\83\8b\83g\82Ì\92l\82Â\82«\8eæ\93¾
        ::VariantInit(pVal);
 
        ATL::CString szKeyname;
        CComVariant varIdx;
-       if (varIdx.ChangeType(VT_BSTR, &idx) == S_OK) {
+       if (SUCCEEDED(varIdx.ChangeType(VT_BSTR, &idx))) {
                szKeyname = varIdx.bstrVal;
        }
 
        ATL::CString szDefault;
        CComVariant varDef;
-       if (varDef.ChangeType(VT_BSTR, &def) == S_OK) {
+       if (SUCCEEDED(varDef.ChangeType(VT_BSTR, &def))) {
                szDefault = varDef.bstrVal;
        }
 
-       const int siz = 1024 * 8; // 8KBytes
-       ATL::CString buf;
-       LPTSTR szReturn = buf.GetBufferSetLength(siz);
-       if (GetPrivateProfileString(m_szSectionName, szKeyname, szDefault, szReturn, siz, m_szProfilePath)) {
+       DWORD siz = 1024 * 8; // 8KBytes
+       while (siz < 10 * 1024 * 1024) { // 10MBytes\82Ü\82Å
+               ATL::CString buf;
+               LPTSTR szReturn = buf.GetBufferSetLength(siz);
+               DWORD rdsiz = GetPrivateProfileString(
+                       m_szSectionName, szKeyname, szDefault, szReturn, siz, m_szProfilePath);
+               if (rdsiz >= siz - 2) {
+                       // \83o\83b\83t\83@\83I\81[\83o\81[\82µ\82Ä\82¢\82é\89Â\94\\90«\82ª\82 \82é\82½\82ß\83o\83b\83t\83@\82ð\91å\82«\82­\82µ\82Ä\8dÄ\8e\8e\8ds\82·\82é
+                       siz *= 2;
+                       continue;
+               }
                CComVariant ret(szReturn);
-               ret.Detach(pVal);
+               return ret.Detach(pVal);
        }
-       return S_OK;
+       return E_OUTOFMEMORY;
 }
 
 STDMETHODIMP CProfileSection::GetKeyNames(VARIANT *pVal)
 {
        // \83L\81[\96¼\82Ì\97ñ\8b\93\82ð\8ds\82¤
-       DWORD siz = 4096;
        DWORD oldsiz = 0;
        DWORD retsiz = 0;
-       LPTSTR pBuf = new TCHAR[siz];
-       while ((retsiz = GetPrivateProfileSection(m_szSectionName, pBuf, siz, m_szProfilePath)) &&
-                       (retsiz == (siz - 2)) && (oldsiz != retsiz)) {
-               oldsiz = siz;
-               siz *= 2;
-               delete []pBuf;
-               pBuf = new TCHAR[siz];
+
+       ATL::CString buf;
+       LPTSTR pBuf = NULL;
+
+       DWORD siz = 4096;
+       while (siz < 10 * 1024 * 1024) { // 10MBytes\82Ü\82Å
+               pBuf = buf.GetBufferSetLength(siz);
+               DWORD rdsiz = retsiz = GetPrivateProfileSection(
+                       m_szSectionName, pBuf, siz, m_szProfilePath);
+               if (rdsiz >= siz - 2) {
+                       // \83o\83b\83t\83@\83I\81[\83o\81[\82µ\82Ä\82¢\82é\89Â\94\\90«\82ª\82 \82é\82½\82ß\83o\83b\83t\83@\82ð\91å\82«\82­\82µ\82Ä\8dÄ\8e\8e\8ds\82·\82é
+                       siz *= 2;
+                       continue;
+               }
+               break;
        }
-       // \83J\83E\83\93\83g\82·\82é
+
+       // \83_\83u\83\8b\83k\83\8b\8fI\92[\95\8e\9a\97ñ\82©\82ç\81A\83A\83C\83e\83\80\90\94\82ð\83J\83E\83\93\83g\82·\82é
        LPTSTR p = pBuf;
        long count = 0;
        while (*p) {
                count++;
                while (*p++);
        }
+
        // \88ê\8e\9f\94z\97ñ\82Ì\90\90¬
        SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT, 0, count);
        long idx = 0;
        p = pBuf;
        while (*p) {
-               CComVariant tmp;
                LPCTSTR pb = p;
                while (*p) {
                        if (*p == '=') {
+                               // \83L\81[\96¼\82¾\82¯\82É\82·\82é(value\92l\82Í\96³\8e\8b)
                                *p = 0;
                        }
                        p++;
                }
-               p++;
-               tmp = (LPCSTR)pb;
-               SafeArrayPutElement(pArray,&idx,&tmp);
-               tmp.Clear();
+               p++; // \8e\9f\82Ì\83A\83C\83e\83\80\82Ì\90æ\93ª\82É\83A\83h\83\8c\83X\82·\82é
+
+               // \83L\81[\96¼\82ð\94z\97ñ\82É\93o\98^\82·\82é.
+               CComVariant tmp(pb);
+               SafeArrayPutElement(pArray, &idx, &tmp);
                idx++;
        }
-       delete[]pBuf;
+
        // \96ß\82è\92l
        ::VariantInit(pVal);
-       pVal->vt     = VT_VARIANT | VT_ARRAY;
+       pVal->vt = VT_VARIANT | VT_ARRAY;
        pVal->parray = pArray;
        return S_OK;
 }
index 4ba515c..307e031 100644 (file)
@@ -1,16 +1,15 @@
 // ProfileSection.h : CProfileSection \82Ì\90é\8c¾
 
-#ifndef __PROFILESECTION_H_
-#define __PROFILESECTION_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 
 /////////////////////////////////////////////////////////////////////////////
 // CProfileSection
-class ATL_NO_VTABLE CProfileSection : 
+class ATL_NO_VTABLE CProfileSection :
        public CComObjectRootEx<CComSingleThreadModel>,
-//     public CComCoClass<CProfileSection, &CLSID_ProfileSection>,
-       public ISupportErrorInfo,
+       public CComCoClass<CProfileSection, &CLSID_ProfileSection>,
+       public ISupportErrorInfoImpl<&IID_ISeraphyScriptTools_ProfileSection>,
        public IDispatchImpl<ISeraphyScriptTools_ProfileSection, &IID_ISeraphyScriptTools_ProfileSection, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
@@ -18,20 +17,17 @@ public:
        {
        }
 
-DECLARE_REGISTRY_RESOURCEID(IDR_PROFILESECTION)
+       //DECLARE_REGISTRY_RESOURCEID(IDR_PROFILESECTION)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CProfileSection)
-       COM_INTERFACE_ENTRY(ISeraphyScriptTools_ProfileSection)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
+       BEGIN_COM_MAP(CProfileSection)
+               COM_INTERFACE_ENTRY(ISeraphyScriptTools_ProfileSection)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+       END_COM_MAP()
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// ISeraphyScriptTools_ProfileSection
+       // ISeraphyScriptTools_ProfileSection
 public:
        STDMETHOD(GetKeyNames)(/*[out]*/VARIANT* pVal);
        STDMETHOD(GetValue)(/*[in]*/VARIANT idx,/*[in,optional]*/VARIANT def,/*[out,retval]*/VARIANT* pVal);
@@ -40,5 +36,3 @@ public:
        ATL::CString m_szProfilePath;
        ATL::CString m_szSectionName;
 };
-
-#endif //__PROFILESECTION_H_
index dedb6e4..3d08a04 100644 (file)
 CComModule _Module;
 
 BEGIN_OBJECT_MAP(ObjectMap)
-OBJECT_ENTRY(CLSID_SeraphyScriptTools_Instance, CInstance)
-OBJECT_ENTRY(CLSID_CommDialog, CCommDialog)
-OBJECT_ENTRY(CLSID_Canvas, CCanvas)
-OBJECT_ENTRY(CLSID_OverlappedWindow, COverlappedWindow)
-OBJECT_ENTRY(CLSID_ObjectMap, CObjectMap)
-OBJECT_ENTRY(CLSID_SeraphyScriptTools_Shell, CShell)
-OBJECT_ENTRY(CLSID_ObjectVector, CObjectVector)
-//OBJECT_ENTRY(CLSID_Control, CControl)
-//OBJECT_ENTRY(CLSID_Layer, CLayer)
-//OBJECT_ENTRY(CLSID_Form, CForm)
-//OBJECT_ENTRY(CLSID_Event, CEvent)
-//OBJECT_ENTRY(CLSID_EnumSelect, CEnumSelect)
-//OBJECT_ENTRY(CLSID_TreeItem, CTreeItem)
-//OBJECT_ENTRY(CLSID_ShellExecObj, CShellExecObj)
-//OBJECT_ENTRY(CLSID_ProfileSection, CProfileSection)
-OBJECT_ENTRY(CLSID_ParseName, CParseName)
-OBJECT_ENTRY(CLSID_PrivateProfile, CPrivateProfile)
+       OBJECT_ENTRY(CLSID_SeraphyScriptTools_Instance, CInstance)
+       OBJECT_ENTRY(CLSID_CommDialog, CCommDialog)
+       OBJECT_ENTRY(CLSID_Canvas, CCanvas)
+       OBJECT_ENTRY(CLSID_OverlappedWindow, COverlappedWindow)
+       OBJECT_ENTRY(CLSID_ObjectMap, CObjectMap)
+       OBJECT_ENTRY(CLSID_SeraphyScriptTools_Shell, CShell)
+       OBJECT_ENTRY(CLSID_ObjectVector, CObjectVector)
+       //OBJECT_ENTRY(CLSID_Control, CControl)
+       //OBJECT_ENTRY(CLSID_Layer, CLayer)
+       //OBJECT_ENTRY(CLSID_Form, CForm)
+       //OBJECT_ENTRY(CLSID_Event, CEvent)
+       //OBJECT_ENTRY(CLSID_EnumSelect, CEnumSelect)
+       //OBJECT_ENTRY(CLSID_TreeItem, CTreeItem)
+       //OBJECT_ENTRY(CLSID_ShellExecObj, CShellExecObj)
+       //OBJECT_ENTRY(CLSID_ProfileSection, CProfileSection)
+       OBJECT_ENTRY(CLSID_ParseName, CParseName)
+       OBJECT_ENTRY(CLSID_PrivateProfile, CPrivateProfile)
 END_OBJECT_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -55,17 +55,16 @@ END_OBJECT_MAP()
 extern "C"
 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
 {
-    if (dwReason == DLL_PROCESS_ATTACH)
-    {
+       if (dwReason == DLL_PROCESS_ATTACH) {
                // \83R\83\82\83\93\83R\83\93\83g\83\8d\81[\83\8b\82Ì\83N\83\89\83X\96¼\82ð\93o\98^\82·\82é
                InitCommonControls();
                //
-        _Module.Init(ObjectMap, hInstance, &LIBID_SERAPHYSCRIPTTOOLSLib);
-        DisableThreadLibraryCalls(hInstance);
-    }
-    else if (dwReason == DLL_PROCESS_DETACH)
-        _Module.Term();
-    return TRUE;    // ok
+               _Module.Init(ObjectMap, hInstance, &LIBID_SERAPHYSCRIPTTOOLSLib);
+               DisableThreadLibraryCalls(hInstance);
+       }
+       else if (dwReason == DLL_PROCESS_DETACH)
+               _Module.Term();
+       return TRUE;    // ok
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -73,7 +72,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
 
 STDAPI DllCanUnloadNow(void)
 {
-    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
+       return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE;
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -81,7 +80,7 @@ STDAPI DllCanUnloadNow(void)
 
 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
 {
-    return _Module.GetClassObject(rclsid, riid, ppv);
+       return _Module.GetClassObject(rclsid, riid, ppv);
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -89,8 +88,8 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
 
 STDAPI DllRegisterServer(void)
 {
-    // \83I\83u\83W\83F\83N\83g\81A\83^\83C\83v\83\89\83C\83u\83\89\83\8a\82¨\82æ\82Ñ\83^\83C\83v\83\89\83C\83u\83\89\83\8a\93à\82Ì\91S\82Ä\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\93o\98^\82µ\82Ü\82·
-    return _Module.RegisterServer(TRUE);
+       // \83I\83u\83W\83F\83N\83g\81A\83^\83C\83v\83\89\83C\83u\83\89\83\8a\82¨\82æ\82Ñ\83^\83C\83v\83\89\83C\83u\83\89\83\8a\93à\82Ì\91S\82Ä\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82ð\93o\98^\82µ\82Ü\82·
+       return _Module.RegisterServer(TRUE);
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -98,7 +97,7 @@ STDAPI DllRegisterServer(void)
 
 STDAPI DllUnregisterServer(void)
 {
-    return _Module.UnregisterServer(TRUE);
+       return _Module.UnregisterServer(TRUE);
 }
 
 
index 224ce5a..1917926 100644 (file)
@@ -4,10 +4,10 @@
 
 
  /* File created by MIDL compiler version 8.00.0603 */
-/* at Sat Jul 25 10:10:02 2015
+/* at Sun Aug 16 18:41:49 2015
  */
 /* Compiler settings for SeraphyScriptTools.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603 
+    Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.00.0603 
     protocol : dce , ms_ext, c_ext, robust
     error checks: allocation ref bounds_check enum stub_data 
     VC __declspec() decoration level: 
@@ -4964,10 +4964,10 @@ EXTERN_C const IID IID_ISeraphyScriptTools_Instance;
             /* [retval][out] */ BOOL *pVal) = 0;
         
         virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MousePosX( 
-            /* [retval][out] */ short *pVal) = 0;
+            /* [retval][out] */ long *pVal) = 0;
         
         virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MousePosY( 
-            /* [retval][out] */ short *pVal) = 0;
+            /* [retval][out] */ long *pVal) = 0;
         
         virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Version( 
             /* [retval][out] */ double *pVal) = 0;
@@ -5070,11 +5070,11 @@ EXTERN_C const IID IID_ISeraphyScriptTools_Instance;
         
         /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MousePosX )( 
             ISeraphyScriptTools_Instance * This,
-            /* [retval][out] */ short *pVal);
+            /* [retval][out] */ long *pVal);
         
         /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MousePosY )( 
             ISeraphyScriptTools_Instance * This,
-            /* [retval][out] */ short *pVal);
+            /* [retval][out] */ long *pVal);
         
         /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Version )( 
             ISeraphyScriptTools_Instance * This,
index 6724c39..084cb23 100644 (file)
@@ -7,47 +7,47 @@
 import "oaidl.idl";
 import "ocidl.idl";
 #include "olectl.h"
-       
 
-       [
-               object,
-               uuid(112D2DFC-DC6E-4EEB-B7AE-9A29C293090B),
-               dual,
-               helpstring("ICommDialog Interface"),
-               pointer_default(unique)
-       ]
-       interface ICommDialog : IDispatch
-       {
-               [propget, id(10), helpstring("ÌßÛÊßè OpenFileCaption")] HRESULT OpenFileCaption([out, retval] BSTR *pVal);
-               [propput, id(10), helpstring("ÌßÛÊßè OpenFileCaption")] HRESULT OpenFileCaption([in] BSTR newVal);
-               [propget, id(11), helpstring("ÌßÛÊßè SaveFileCaption")] HRESULT SaveFileCaption([out, retval] BSTR *pVal);
-               [propput, id(11), helpstring("ÌßÛÊßè SaveFileCaption")] HRESULT SaveFileCaption([in] BSTR newVal);
-               [propget, id(12), helpstring("ÌßÛÊßè EnableCreatePrompt")] HRESULT EnableCreatePrompt([out, retval] BOOL *pVal);
-               [propput, id(12), helpstring("ÌßÛÊßè EnableCreatePrompt")] HRESULT EnableCreatePrompt([in] BOOL newVal);
-               [propget, id(13), helpstring("ÌßÛÊßè EnableReadOnly")] HRESULT EnableReadOnly([out, retval] BOOL *pVal);
-               [propput, id(13), helpstring("ÌßÛÊßè EnableReadOnly")] HRESULT EnableReadOnly([in] BOOL newVal);
-               [propget, id(14), helpstring("ÌßÛÊßè ReadOnly")] HRESULT ReadOnly([out, retval] BOOL *pVal);
-               [propput, id(14), helpstring("ÌßÛÊßè ReadOnly")] HRESULT ReadOnly([in] BOOL newVal);
-               [propget, id(15), helpstring("ÌßÛÊßè NoDereferenceLinks")] HRESULT NoDereferenceLinks([out, retval] BOOL *pVal);
-               [propput, id(15), helpstring("ÌßÛÊßè NoDereferenceLinks")] HRESULT NoDereferenceLinks([in] BOOL newVal);
-               [propget, id(16), helpstring("ÌßÛÊßè InitialDir")] HRESULT InitialDir([out, retval] BSTR *pVal);
-               [propput, id(16), helpstring("ÌßÛÊßè InitialDir")] HRESULT InitialDir([in] BSTR newVal);
-               [propget, id(17), helpstring("ÌßÛÊßè HWND"),hidden] HRESULT HWND([out, retval] long *pVal);
-               [propput, id(17), helpstring("ÌßÛÊßè HWND"),hidden] HRESULT HWND([in] long newVal);
-               [propget, id(18), helpstring("ÌßÛÊßè BrowseForFolderCaption")] HRESULT BrowseForFolderCaption([out, retval] BSTR *pVal);
-               [propput, id(18), helpstring("ÌßÛÊßè BrowseForFolderCaption")] HRESULT BrowseForFolderCaption([in] BSTR newVal);
-               [propget, id(19), helpstring("ÌßÛÊßè MessageCaption")] HRESULT MessageCaption([out, retval] BSTR *pVal);
-               [propput, id(19), helpstring("ÌßÛÊßè MessageCaption")] HRESULT MessageCaption([in] BSTR newVal);
-               [id(20), helpstring("Ò¿¯ÄÞ ColorDialog")] HRESULT ColorDialog([out,retval]VARIANT* pcolorVal);
-               [propput, id(DISPID_CAPTION)] HRESULT Caption([in]BSTR strCaption);
-               [propget, id(DISPID_CAPTION)] HRESULT Caption([out,retval]BSTR* pstrCaption);
-               [id(1), helpstring("Ò¿¯ÄÞ SetMainWindow")] HRESULT SetMainWindow([in]VARIANT varUnk);
-               [id(2), helpstring("Ò¿¯ÄÞ OpenFileDialog")] HRESULT OpenFileDialog([in,optional]VARIANT varPathName,[in,optional]VARIANT varFilter,[out,retval]VARIANT* result);
-               [id(3), helpstring("Ò¿¯ÄÞ SaveFileDialog")] HRESULT SaveFileDialog([in,optional]VARIANT varPathName,[in,optional]VARIANT varFilter,[out,retval]VARIANT* result);
-               [id(4), helpstring("Ò¿¯ÄÞ MultiOpenFileDialog")] HRESULT MultiOpenFileDialog([in,optional]VARIANT varMulti,[in,optional]VARIANT varFilter,[out,retval]VARIANT* pbResult);
-               [id(5), helpstring("Ò¿¯ÄÞ BrowseForFolder")] HRESULT BrowseForFolder([in,optional]VARIANT caption,[in,optional]VARIANT varDir,[in,optional]VARIANT varMode,[out,retval]VARIANT* pvarReturn);
-               [id(6), helpstring("Ò¿¯ÄÞ MessageBox")] HRESULT MessageBox([in]VARIANT mes,[in,optional]VARIANT typ,[in,optional]VARIANT icon,[out,retval]VARIANT* pRet);
-       };
+
+[
+       object,
+       uuid(112D2DFC-DC6E-4EEB-B7AE-9A29C293090B),
+       dual,
+       helpstring("ICommDialog Interface"),
+       pointer_default(unique)
+]
+interface ICommDialog : IDispatch
+{
+       [propget, id(10), helpstring("ÌßÛÊßè OpenFileCaption")] HRESULT OpenFileCaption([out, retval] BSTR *pVal);
+       [propput, id(10), helpstring("ÌßÛÊßè OpenFileCaption")] HRESULT OpenFileCaption([in] BSTR newVal);
+       [propget, id(11), helpstring("ÌßÛÊßè SaveFileCaption")] HRESULT SaveFileCaption([out, retval] BSTR *pVal);
+       [propput, id(11), helpstring("ÌßÛÊßè SaveFileCaption")] HRESULT SaveFileCaption([in] BSTR newVal);
+       [propget, id(12), helpstring("ÌßÛÊßè EnableCreatePrompt")] HRESULT EnableCreatePrompt([out, retval] BOOL *pVal);
+       [propput, id(12), helpstring("ÌßÛÊßè EnableCreatePrompt")] HRESULT EnableCreatePrompt([in] BOOL newVal);
+       [propget, id(13), helpstring("ÌßÛÊßè EnableReadOnly")] HRESULT EnableReadOnly([out, retval] BOOL *pVal);
+       [propput, id(13), helpstring("ÌßÛÊßè EnableReadOnly")] HRESULT EnableReadOnly([in] BOOL newVal);
+       [propget, id(14), helpstring("ÌßÛÊßè ReadOnly")] HRESULT ReadOnly([out, retval] BOOL *pVal);
+       [propput, id(14), helpstring("ÌßÛÊßè ReadOnly")] HRESULT ReadOnly([in] BOOL newVal);
+       [propget, id(15), helpstring("ÌßÛÊßè NoDereferenceLinks")] HRESULT NoDereferenceLinks([out, retval] BOOL *pVal);
+       [propput, id(15), helpstring("ÌßÛÊßè NoDereferenceLinks")] HRESULT NoDereferenceLinks([in] BOOL newVal);
+       [propget, id(16), helpstring("ÌßÛÊßè InitialDir")] HRESULT InitialDir([out, retval] BSTR *pVal);
+       [propput, id(16), helpstring("ÌßÛÊßè InitialDir")] HRESULT InitialDir([in] BSTR newVal);
+       [propget, id(17), helpstring("ÌßÛÊßè HWND"), hidden] HRESULT HWND([out, retval] long *pVal);
+       [propput, id(17), helpstring("ÌßÛÊßè HWND"), hidden] HRESULT HWND([in] long newVal);
+       [propget, id(18), helpstring("ÌßÛÊßè BrowseForFolderCaption")] HRESULT BrowseForFolderCaption([out, retval] BSTR *pVal);
+       [propput, id(18), helpstring("ÌßÛÊßè BrowseForFolderCaption")] HRESULT BrowseForFolderCaption([in] BSTR newVal);
+       [propget, id(19), helpstring("ÌßÛÊßè MessageCaption")] HRESULT MessageCaption([out, retval] BSTR *pVal);
+       [propput, id(19), helpstring("ÌßÛÊßè MessageCaption")] HRESULT MessageCaption([in] BSTR newVal);
+       [id(20), helpstring("Ò¿¯ÄÞ ColorDialog")] HRESULT ColorDialog([out, retval]VARIANT* pcolorVal);
+       [propput, id(DISPID_CAPTION)] HRESULT Caption([in]BSTR strCaption);
+       [propget, id(DISPID_CAPTION)] HRESULT Caption([out, retval]BSTR* pstrCaption);
+       [id(1), helpstring("Ò¿¯ÄÞ SetMainWindow")] HRESULT SetMainWindow([in]VARIANT varUnk);
+       [id(2), helpstring("Ò¿¯ÄÞ OpenFileDialog")] HRESULT OpenFileDialog([in, optional]VARIANT varPathName, [in, optional]VARIANT varFilter, [out, retval]VARIANT* result);
+       [id(3), helpstring("Ò¿¯ÄÞ SaveFileDialog")] HRESULT SaveFileDialog([in, optional]VARIANT varPathName, [in, optional]VARIANT varFilter, [out, retval]VARIANT* result);
+       [id(4), helpstring("Ò¿¯ÄÞ MultiOpenFileDialog")] HRESULT MultiOpenFileDialog([in, optional]VARIANT varMulti, [in, optional]VARIANT varFilter, [out, retval]VARIANT* pbResult);
+       [id(5), helpstring("Ò¿¯ÄÞ BrowseForFolder")] HRESULT BrowseForFolder([in, optional]VARIANT caption, [in, optional]VARIANT varDir, [in, optional]VARIANT varMode, [out, retval]VARIANT* pvarReturn);
+       [id(6), helpstring("Ò¿¯ÄÞ MessageBox")] HRESULT MessageBox([in]VARIANT mes, [in, optional]VARIANT typ, [in, optional]VARIANT icon, [out, retval]VARIANT* pRet);
+};
 
 [
        uuid(806A3FFF-0A01-4366-8B16-781BDF9B5604),
@@ -65,10 +65,10 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _ICommDialogEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
-       
+
 
        [
                object,
@@ -80,8 +80,8 @@ library SERAPHYSCRIPTTOOLSLib
        interface IOverlappedWindow : IDispatch
        {
                [propget, id(40), helpstring("ÌßÛÊßè IsEventEmpty")] HRESULT IsEventEmpty([out, retval] BOOL *pVal);
-               [propget, id(41), helpstring("ÌßÛÊßè DoubleBuffer"),hidden] HRESULT DoubleBuffer([out, retval] BOOL *pVal);
-               [propput, id(41), helpstring("ÌßÛÊßè DoubleBuffer"),hidden] HRESULT DoubleBuffer([in] BOOL newVal);
+               [propget, id(41), helpstring("ÌßÛÊßè DoubleBuffer"), hidden] HRESULT DoubleBuffer([out, retval] BOOL *pVal);
+               [propput, id(41), helpstring("ÌßÛÊßè DoubleBuffer"), hidden] HRESULT DoubleBuffer([in] BOOL newVal);
                [propput, id(42), helpstring("ÌßÛÊßè CreateNoCloseWindow")] HRESULT CreateNoCloseWindow([in] BOOL newVal);
                [propget, id(42), helpstring("ÌßÛÊßè CreateNoCloseWindow")] HRESULT CreateNoCloseWindow([out, retval] BOOL *pVal);
                [propget, id(43), helpstring("ÌßÛÊßè Quit")] HRESULT Quit([out, retval] BOOL *pVal);
@@ -117,14 +117,14 @@ library SERAPHYSCRIPTTOOLSLib
                [propput, id(59), helpstring("ÌßÛÊßè Zoomed")] HRESULT Zoomed([in] BOOL newVal);
                [propget, id(60), helpstring("ÌßÛÊßè Visible")] HRESULT Visible([out, retval] BOOL *pVal);
                [propput, id(60), helpstring("ÌßÛÊßè Visible")] HRESULT Visible([in] BOOL newVal);
-               [propget, id(61), helpstring("ÌßÛÊßè HWND"),hidden] HRESULT HWND([out, retval] long *pVal);
+               [propget, id(61), helpstring("ÌßÛÊßè HWND"), hidden] HRESULT HWND([out, retval] long *pVal);
                [propget, id(62), helpstring("ÌßÛÊßè DropFiles")] HRESULT DropFiles([out, retval] VARIANT *pVal);
                [propget, id(70), helpstring("ÌßÛÊßè Canvas")] HRESULT Canvas([out, retval] VARIANT *pVal);
                [propget, id(71), helpstring("ÌßÛÊßè Event")] HRESULT Event([out, retval] VARIANT *pVal);
                [propget, id(72), helpstring("ÌßÛÊßè Form")] HRESULT Form([out, retval] VARIANT *pVal);
                [propput, id(DISPID_CAPTION)] HRESULT Caption([in]BSTR strCaption);
-               [propget, id(DISPID_CAPTION)] HRESULT Caption([out,retval]BSTR* pstrCaption);
-               [propget, id(80), helpstring("ÌßÛÊßè Object")] HRESULT Object([in,optional]VARIANT idx, [out, retval] VARIANT *pVal);
+               [propget, id(DISPID_CAPTION)] HRESULT Caption([out, retval]BSTR* pstrCaption);
+               [propget, id(80), helpstring("ÌßÛÊßè Object")] HRESULT Object([in, optional]VARIANT idx, [out, retval] VARIANT *pVal);
                [propget, id(81), helpstring("ÌßÛÊßè ExitCode")] HRESULT ExitCode([out, retval] short *pVal);
                [propput, id(81), helpstring("ÌßÛÊßè ExitCode")] HRESULT ExitCode([in] short newVal);
                [propget, id(82), helpstring("ÌßÛÊßè WaitCursor")] HRESULT WaitCursor([out, retval] short *pVal);
@@ -142,25 +142,25 @@ library SERAPHYSCRIPTTOOLSLib
                [propget, id(91), helpstring("ÌßÛÊßè DefaultAction")] HRESULT DefaultAction([out, retval] BOOL *pVal);
                [propput, id(91), helpstring("ÌßÛÊßè DefaultAction")] HRESULT DefaultAction([in] BOOL newVal);
                [id(92), helpstring("Ò¿¯ÄÞ SetClipboardText")] HRESULT SetClipboardText([in]BSTR text);
-               [id(93), helpstring("Ò¿¯ÄÞ GetClipboardText")] HRESULT GetClipboardText([out,retval]VARIANT* pVarText);
-               [id(1), helpstring("Ò¿¯ÄÞ WaitEvent")] HRESULT WaitEvent([in,optional]VARIANT varTim,[out,retval]BOOL* pRet);
-               [id(2), helpstring("Ò¿¯ÄÞ DoEvent"),hidden] HRESULT DoEvent([out,retval]VARIANT* varResult);
-               [id(3), helpstring("Ò¿¯ÄÞ DoModal")] HRESULT DoModal([out,retval]VARIANT* pRetcode);
-               [id(4), helpstring("Ò¿¯ÄÞ CreateChild")] HRESULT CreateChild([out,retval]VARIANT* pvarUnk);
-               [id(5), helpstring("Ò¿¯ÄÞ Open")] HRESULT Open([in,optional]VARIANT caption,[out,retval]VARIANT* pvarUnk);
+               [id(93), helpstring("Ò¿¯ÄÞ GetClipboardText")] HRESULT GetClipboardText([out, retval]VARIANT* pVarText);
+               [id(1), helpstring("Ò¿¯ÄÞ WaitEvent")] HRESULT WaitEvent([in, optional]VARIANT varTim, [out, retval]BOOL* pRet);
+               [id(2), helpstring("Ò¿¯ÄÞ DoEvent"), hidden] HRESULT DoEvent([out, retval]VARIANT* varResult);
+               [id(3), helpstring("Ò¿¯ÄÞ DoModal")] HRESULT DoModal([out, retval]VARIANT* pRetcode);
+               [id(4), helpstring("Ò¿¯ÄÞ CreateChild")] HRESULT CreateChild([out, retval]VARIANT* pvarUnk);
+               [id(5), helpstring("Ò¿¯ÄÞ Open")] HRESULT Open([in, optional]VARIANT caption, [out, retval]VARIANT* pvarUnk);
                [id(6), helpstring("Ò¿¯ÄÞ Close")] HRESULT Close();
-               [id(7), helpstring("Ò¿¯ÄÞ SetPlacement")] HRESULT SetPlacement([in,optional]VARIANT x,[in,optional]VARIANT y,[in,optional]VARIANT w,[in,optional]VARIANT h,[out,retval]VARIANT* pvarUnk);
-               [id(8), helpstring("Ò¿¯ÄÞ SetWindowStyle")] HRESULT SetWindowStyle([in]VARIANT frametype,[in,optional]VARIANT caption_system,[in,optional]VARIANT maxmin,[out,retval]VARIANT* pvarUnk);
+               [id(7), helpstring("Ò¿¯ÄÞ SetPlacement")] HRESULT SetPlacement([in, optional]VARIANT x, [in, optional]VARIANT y, [in, optional]VARIANT w, [in, optional]VARIANT h, [out, retval]VARIANT* pvarUnk);
+               [id(8), helpstring("Ò¿¯ÄÞ SetWindowStyle")] HRESULT SetWindowStyle([in]VARIANT frametype, [in, optional]VARIANT caption_system, [in, optional]VARIANT maxmin, [out, retval]VARIANT* pvarUnk);
                [id(9), helpstring("Ò¿¯ÄÞ SetFocus")] HRESULT SetFocus();
                [id(10), helpstring("Ò¿¯ÄÞ SetMenu")] HRESULT SetMenu([in]VARIANT fmt);
                [id(11), helpstring("Ò¿¯ÄÞ SetForegroundWindow")] HRESULT SetForegroundWindow();
-               [id(12), helpstring("Ò¿¯ÄÞ TrackPopupMenu")] HRESULT TrackPopupMenu([in]VARIANT text,[in,optional]VARIANT cmd,[out,retval]VARIANT* pRet);
-               [id(13), helpstring("Ò¿¯ÄÞ CheckMenu")] HRESULT CheckMenu([in]VARIANT cmd,[in]VARIANT mode);
-               [id(14), helpstring("Ò¿¯ÄÞ EnableMenu")] HRESULT EnableMenu([in]VARIANT cmd,[in]VARIANT mode);
+               [id(12), helpstring("Ò¿¯ÄÞ TrackPopupMenu")] HRESULT TrackPopupMenu([in]VARIANT text, [in, optional]VARIANT cmd, [out, retval]VARIANT* pRet);
+               [id(13), helpstring("Ò¿¯ÄÞ CheckMenu")] HRESULT CheckMenu([in]VARIANT cmd, [in]VARIANT mode);
+               [id(14), helpstring("Ò¿¯ÄÞ EnableMenu")] HRESULT EnableMenu([in]VARIANT cmd, [in]VARIANT mode);
                [id(15), helpstring("Ò¿¯ÄÞ Refresh")] HRESULT Refresh();
                [id(16), helpstring("Ò¿¯ÄÞ Draw")] HRESULT Draw();
-               [id(17), helpstring("Ò¿¯ÄÞ SetTimer")] HRESULT SetTimer([in]VARIANT tim,[out,retval]BOOL* pVal);
-               [id(18), helpstring("Ò¿¯ÄÞ GetSysColor")] HRESULT GetSysColor([in]VARIANT typ,[out,retval]VARIANT* col);
+               [id(17), helpstring("Ò¿¯ÄÞ SetTimer")] HRESULT SetTimer([in]VARIANT tim, [out, retval]BOOL* pVal);
+               [id(18), helpstring("Ò¿¯ÄÞ GetSysColor")] HRESULT GetSysColor([in]VARIANT typ, [out, retval]VARIANT* col);
        };
 
        [
@@ -178,8 +178,8 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _IOverlappedWindowEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
                [id(10), helpstring("Ò¿¯ÄÞ OnClick")] HRESULT OnClick();
                [id(11), helpstring("Ò¿¯ÄÞ OnRClick")] HRESULT OnRClick();
                [id(12), helpstring("Ò¿¯ÄÞ OnDblClick")] HRESULT OnDblClick();
@@ -257,7 +257,7 @@ library SERAPHYSCRIPTTOOLSLib
                [propget, id(11), helpstring("ÌßÛÊßè Exstyle")] HRESULT Exstyle([out, retval] long *pVal);
                [propput, id(11), helpstring("ÌßÛÊßè Exstyle")] HRESULT Exstyle([in] long newVal);
                [propget, id(12), helpstring("ÌßÛÊßè ClassName")] HRESULT ClassName([out, retval] BSTR *pVal);
-               [propget, id(13), helpstring("ÌßÛÊßè HWND"),hidden] HRESULT HWND([out, retval] long *pVal);
+               [propget, id(13), helpstring("ÌßÛÊßè HWND"), hidden] HRESULT HWND([out, retval] long *pVal);
                [propget, id(23), helpstring("ÌßÛÊßè CurrentSelectedItem")] HRESULT CurrentSelectedItem([out, retval] VARIANT *pVal);
                [propput, id(23), helpstring("ÌßÛÊßè CurrentSelectedItem")] HRESULT CurrentSelectedItem([in] VARIANT newVal);
                [propget, id(24), helpstring("ÌßÛÊßè ItemSelectState")] HRESULT ItemSelectState([in]VARIANT idx, [out, retval] VARIANT *pVal);
@@ -271,18 +271,18 @@ library SERAPHYSCRIPTTOOLSLib
                [id(30), helpstring("Ò¿¯ÄÞ DeleteSelectedItem")] HRESULT DeleteSelectedItem();
                [propget, id(31), helpstring("ÌßÛÊßè ItemText")] HRESULT ItemText([in]VARIANT idx, [out, retval] BSTR *pVal);
                [propput, id(31), helpstring("ÌßÛÊßè ItemText")] HRESULT ItemText([in]VARIANT idx, [in] BSTR newVal);
-               [id(32), helpstring("Ò¿¯ÄÞ SetClassEvent")] HRESULT SetClassEvent([in]BSTR name,[out,retval]VARIANT* pvarUnk);
-               [id(33), helpstring("Ò¿¯ÄÞ CreateChild")] HRESULT CreateChild([in]VARIANT text,[in]VARIANT varItem,[out,retval]VARIANT* pvarUnk);
+               [id(32), helpstring("Ò¿¯ÄÞ SetClassEvent")] HRESULT SetClassEvent([in]BSTR name, [out, retval]VARIANT* pvarUnk);
+               [id(33), helpstring("Ò¿¯ÄÞ CreateChild")] HRESULT CreateChild([in]VARIANT text, [in]VARIANT varItem, [out, retval]VARIANT* pvarUnk);
                [propget, id(DISPID_NEWENUM), helpstring("ÌßÛÊßè _NewEnum")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
                [id(14), helpstring("Ò¿¯ÄÞ Refresh")] HRESULT Refresh();
-               [id(15), helpstring("Ò¿¯ÄÞ SetPlacement")] HRESULT SetPlacement([in,optional]VARIANT x,[in,optional]VARIANT y,[in,optional]VARIANT w,[in,optional]VARIANT h,[out,retval]VARIANT* pvarUnk);
-               [id(16), helpstring("Ò¿¯ÄÞ SetCheck")] HRESULT SetCheck([out,retval]VARIANT* pvarUnk);
-               [id(17), helpstring("Ò¿¯ÄÞ SetID")] HRESULT SetID([in]VARIANT varID,[out,retval]VARIANT* pvarUnk);
-               [id(18), helpstring("Ò¿¯ÄÞ AddString")] HRESULT AddString([in]VARIANT text,[out,retval]VARIANT* pRet);
-               [id(19), helpstring("Ò¿¯ÄÞ SetColumnText")] HRESULT SetColumnText([in]VARIANT item,[in]VARIANT col,[in]VARIANT text);
-               [id(20), helpstring("Ò¿¯ÄÞ GetColumnText")] HRESULT GetColumnText([in]VARIANT idx,[in]VARIANT col,[out,retval]VARIANT* pText);
-               [id(21), helpstring("Ò¿¯ÄÞ DeleteString")] HRESULT DeleteString([in]VARIANT idx,[out,retval]VARIANT* pRet);
-               [id(22), helpstring("Ò¿¯ÄÞ GetCount")] HRESULT GetCount([out,retval]VARIANT* pRet);
+               [id(15), helpstring("Ò¿¯ÄÞ SetPlacement")] HRESULT SetPlacement([in, optional]VARIANT x, [in, optional]VARIANT y, [in, optional]VARIANT w, [in, optional]VARIANT h, [out, retval]VARIANT* pvarUnk);
+               [id(16), helpstring("Ò¿¯ÄÞ SetCheck")] HRESULT SetCheck([out, retval]VARIANT* pvarUnk);
+               [id(17), helpstring("Ò¿¯ÄÞ SetID")] HRESULT SetID([in]VARIANT varID, [out, retval]VARIANT* pvarUnk);
+               [id(18), helpstring("Ò¿¯ÄÞ AddString")] HRESULT AddString([in]VARIANT text, [out, retval]VARIANT* pRet);
+               [id(19), helpstring("Ò¿¯ÄÞ SetColumnText")] HRESULT SetColumnText([in]VARIANT item, [in]VARIANT col, [in]VARIANT text);
+               [id(20), helpstring("Ò¿¯ÄÞ GetColumnText")] HRESULT GetColumnText([in]VARIANT idx, [in]VARIANT col, [out, retval]VARIANT* pText);
+               [id(21), helpstring("Ò¿¯ÄÞ DeleteString")] HRESULT DeleteString([in]VARIANT idx, [out, retval]VARIANT* pRet);
+               [id(22), helpstring("Ò¿¯ÄÞ GetCount")] HRESULT GetCount([out, retval]VARIANT* pRet);
        };
 
        [
@@ -300,8 +300,8 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _IControlEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
        [
                object,
@@ -318,9 +318,9 @@ library SERAPHYSCRIPTTOOLSLib
                [propget, id(3), helpstring("ÌßÛÊßè MarginHeight")] HRESULT MarginHeight([out, retval] long *pVal);
                [propput, id(3), helpstring("ÌßÛÊßè MarginHeight")] HRESULT MarginHeight([in] long newVal);
                [id(10), helpstring("Ò¿¯ÄÞ Print")] HRESULT Print();
-               [id(11), helpstring("Ò¿¯ÄÞ PrintAs")] HRESULT PrintAs([in,optional]VARIANT print,[out,retval]VARIANT *pRet);
-               [id(12), helpstring("Ò¿¯ÄÞ GetPrinterDefault")] HRESULT GetPrinterDefault([in,optional]VARIANT name);
-               [id(13), helpstring("Ò¿¯ÄÞ LoadPicture")] HRESULT LoadPicture([in]VARIANT path,[out,retval]VARIANT* punkVal);
+               [id(11), helpstring("Ò¿¯ÄÞ PrintAs")] HRESULT PrintAs([in, optional]VARIANT print, [out, retval]VARIANT *pRet);
+               [id(12), helpstring("Ò¿¯ÄÞ GetPrinterDefault")] HRESULT GetPrinterDefault([in, optional]VARIANT name);
+               [id(13), helpstring("Ò¿¯ÄÞ LoadPicture")] HRESULT LoadPicture([in]VARIANT path, [out, retval]VARIANT* punkVal);
        };
 
        [
@@ -339,8 +339,8 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _ICanvasEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
        [
                object,
@@ -364,18 +364,18 @@ library SERAPHYSCRIPTTOOLSLib
                [propget, id(6), helpstring("ÌßÛÊßè Visible")] HRESULT Visible([out, retval] BOOL *pVal);
                [propput, id(6), helpstring("ÌßÛÊßè Visible")] HRESULT Visible([in] BOOL newVal);
                [id(10), helpstring("Ò¿¯ÄÞ Clear")] HRESULT Clear();
-               [id(11), helpstring("Ò¿¯ÄÞ Circle")] HRESULT Circle([in]VARIANT x,[in]VARIANT y,[in]VARIANT radius);
-               [id(12), helpstring("Ò¿¯ÄÞ Line")] HRESULT Line([in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey);
-               [id(13), helpstring("Ò¿¯ÄÞ Box")] HRESULT Box([in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey);
-               [id(14), helpstring("Ò¿¯ÄÞ Arc")] HRESULT Arc([in]VARIANT x1,[in]VARIANT y1,[in]VARIANT x2,[in]VARIANT y2,[in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey);
-               [id(15), helpstring("Ò¿¯ÄÞ FillBox")] HRESULT FillBox([in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey);
-               [id(16), helpstring("Ò¿¯ÄÞ FillCircle")] HRESULT FillCircle([in]VARIANT x,[in]VARIANT y,[in]VARIANT radius);
-               [id(17), helpstring("Ò¿¯ÄÞ FillArc")] HRESULT FillArc([in]VARIANT x1,[in]VARIANT y1,[in]VARIANT x2,[in]VARIANT y2,[in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey);
-               [id(18), helpstring("Ò¿¯ÄÞ Text")] HRESULT Text([in]VARIANT x,[in]VARIANT y,[in]VARIANT text);
-               [id(19), helpstring("Ò¿¯ÄÞ TextBox")] HRESULT TextBox([in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey,[in]VARIANT text,[in,optional]VARIANT fmt);
-               [id(20), helpstring("Ò¿¯ÄÞ FillRBox")] HRESULT FillRBox([in]VARIANT sx,[in]VARIANT sy,[in]VARIANT ex,[in]VARIANT ey,[in]VARIANT w,[in]VARIANT h);
-               [id(21), helpstring("Ò¿¯ÄÞ Polygon")] HRESULT Polygon([in]VARIANT cx,[in]VARIANT cy,[in]VARIANT arrayPt);
-               [id(22), helpstring("Ò¿¯ÄÞ Picture")] HRESULT Picture([in]VARIANT idx,[in]VARIANT x,[in]VARIANT y,[in,optional]VARIANT w,[in,optional]VARIANT h);
+               [id(11), helpstring("Ò¿¯ÄÞ Circle")] HRESULT Circle([in]VARIANT x, [in]VARIANT y, [in]VARIANT radius);
+               [id(12), helpstring("Ò¿¯ÄÞ Line")] HRESULT Line([in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey);
+               [id(13), helpstring("Ò¿¯ÄÞ Box")] HRESULT Box([in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey);
+               [id(14), helpstring("Ò¿¯ÄÞ Arc")] HRESULT Arc([in]VARIANT x1, [in]VARIANT y1, [in]VARIANT x2, [in]VARIANT y2, [in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey);
+               [id(15), helpstring("Ò¿¯ÄÞ FillBox")] HRESULT FillBox([in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey);
+               [id(16), helpstring("Ò¿¯ÄÞ FillCircle")] HRESULT FillCircle([in]VARIANT x, [in]VARIANT y, [in]VARIANT radius);
+               [id(17), helpstring("Ò¿¯ÄÞ FillArc")] HRESULT FillArc([in]VARIANT x1, [in]VARIANT y1, [in]VARIANT x2, [in]VARIANT y2, [in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey);
+               [id(18), helpstring("Ò¿¯ÄÞ Text")] HRESULT Text([in]VARIANT x, [in]VARIANT y, [in]VARIANT text);
+               [id(19), helpstring("Ò¿¯ÄÞ TextBox")] HRESULT TextBox([in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey, [in]VARIANT text, [in, optional]VARIANT fmt);
+               [id(20), helpstring("Ò¿¯ÄÞ FillRBox")] HRESULT FillRBox([in]VARIANT sx, [in]VARIANT sy, [in]VARIANT ex, [in]VARIANT ey, [in]VARIANT w, [in]VARIANT h);
+               [id(21), helpstring("Ò¿¯ÄÞ Polygon")] HRESULT Polygon([in]VARIANT cx, [in]VARIANT cy, [in]VARIANT arrayPt);
+               [id(22), helpstring("Ò¿¯ÄÞ Picture")] HRESULT Picture([in]VARIANT idx, [in]VARIANT x, [in]VARIANT y, [in, optional]VARIANT w, [in, optional]VARIANT h);
                [id(23), helpstring("Ò¿¯ÄÞ SetMappingMode")] HRESULT SetMappingMode([in]VARIANT mode);
        };
 
@@ -394,8 +394,8 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _ILayerEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
        [
                object,
@@ -411,31 +411,31 @@ library SERAPHYSCRIPTTOOLSLib
                [propput, id(2), helpstring("ÌßÛÊßè LeftMargin")] HRESULT LeftMargin([in] short newVal);
                [propget, id(3), helpstring("ÌßÛÊßè RightMargin")] HRESULT RightMargin([out, retval] short *pVal);
                [propput, id(3), helpstring("ÌßÛÊßè RightMargin")] HRESULT RightMargin([in] short newVal);
-               [id(4), helpstring("Ò¿¯ÄÞ SetControlFont")] HRESULT SetControlFont([in]VARIANT fontname,[in]VARIANT fontsize);
-               [id(10), helpstring("Ò¿¯ÄÞ Label")] HRESULT Label([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(11), helpstring("Ò¿¯ÄÞ Button")] HRESULT Button([in]VARIANT text,[in,optional]VARIANT width,[out,retval] VARIANT *pvarUnk);
-               [id(12), helpstring("Ò¿¯ÄÞ CheckBox")] HRESULT CheckBox([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(13), helpstring("Ò¿¯ÄÞ Edit")] HRESULT Edit([in,optional]VARIANT text,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
+               [id(4), helpstring("Ò¿¯ÄÞ SetControlFont")] HRESULT SetControlFont([in]VARIANT fontname, [in]VARIANT fontsize);
+               [id(10), helpstring("Ò¿¯ÄÞ Label")] HRESULT Label([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(11), helpstring("Ò¿¯ÄÞ Button")] HRESULT Button([in]VARIANT text, [in, optional]VARIANT width, [out, retval] VARIANT *pvarUnk);
+               [id(12), helpstring("Ò¿¯ÄÞ CheckBox")] HRESULT CheckBox([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(13), helpstring("Ò¿¯ÄÞ Edit")] HRESULT Edit([in, optional]VARIANT text, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
                [id(14), helpstring("Ò¿¯ÄÞ ClearControls")] HRESULT ClearControls();
                [id(15), helpstring("Ò¿¯ÄÞ ControlBreak")] HRESULT ControlBreak();
                [id(16), helpstring("Ò¿¯ÄÞ ControlGroup")] HRESULT ControlGroup();
-               [id(17), helpstring("Ò¿¯ÄÞ RadioButton")] HRESULT RadioButton([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(18), helpstring("Ò¿¯ÄÞ ControlPad")] HRESULT ControlPad([in]VARIANT width,[in,optional]VARIANT height);
-               [id(19), helpstring("Ò¿¯ÄÞ PasswordEdit")] HRESULT PasswordEdit([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(20), helpstring("Ò¿¯ÄÞ ReadonlyEdit")] HRESULT ReadonlyEdit([in]VARIANT text,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* punkVal);
-               [id(21), helpstring("Ò¿¯ÄÞ CheckBox3state")] HRESULT CheckBox3state([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(22), helpstring("Ò¿¯ÄÞ PushCheckButton")] HRESULT PushCheckButton([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(23), helpstring("Ò¿¯ÄÞ PushRadioButton")] HRESULT PushRadioButton([in]VARIANT text,[in,optional]VARIANT width,[out,retval]VARIANT* pvarUnk);
-               [id(24), helpstring("Ò¿¯ÄÞ StatusLabel")] HRESULT StatusLabel([in]VARIANT text,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
+               [id(17), helpstring("Ò¿¯ÄÞ RadioButton")] HRESULT RadioButton([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(18), helpstring("Ò¿¯ÄÞ ControlPad")] HRESULT ControlPad([in]VARIANT width, [in, optional]VARIANT height);
+               [id(19), helpstring("Ò¿¯ÄÞ PasswordEdit")] HRESULT PasswordEdit([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(20), helpstring("Ò¿¯ÄÞ ReadonlyEdit")] HRESULT ReadonlyEdit([in]VARIANT text, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* punkVal);
+               [id(21), helpstring("Ò¿¯ÄÞ CheckBox3state")] HRESULT CheckBox3state([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(22), helpstring("Ò¿¯ÄÞ PushCheckButton")] HRESULT PushCheckButton([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(23), helpstring("Ò¿¯ÄÞ PushRadioButton")] HRESULT PushRadioButton([in]VARIANT text, [in, optional]VARIANT width, [out, retval]VARIANT* pvarUnk);
+               [id(24), helpstring("Ò¿¯ÄÞ StatusLabel")] HRESULT StatusLabel([in]VARIANT text, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
                [id(25), helpstring("Ò¿¯ÄÞ ControlUseStaticEdge")] HRESULT ControlUseStaticEdge([in]VARIANT mode);
-               [id(26), helpstring("Ò¿¯ÄÞ ListBox")] HRESULT ListBox([in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(27), helpstring("Ò¿¯ÄÞ MultiListBox")] HRESULT MultiListBox([in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(28), helpstring("Ò¿¯ÄÞ DropdownList")] HRESULT DropdownList([in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(29), helpstring("Ò¿¯ÄÞ DropdownEdit")] HRESULT DropdownEdit([in,optional]VARIANT text,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(30), helpstring("Ò¿¯ÄÞ TreeView")] HRESULT TreeView([in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(31), helpstring("Ò¿¯ÄÞ ListView")] HRESULT ListView([in,optional]VARIANT column,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(32), helpstring("Ò¿¯ÄÞ EditListView")] HRESULT EditListView([in,optional]VARIANT colum,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
-               [id(33), helpstring("Ò¿¯ÄÞ CheckListView")] HRESULT CheckListView([in,optional]VARIANT colum,[in,optional]VARIANT width,[in,optional]VARIANT height,[out,retval]VARIANT* pvarUnk);
+               [id(26), helpstring("Ò¿¯ÄÞ ListBox")] HRESULT ListBox([in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(27), helpstring("Ò¿¯ÄÞ MultiListBox")] HRESULT MultiListBox([in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(28), helpstring("Ò¿¯ÄÞ DropdownList")] HRESULT DropdownList([in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(29), helpstring("Ò¿¯ÄÞ DropdownEdit")] HRESULT DropdownEdit([in, optional]VARIANT text, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(30), helpstring("Ò¿¯ÄÞ TreeView")] HRESULT TreeView([in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(31), helpstring("Ò¿¯ÄÞ ListView")] HRESULT ListView([in, optional]VARIANT column, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(32), helpstring("Ò¿¯ÄÞ EditListView")] HRESULT EditListView([in, optional]VARIANT colum, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
+               [id(33), helpstring("Ò¿¯ÄÞ CheckListView")] HRESULT CheckListView([in, optional]VARIANT colum, [in, optional]VARIANT width, [in, optional]VARIANT height, [out, retval]VARIANT* pvarUnk);
                [propget, id(34), helpstring("ÌßÛÊßè ControlColor")] HRESULT ControlColor([out, retval] long *pVal);
                [propput, id(34), helpstring("ÌßÛÊßè ControlColor")] HRESULT ControlColor([in] long newVal);
        };
@@ -456,8 +456,8 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _IFormEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
        [
                object,
@@ -473,28 +473,28 @@ library SERAPHYSCRIPTTOOLSLib
                [propget, id(3), helpstring("ÌßÛÊßè PosX")] HRESULT PosX([out, retval] double *pVal);
                [propget, id(4), helpstring("ÌßÛÊßè PosY")] HRESULT PosY([out, retval] double *pVal);
                [propget, id(5), helpstring("ÌßÛÊßè time")] HRESULT time([out, retval] DATE *pVal);
-               [id(6), helpstring("Ò¿¯ÄÞ IsMouseMove")] HRESULT IsMouseMove([out,retval]BOOL* pResult);
-               [id(7), helpstring("Ò¿¯ÄÞ IsClick")] HRESULT IsClick([out,retval]BOOL* pResult);
-               [id(8), helpstring("Ò¿¯ÄÞ IsRClick")] HRESULT IsRClick([out,retval]BOOL* pResult);
-               [id(9), helpstring("Ò¿¯ÄÞ IsClickCancel")] HRESULT IsClickCancel([out,retval]BOOL* pResult);
-               [id(10), helpstring("Ò¿¯ÄÞ IsRClickCancel")] HRESULT IsRClickCancel([out,retval]BOOL* pResult);
-               [id(11), helpstring("Ò¿¯ÄÞ IsClickOut")] HRESULT IsClickOut([out,retval]BOOL* pResult);
-               [id(12), helpstring("Ò¿¯ÄÞ IsRClickOut")] HRESULT IsRClickOut([out,retval]BOOL* pResult);
-               [id(13), helpstring("Ò¿¯ÄÞ IsCommand")] HRESULT IsCommand([out,retval]BOOL* pResult);
-               [id(14), helpstring("Ò¿¯ÄÞ IsTimer")] HRESULT IsTimer([out,retval]BOOL* pResult);
-               [id(15), helpstring("Ò¿¯ÄÞ IsSize")] HRESULT IsSize([out,retval]BOOL* pResult);
-               [id(16), helpstring("Ò¿¯ÄÞ IsExit")] HRESULT IsExit([out,retval]BOOL* pResult);
-               [id(17), helpstring("Ò¿¯ÄÞ IsOK")] HRESULT IsOK([out,retval]BOOL* pResult);
-               [id(18), helpstring("Ò¿¯ÄÞ IsCancel")] HRESULT IsCancel([out,retval]BOOL* pResult);
-               [id(19), helpstring("Ò¿¯ÄÞ IsDblClick")] HRESULT IsDblClick([out,retval]BOOL* pResult);
-               [id(20), helpstring("Ò¿¯ÄÞ IsRDblClick")] HRESULT IsRDblClick([out,retval]BOOL* pResult);
+               [id(6), helpstring("Ò¿¯ÄÞ IsMouseMove")] HRESULT IsMouseMove([out, retval]BOOL* pResult);
+               [id(7), helpstring("Ò¿¯ÄÞ IsClick")] HRESULT IsClick([out, retval]BOOL* pResult);
+               [id(8), helpstring("Ò¿¯ÄÞ IsRClick")] HRESULT IsRClick([out, retval]BOOL* pResult);
+               [id(9), helpstring("Ò¿¯ÄÞ IsClickCancel")] HRESULT IsClickCancel([out, retval]BOOL* pResult);
+               [id(10), helpstring("Ò¿¯ÄÞ IsRClickCancel")] HRESULT IsRClickCancel([out, retval]BOOL* pResult);
+               [id(11), helpstring("Ò¿¯ÄÞ IsClickOut")] HRESULT IsClickOut([out, retval]BOOL* pResult);
+               [id(12), helpstring("Ò¿¯ÄÞ IsRClickOut")] HRESULT IsRClickOut([out, retval]BOOL* pResult);
+               [id(13), helpstring("Ò¿¯ÄÞ IsCommand")] HRESULT IsCommand([out, retval]BOOL* pResult);
+               [id(14), helpstring("Ò¿¯ÄÞ IsTimer")] HRESULT IsTimer([out, retval]BOOL* pResult);
+               [id(15), helpstring("Ò¿¯ÄÞ IsSize")] HRESULT IsSize([out, retval]BOOL* pResult);
+               [id(16), helpstring("Ò¿¯ÄÞ IsExit")] HRESULT IsExit([out, retval]BOOL* pResult);
+               [id(17), helpstring("Ò¿¯ÄÞ IsOK")] HRESULT IsOK([out, retval]BOOL* pResult);
+               [id(18), helpstring("Ò¿¯ÄÞ IsCancel")] HRESULT IsCancel([out, retval]BOOL* pResult);
+               [id(19), helpstring("Ò¿¯ÄÞ IsDblClick")] HRESULT IsDblClick([out, retval]BOOL* pResult);
+               [id(20), helpstring("Ò¿¯ÄÞ IsRDblClick")] HRESULT IsRDblClick([out, retval]BOOL* pResult);
                [propget, id(21), helpstring("ÌßÛÊßè ExtParameter")] HRESULT ExtParameter([out, retval] long *pVal);
-               [id(22), helpstring("Ò¿¯ÄÞ IsContextMenu")] HRESULT IsContextMenu([out,retval]BOOL* pResult);
-               [id(23), helpstring("Ò¿¯ÄÞ IsContextDelete")] HRESULT IsContextDelete([out,retval]BOOL* pResult);
-               [id(24), helpstring("Ò¿¯ÄÞ IsKeydown")] HRESULT IsKeydown([out,retval]BOOL* pResult);
+               [id(22), helpstring("Ò¿¯ÄÞ IsContextMenu")] HRESULT IsContextMenu([out, retval]BOOL* pResult);
+               [id(23), helpstring("Ò¿¯ÄÞ IsContextDelete")] HRESULT IsContextDelete([out, retval]BOOL* pResult);
+               [id(24), helpstring("Ò¿¯ÄÞ IsKeydown")] HRESULT IsKeydown([out, retval]BOOL* pResult);
                [propget, id(25), helpstring("ÌßÛÊßè DPosX")] HRESULT DPosX([out, retval] long *pVal);
                [propget, id(26), helpstring("ÌßÛÊßè DPosY")] HRESULT DPosY([out, retval] long *pVal);
-               [id(27), helpstring("Ò¿¯ÄÞ IsKeydown2")] HRESULT IsKeydown2([out,retval]BOOL* pResult);
+               [id(27), helpstring("Ò¿¯ÄÞ IsKeydown2")] HRESULT IsKeydown2([out, retval]BOOL* pResult);
        };
 
        [
@@ -513,10 +513,10 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _IEventEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
-       
+
 
        [
                object,
@@ -528,16 +528,16 @@ library SERAPHYSCRIPTTOOLSLib
        interface ISeraphyScriptTools_Instance : IDispatch
        {
                [propput, id(DISPID_CAPTION)] HRESULT Caption([in]BSTR strCaption);
-               [propget, id(DISPID_CAPTION)] HRESULT Caption([out,retval]BSTR* pstrCaption);
+               [propget, id(DISPID_CAPTION)] HRESULT Caption([out, retval]BSTR* pstrCaption);
                [propget, id(1), helpstring("ÌßÛÊßè Dialog")] HRESULT Dialog([out, retval] VARIANT *pVal);
                [propget, id(2), helpstring("ÌßÛÊßè MainFrame")] HRESULT MainFrame([out, retval] VARIANT *pVal);
-               [id(3), helpstring("Ò¿¯ÄÞ CreateFrame")] HRESULT CreateFrame([out,retval]VARIANT* pvarUnk);
-               [id(4), helpstring("Ò¿¯ÄÞ WaitEvent")] HRESULT WaitEvent([in,optional]VARIANT varTim,[out,retval]VARIANT* pvarUnk);
+               [id(3), helpstring("Ò¿¯ÄÞ CreateFrame")] HRESULT CreateFrame([out, retval]VARIANT* pvarUnk);
+               [id(4), helpstring("Ò¿¯ÄÞ WaitEvent")] HRESULT WaitEvent([in, optional]VARIANT varTim, [out, retval]VARIANT* pvarUnk);
                [propget, id(5), helpstring("ÌßÛÊßè WaitCursor")] HRESULT WaitCursor([out, retval] short *pVal);
                [propput, id(5), helpstring("ÌßÛÊßè WaitCursor")] HRESULT WaitCursor([in] short newVal);
                [propget, id(8), helpstring("ÌßÛÊßè Keyboard")] HRESULT Keyboard([in]VARIANT vk, [out, retval] BOOL *pVal);
-               [propget, id(9), helpstring("ÌßÛÊßè MousePosX")] HRESULT MousePosX([out, retval] short *pVal);
-               [propget, id(10), helpstring("ÌßÛÊßè MousePosY")] HRESULT MousePosY([out, retval] short *pVal);
+               [propget, id(9), helpstring("ÌßÛÊßè MousePosX")] HRESULT MousePosX([out, retval] long *pVal);
+               [propget, id(10), helpstring("ÌßÛÊßè MousePosY")] HRESULT MousePosY([out, retval] long *pVal);
                [propget, id(11), helpstring("ÌßÛÊßè Version")] HRESULT Version([out, retval] double *pVal);
        };
 
@@ -557,8 +557,8 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        dispinterface _ISeraphyScriptTools_InstanceEvents
        {
-               properties:
-               methods:
+       properties:
+       methods:
        };
        [
                object,
@@ -575,13 +575,13 @@ library SERAPHYSCRIPTTOOLSLib
                [propget, id(4), helpstring("ÌßÛÊßè PrevItem")] HRESULT PrevItem([out, retval] IUnknown* *pVal);
                [propget, id(5), helpstring("ÌßÛÊßè Text")] HRESULT Text([out, retval] BSTR *pVal);
                [propput, id(5), helpstring("ÌßÛÊßè Text")] HRESULT Text([in] BSTR newVal);
-               [propget, id(6), helpstring("ÌßÛÊßè Object")] HRESULT Object([in,optional]VARIANT idx, [out, retval] VARIANT *pVal);
-               [id(7), helpstring("Ò¿¯ÄÞ Create")] HRESULT Create([in]VARIANT text,[out,retval]IUnknown** punkVal);
+               [propget, id(6), helpstring("ÌßÛÊßè Object")] HRESULT Object([in, optional]VARIANT idx, [out, retval] VARIANT *pVal);
+               [id(7), helpstring("Ò¿¯ÄÞ Create")] HRESULT Create([in]VARIANT text, [out, retval]IUnknown** punkVal);
                [id(8), helpstring("Ò¿¯ÄÞ Erase")] HRESULT Erase();
                [id(9), helpstring("Ò¿¯ÄÞ Select")] HRESULT Select();
                [id(10), helpstring("Ò¿¯ÄÞ Expand")] HRESULT Expand();
                [id(11), helpstring("Ò¿¯ÄÞ Sort")] HRESULT Sort();
-               [id(12), helpstring("Ò¿¯ÄÞ IsValid")] HRESULT IsValid([out,retval]BOOL* pResult);
+               [id(12), helpstring("Ò¿¯ÄÞ IsValid")] HRESULT IsValid([out, retval]BOOL* pResult);
        };
        [
                object,
@@ -596,11 +596,11 @@ library SERAPHYSCRIPTTOOLSLib
                [propput, id(1), helpstring("ÌßÛÊßè Value")] HRESULT Value([in]VARIANT key, [in] VARIANT newVal);
                [propget, id(2), helpstring("ÌßÛÊßè Count")] HRESULT Count([out, retval] long *pVal);
                [id(3), helpstring("Ò¿¯ÄÞ Clear")] HRESULT Clear();
-               [id(4), helpstring("Ò¿¯ÄÞ Duplicate")] HRESULT Duplicate([out,retval]IUnknown** punkVal);
-               [id(5), helpstring("Ò¿¯ÄÞ CreateMap")] HRESULT CreateMap([out,retval]IUnknown** punkVal);
-               [id(6), helpstring("Ò¿¯ÄÞ FindNear")] HRESULT FindNear([in]VARIANT key,[out,retval]VARIANT *pVal);
-               [propget, id(7), helpstring("ÌßÛÊßè NearValue")] HRESULT NearValue([in]VARIANT key,[out,retval]VARIANT* pVal);
-               [id(8), helpstring("Ò¿¯ÄÞ ExpandVariables")] HRESULT ExpandVariables([in]VARIANT text,[in,optional]VARIANT env,[out,retval]VARIANT* pVal);
+               [id(4), helpstring("Ò¿¯ÄÞ Duplicate")] HRESULT Duplicate([out, retval]IUnknown** punkVal);
+               [id(5), helpstring("Ò¿¯ÄÞ CreateMap")] HRESULT CreateMap([out, retval]IUnknown** punkVal);
+               [id(6), helpstring("Ò¿¯ÄÞ FindNear")] HRESULT FindNear([in]VARIANT key, [out, retval]VARIANT *pVal);
+               [propget, id(7), helpstring("ÌßÛÊßè NearValue")] HRESULT NearValue([in]VARIANT key, [out, retval]VARIANT* pVal);
+               [id(8), helpstring("Ò¿¯ÄÞ ExpandVariables")] HRESULT ExpandVariables([in]VARIANT text, [in, optional]VARIANT env, [out, retval]VARIANT* pVal);
                [propget, id(9), helpstring("ÌßÛÊßè IsExist")] HRESULT IsExist([in]VARIANT key, [out, retval] BOOL *pVal);
                [id(10), helpstring("Ò¿¯ÄÞ Erase")] HRESULT Erase([in]VARIANT key);
                [id(11), helpstring("Ò¿¯ÄÞ LoadProfile")] HRESULT LoadProfile([in]IUnknown* punkVal);
@@ -616,24 +616,24 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        interface ISeraphyScriptTools_Shell : IDispatch
        {
-               [id(1), helpstring("Ò¿¯ÄÞ ShellExecute")] HRESULT ShellExecute([in]VARIANT path,[in,optional]VARIANT param,[in,optional]VARIANT initdir,[in,optional]VARIANT mode, [out,retval]VARIANT* punkVal);
+               [id(1), helpstring("Ò¿¯ÄÞ ShellExecute")] HRESULT ShellExecute([in]VARIANT path, [in, optional]VARIANT param, [in, optional]VARIANT initdir, [in, optional]VARIANT mode, [out, retval]VARIANT* punkVal);
                [id(2), helpstring("Ò¿¯ÄÞ GetSpecialFolderLocations")] HRESULT GetSpecialFolderLocations([in]IUnknown* punkVal);
                [propget, id(3), helpstring("ÌßÛÊßè IsWindowNT")] HRESULT IsWindowNT([out, retval] BOOL *pVal);
                [propget, id(4), helpstring("ÌßÛÊßè WindowsVersion")] HRESULT WindowsVersion([out, retval] long *pVal);
-               [id(5), helpstring("Ò¿¯ÄÞ GetDLLVersion")] HRESULT GetDLLVersion([in]VARIANT text,[in,optional]VARIANT min,[out,retval]VARIANT* pVal);
-               [id(6), helpstring("Ò¿¯ÄÞ ParseName")] HRESULT ParseName([in,optional]VARIANT text,[out,retval]VARIANT* pVal);
-               [id(7), helpstring("Ò¿¯ÄÞ Copy")] HRESULT Copy([in]VARIANT from,[in]VARIANT to,[out,retval]VARIANT* pVal);
-               [id(8), helpstring("Ò¿¯ÄÞ CopyRenameOnCollision")] HRESULT CopyRenameOnCollision([in]VARIANT from,[in]VARIANT to,[out,retval]VARIANT* pVal);
-               [id(9), helpstring("Ò¿¯ÄÞ Move")] HRESULT Move([in]VARIANT from,[in]VARIANT to,[out,retval]VARIANT* pVal);
-               [id(10), helpstring("Ò¿¯ÄÞ Delete")] HRESULT Delete([in]VARIANT from,[out,retval]VARIANT* pVal);
+               [id(5), helpstring("Ò¿¯ÄÞ GetDLLVersion")] HRESULT GetDLLVersion([in]VARIANT text, [in, optional]VARIANT min, [out, retval]VARIANT* pVal);
+               [id(6), helpstring("Ò¿¯ÄÞ ParseName")] HRESULT ParseName([in, optional]VARIANT text, [out, retval]VARIANT* pVal);
+               [id(7), helpstring("Ò¿¯ÄÞ Copy")] HRESULT Copy([in]VARIANT from, [in]VARIANT to, [out, retval]VARIANT* pVal);
+               [id(8), helpstring("Ò¿¯ÄÞ CopyRenameOnCollision")] HRESULT CopyRenameOnCollision([in]VARIANT from, [in]VARIANT to, [out, retval]VARIANT* pVal);
+               [id(9), helpstring("Ò¿¯ÄÞ Move")] HRESULT Move([in]VARIANT from, [in]VARIANT to, [out, retval]VARIANT* pVal);
+               [id(10), helpstring("Ò¿¯ÄÞ Delete")] HRESULT Delete([in]VARIANT from, [out, retval]VARIANT* pVal);
                [propget, id(11), helpstring("ÌßÛÊßè Confirm")] HRESULT Confirm([out, retval] BOOL *pVal);
                [propput, id(11), helpstring("ÌßÛÊßè Confirm")] HRESULT Confirm([in] BOOL newVal);
                [propget, id(12), helpstring("ÌßÛÊßè Silent")] HRESULT Silent([out, retval] BOOL *pVal);
                [propput, id(12), helpstring("ÌßÛÊßè Silent")] HRESULT Silent([in] BOOL newVal);
-               [id(13), helpstring("Ò¿¯ÄÞ EmptyRecycleBin")] HRESULT EmptyRecycleBin([in,optional]VARIANT dir);
-               [id(14), helpstring("Ò¿¯ÄÞ RecentDocs")] HRESULT RecentDocs([in,optional]VARIANT text);
+               [id(13), helpstring("Ò¿¯ÄÞ EmptyRecycleBin")] HRESULT EmptyRecycleBin([in, optional]VARIANT dir);
+               [id(14), helpstring("Ò¿¯ÄÞ RecentDocs")] HRESULT RecentDocs([in, optional]VARIANT text);
                [id(15), helpstring("Ò¿¯ÄÞ SetMainWindow")] HRESULT SetMainWindow([in]VARIANT varUnk);
-               [id(16), helpstring("Ò¿¯ÄÞ IsExist")] HRESULT IsExist([in]VARIANT name,[out,retval]VARIANT* pVal);
+               [id(16), helpstring("Ò¿¯ÄÞ IsExist")] HRESULT IsExist([in]VARIANT name, [out, retval]VARIANT* pVal);
        };
        [
                object,
@@ -644,7 +644,7 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        interface IShellExecObj : IDispatch
        {
-               [id(1), helpstring("Ò¿¯ÄÞ Wait")] HRESULT Wait([in,optional]VARIANT tim,[out,retval]VARIANT* pVal);
+               [id(1), helpstring("Ò¿¯ÄÞ Wait")] HRESULT Wait([in, optional]VARIANT tim, [out, retval]VARIANT* pVal);
                [propget, id(2), helpstring("ÌßÛÊßè ExitCode")] HRESULT ExitCode([out, retval] long *pVal);
        };
        [
@@ -656,18 +656,18 @@ library SERAPHYSCRIPTTOOLSLib
        ]
        interface IObjectVector : IDispatch
        {
-               [id(1), helpstring("Ò¿¯ÄÞ CreateVector")] HRESULT CreateVector([out,retval]IUnknown** punkVal);
-               [id(2), helpstring("Ò¿¯ÄÞ Duplicate")] HRESULT Duplicate([in,optional]VARIANT idx,[in,optional]VARIANT count,[out,retval]IUnknown** punkVal);
+               [id(1), helpstring("Ò¿¯ÄÞ CreateVector")] HRESULT CreateVector([out, retval]IUnknown** punkVal);
+               [id(2), helpstring("Ò¿¯ÄÞ Duplicate")] HRESULT Duplicate([in, optional]VARIANT idx, [in, optional]VARIANT count, [out, retval]IUnknown** punkVal);
                [id(3), helpstring("Ò¿¯ÄÞ Clear")] HRESULT Clear();
-               [id(4), helpstring("Ò¿¯ÄÞ Erase")] HRESULT Erase([in]VARIANT start,[in,optional]VARIANT count);
+               [id(4), helpstring("Ò¿¯ÄÞ Erase")] HRESULT Erase([in]VARIANT start, [in, optional]VARIANT count);
                [id(5), helpstring("Ò¿¯ÄÞ Push")] HRESULT Push([in]VARIANT newVal);
-               [id(6), helpstring("Ò¿¯ÄÞ Pop")] HRESULT Pop([out,retval]VARIANT* pVal);
-               [id(7), helpstring("Ò¿¯ÄÞ Insert")] HRESULT Insert([in]VARIANT idx,[in]VARIANT newVal);
-               [propget, id(8), helpstring("ÌßÛÊßè Value")] HRESULT Value([in,optional]VARIANT idx, [out, retval] VARIANT *pVal);
-               [propput, id(8), helpstring("ÌßÛÊßè Value")] HRESULT Value([in,optional]VARIANT idx, [in] VARIANT newVal);
+               [id(6), helpstring("Ò¿¯ÄÞ Pop")] HRESULT Pop([out, retval]VARIANT* pVal);
+               [id(7), helpstring("Ò¿¯ÄÞ Insert")] HRESULT Insert([in]VARIANT idx, [in]VARIANT newVal);
+               [propget, id(8), helpstring("ÌßÛÊßè Value")] HRESULT Value([in, optional]VARIANT idx, [out, retval] VARIANT *pVal);
+               [propput, id(8), helpstring("ÌßÛÊßè Value")] HRESULT Value([in, optional]VARIANT idx, [in] VARIANT newVal);
                [propget, id(9), helpstring("ÌßÛÊßè Count")] HRESULT Count([out, retval] long *pVal);
                [id(10), helpstring("Ò¿¯ÄÞ Merge")] HRESULT Merge([in]VARIANT unkVal);
-               [id(11), helpstring("Ò¿¯ÄÞ MakeArray")] HRESULT MakeArray([out,retval]VARIANT* pVal);
+               [id(11), helpstring("Ò¿¯ÄÞ MakeArray")] HRESULT MakeArray([out, retval]VARIANT* pVal);
                [propget, id(DISPID_NEWENUM), helpstring("ÌßÛÊßè _NewEnum")] HRESULT _NewEnum([out, retval] IUnknown* *pVal);
        };
        [
@@ -681,8 +681,8 @@ library SERAPHYSCRIPTTOOLSLib
        {
                [propget, id(1), helpstring("ÌßÛÊßè Value")] HRESULT Value([in]VARIANT idx, [out, retval] VARIANT *pVal);
                [propput, id(1), helpstring("ÌßÛÊßè Value")] HRESULT Value([in]VARIANT idx, [in] VARIANT newVal);
-               [id(2), helpstring("Ò¿¯ÄÞ GetValue")] HRESULT GetValue([in]VARIANT idx,[in,optional]VARIANT def,[out,retval]VARIANT* pVal);
-               [id(3), helpstring("Ò¿¯ÄÞ GetKeyNames")] HRESULT GetKeyNames([out,retval]VARIANT* pVal);
+               [id(2), helpstring("Ò¿¯ÄÞ GetValue")] HRESULT GetValue([in]VARIANT idx, [in, optional]VARIANT def, [out, retval]VARIANT* pVal);
+               [id(3), helpstring("Ò¿¯ÄÞ GetKeyNames")] HRESULT GetKeyNames([out, retval]VARIANT* pVal);
        };
        [
                object,
@@ -716,7 +716,7 @@ library SERAPHYSCRIPTTOOLSLib
        {
                [propget, id(1), helpstring("ÌßÛÊßè ProfilePath")] HRESULT ProfilePath([out, retval] BSTR *pVal);
                [propput, id(1), helpstring("ÌßÛÊßè ProfilePath")] HRESULT ProfilePath([in] BSTR newVal);
-               [id(2), helpstring("Ò¿¯ÄÞ OpenSection")] HRESULT OpenSection([in]VARIANT text,[out,retval]VARIANT* pVal);
+               [id(2), helpstring("Ò¿¯ÄÞ OpenSection")] HRESULT OpenSection([in]VARIANT text, [out, retval]VARIANT* pVal);
        };
 
        [
index bcf03f0..eedcfb3 100644 (file)
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
 //
 #include "resource.h"
 
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// \93ú\96{\8cê resources
+// \83j\83\85\81[\83g\83\89\83\8b (\8aù\92è) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
+LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
+#pragma code_page(932)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+    IDS_PROJNAME            "SeraphyScriptTools"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_ERR_LAYERBOUND      "Layer is already disposed or not created."
+    IDS_ERR_CREATEDWND      "The window is already created."
+    IDS_ERR_NODEFPRINTER    "Default printer is not found."
+    IDS_ERR_NEED2DIM        "Require 2xN VARIANT Dimension (N>=3)"
+    IDS_ERR_MAXCONTROL      "Too many controls."
+    IDS_ERR_DESTROYED       "Windows is already destroied or not created."
+    IDS_ERR_NOCREATEMENU    "Menu is not created."
+    IDS_ERR_PRINTERSETTING  "Failed to setting for printer."
+    IDS_ERR_NOTSUPPORTCONTROL "Unsupported operation."
+    IDS_ERR_RANDEOUT        "invalid range."
+    IDS_ERR_TREEERROR       "TreeView or TreeItem is already disposed or not created."
+    IDS_ERR_PROFILEPATH     "INI Path is invalid."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_ERR_PICTURELOADFAIL "Can't load a picture."
+END
+
+#endif    // \83j\83\85\81[\83g\83\89\83\8b (\8aù\92è) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// \93ú\96{\8cê (\93ú\96{) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
-#ifdef _WIN32
 LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
 #pragma code_page(932)
-#endif //_WIN32
 
 #ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////
@@ -27,18 +67,18 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
 // TEXTINCLUDE
 //
 
-1 TEXTINCLUDE DISCARDABLE 
+1 TEXTINCLUDE 
 BEGIN
     "resource.h\0"
 END
 
-2 TEXTINCLUDE DISCARDABLE 
+2 TEXTINCLUDE 
 BEGIN
     "#include ""winres.h""\r\n"
     "\0"
 END
 
-3 TEXTINCLUDE DISCARDABLE 
+3 TEXTINCLUDE 
 BEGIN
     "1 TYPELIB ""SeraphyScriptTools.tlb""\r\n"
     "\0"
@@ -47,15 +87,14 @@ END
 #endif    // APSTUDIO_INVOKED
 
 
-#ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
 //
 // Version
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,1,0,1
- PRODUCTVERSION 1,1,0,1
+ FILEVERSION 1,2,0,1
+ PRODUCTVERSION 1,2,0,1
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -70,19 +109,13 @@ BEGIN
     BEGIN
         BLOCK "041104b0"
         BEGIN
-            VALUE "Comments", "\0"
-            VALUE "CompanyName", "\0"
-            VALUE "FileDescription", "SeraphyScriptTools Module\0"
-            VALUE "FileVersion", "1, 1, 0, 1\0"
-            VALUE "InternalName", "SeraphyScriptTools\0"
-            VALUE "LegalCopyright", "Copyright 2000\0"
-            VALUE "LegalTrademarks", "\0"
-            VALUE "OLESelfRegister", "\0"
-            VALUE "OriginalFilename", "SeraphyScriptTools.DLL\0"
-            VALUE "PrivateBuild", "\0"
-            VALUE "ProductName", "SeraphyScriptTools Module\0"
-            VALUE "ProductVersion", "1, 1, 0, 1\0"
-            VALUE "SpecialBuild", "\0"
+            VALUE "FileDescription", "SeraphyScriptTools Module"
+            VALUE "FileVersion", "1.2.0.1"
+            VALUE "InternalName", "SeraphyScriptTools"
+            VALUE "LegalCopyright", "Copyright seraphyware.jp 2000, 2015"
+            VALUE "OriginalFilename", "SeraphyScriptTools.DLL"
+            VALUE "ProductName", "SeraphyScriptTools Module"
+            VALUE "ProductVersion", "1.2.0.1"
         END
     END
     BLOCK "VarFileInfo"
@@ -91,49 +124,51 @@ BEGIN
     END
 END
 
-#endif    // !_MAC
-
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // Bitmap
 //
 
-IDB_COMMDIALOG          BITMAP  DISCARDABLE     "commdial.bmp"
-IDB_OVERLAPPEDWINDOW    BITMAP  DISCARDABLE     "popupwin.bmp"
-IDB_INSTANCE            BITMAP  DISCARDABLE     "instance.bmp"
+IDB_COMMDIALOG          BITMAP                  "commdial.bmp"
+IDB_OVERLAPPEDWINDOW    BITMAP                  "popupwin.bmp"
+IDB_INSTANCE            BITMAP                  "instance.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // REGISTRY
 //
 
-IDR_COMMDIALOG          REGISTRY DISCARDABLE    "CommDialog.rgs"
-IDR_OVERLAPPEDWINDOW    REGISTRY DISCARDABLE    "OverlappedWindow.rgs"
-IDR_CONTROL             REGISTRY DISCARDABLE    "Control.rgs"
-IDR_CANVAS              REGISTRY DISCARDABLE    "Draw.rgs"
-IDR_LAYER               REGISTRY DISCARDABLE    "Layer.rgs"
-IDR_FORM                REGISTRY DISCARDABLE    "Form.rgs"
-IDR_EVENT               REGISTRY DISCARDABLE    "Event.rgs"
-IDR_INSTANCE            REGISTRY DISCARDABLE    "Instance.rgs"
-IDR_ENUMSELECT          REGISTRY DISCARDABLE    "EnumSelect.rgs"
-IDR_TREEITEM            REGISTRY DISCARDABLE    "TreeItem.rgs"
-IDR_OBJECTMAP           REGISTRY DISCARDABLE    "ObjectMap.rgs"
-IDR_SHELL               REGISTRY DISCARDABLE    "Shell.rgs"
-IDR_SHELLEXECOBJ        REGISTRY DISCARDABLE    "ShellExecObj.rgs"
-IDR_OBJECTVECTOR        REGISTRY DISCARDABLE    "ObjectVector.rgs"
-IDR_PROFILESECTION      REGISTRY DISCARDABLE    "ProfileSection.rgs"
-IDR_PARSENAME           REGISTRY DISCARDABLE    "ParseName.rgs"
-IDR_PRIVATEPROFILE      REGISTRY DISCARDABLE    "PrivateProfile.rgs"
+IDR_COMMDIALOG          REGISTRY                "CommDialog.rgs"
+IDR_OVERLAPPEDWINDOW    REGISTRY                "OverlappedWindow.rgs"
+IDR_CONTROL             REGISTRY                "Control.rgs"
+IDR_CANVAS              REGISTRY                "Draw.rgs"
+IDR_LAYER               REGISTRY                "Layer.rgs"
+IDR_FORM                REGISTRY                "Form.rgs"
+IDR_EVENT               REGISTRY                "Event.rgs"
+IDR_INSTANCE            REGISTRY                "Instance.rgs"
+IDR_ENUMSELECT          REGISTRY                "EnumSelect.rgs"
+IDR_TREEITEM            REGISTRY                "TreeItem.rgs"
+IDR_OBJECTMAP           REGISTRY                "ObjectMap.rgs"
+IDR_SHELL               REGISTRY                "Shell.rgs"
+IDR_SHELLEXECOBJ        REGISTRY                "ShellExecObj.rgs"
+IDR_OBJECTVECTOR        REGISTRY                "ObjectVector.rgs"
+IDR_PROFILESECTION      REGISTRY                "ProfileSection.rgs"
+IDR_PARSENAME           REGISTRY                "ParseName.rgs"
+IDR_PRIVATEPROFILE      REGISTRY                "PrivateProfile.rgs"
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // String Table
 //
 
-STRINGTABLE DISCARDABLE 
+STRINGTABLE
 BEGIN
     IDS_PROJNAME            "SeraphyScriptTools"
+END
+
+STRINGTABLE
+BEGIN
     IDS_ERR_LAYERBOUND      "\83\8c\83C\83\84\81[\82ª\94j\8aü\82³\82ê\82Ä\82¢\82é\82©\81A\83\8c\83C\83\84\81[\94Í\88Í\82ð\92´\82¦\82Ä\82¢\82Ü\82·\81B\83\8c\83C\83\84\81[\82Í0\81`255\82Ì\94Í\88Í\82Å\8ew\92è\82µ\82È\82¯\82ê\82Î\82È\82è\82Ü\82¹\82ñ\81B"
     IDS_ERR_CREATEDWND      "\82·\82Å\82É\83E\83B\83\93\83h\83E\82ª\8dì\90¬\82³\82ê\82Ä\82¢\82Ü\82·\81B"
     IDS_ERR_NODEFPRINTER    "\8aù\92è\82Ì\83v\83\8a\83\93\83^\82ª\82Ý\82Â\82©\82è\82Ü\82¹\82ñ\81B"
@@ -142,19 +177,18 @@ BEGIN
     IDS_ERR_DESTROYED       "\83E\83B\83\93\83h\83E\82ª\96¢\8dì\90¬\82©\94j\8aü\82³\82ê\82Ä\82¨\82è\81A\82±\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82Í\8eg\97p\82Å\82«\82Ü\82¹\82ñ"
     IDS_ERR_NOCREATEMENU    "\83\81\83j\83\85\81[\82ª\8dì\90¬\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ"
     IDS_ERR_PRINTERSETTING  "\83v\83\8a\83\93\83^\82Ì\90Ý\92è\82É\8e¸\94s\82µ\82Ü\82µ\82½"
-END
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    IDS_ERR_NOTSUPPORTCONTROL 
-                            "\83R\83\93\83g\83\8d\81[\83\8b\82Ì\8eí\97Þ\82ª\88Ù\82È\82é\82½\82ß\81A\8ew\92è\82³\82ê\82½\91\80\8dì\82Í\83T\83|\81[\83g\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B"
+    IDS_ERR_NOTSUPPORTCONTROL "\83R\83\93\83g\83\8d\81[\83\8b\82Ì\8eí\97Þ\82ª\88Ù\82È\82é\82½\82ß\81A\8ew\92è\82³\82ê\82½\91\80\8dì\82Í\83T\83|\81[\83g\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B"
     IDS_ERR_RANDEOUT        "\8ew\92è\82³\82ê\82½\8d\80\96Ú\82Í\94Í\88Í\8aO\82Å\82·"
     IDS_ERR_TREEERROR       "\83c\83\8a\81[\83r\83\85\81[\82Ü\82½\82Í\81A\82±\82Ì\83A\83C\83e\83\80\82Í\94j\8aü\82³\82ê\82½\82©\96³\8cø\82Å\82·\81B"
     IDS_ERR_PROFILEPATH     "\8f\89\8aú\89»\83t\83@\83C\83\8b\82Ö\82Ì\83p\83X\82ª\95s\90³\82Å\82·"
+END
+
+STRINGTABLE
+BEGIN
     IDS_ERR_PICTURELOADFAIL "\83s\83N\83`\83\83\81[\82ð\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ"
 END
 
-#endif    // \93ú\96{\8cê resources
+#endif    // \93ú\96{\8cê (\93ú\96{) resources
 /////////////////////////////////////////////////////////////////////////////
 
 
index 2be6752..53517b3 100644 (file)
@@ -1,37 +1,37 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
+VisualStudioVersion = 12.0.40629.0
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SeraphyScriptTools", "SeraphyScriptTools.vcxproj", "{06035D5C-5F95-47F2-88B4-D614B0E06D2F}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
-               MBCS Debug|Win32 = MBCS Debug|Win32
-               MBCS Debug|x64 = MBCS Debug|x64
-               MBCS Release|Win32 = MBCS Release|Win32
-               MBCS Release|x64 = MBCS Release|x64
-               Unicode Debug|Win32 = Unicode Debug|Win32
-               Unicode Debug|x64 = Unicode Debug|x64
-               Unicode Release|Win32 = Unicode Release|Win32
-               Unicode Release|x64 = Unicode Release|x64
+               MBCSDebug|Win32 = MBCSDebug|Win32
+               MBCSDebug|x64 = MBCSDebug|x64
+               MBCSRelease|Win32 = MBCSRelease|Win32
+               MBCSRelease|x64 = MBCSRelease|x64
+               UnicodeDebug|Win32 = UnicodeDebug|Win32
+               UnicodeDebug|x64 = UnicodeDebug|x64
+               UnicodeRelease|Win32 = UnicodeRelease|Win32
+               UnicodeRelease|x64 = UnicodeRelease|x64
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|Win32.ActiveCfg = MBCS Debug|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|Win32.Build.0 = MBCS Debug|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|x64.ActiveCfg = MBCS Debug|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|x64.Build.0 = MBCS Debug|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|Win32.ActiveCfg = MBCS Release|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|Win32.Build.0 = MBCS Release|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|x64.ActiveCfg = MBCS Release|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|x64.Build.0 = MBCS Release|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|Win32.ActiveCfg = Unicode Release|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|Win32.Build.0 = Unicode Release|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|x64.ActiveCfg = Unicode Debug|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|x64.Build.0 = Unicode Debug|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|x64.ActiveCfg = Unicode Release|x64
-               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|x64.Build.0 = Unicode Release|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSDebug|Win32.ActiveCfg = MBCSDebug|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSDebug|Win32.Build.0 = MBCSDebug|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSDebug|x64.ActiveCfg = MBCSDebug|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSDebug|x64.Build.0 = MBCSDebug|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSRelease|Win32.ActiveCfg = MBCSRelease|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSRelease|Win32.Build.0 = MBCSRelease|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSRelease|x64.ActiveCfg = MBCSRelease|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCSRelease|x64.Build.0 = MBCSRelease|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeDebug|Win32.ActiveCfg = UnicodeDebug|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeDebug|Win32.Build.0 = UnicodeDebug|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeDebug|x64.ActiveCfg = UnicodeDebug|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeDebug|x64.Build.0 = UnicodeDebug|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeRelease|Win32.ActiveCfg = UnicodeRelease|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeRelease|Win32.Build.0 = UnicodeRelease|Win32
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeRelease|x64.ActiveCfg = UnicodeRelease|x64
+               {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.UnicodeRelease|x64.Build.0 = UnicodeRelease|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 9e913ff..708984c 100644 (file)
@@ -1,36 +1,36 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="MBCS Debug|Win32">
-      <Configuration>MBCS Debug</Configuration>
+    <ProjectConfiguration Include="MBCSDebug|Win32">
+      <Configuration>MBCSDebug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="MBCS Debug|x64">
-      <Configuration>MBCS Debug</Configuration>
+    <ProjectConfiguration Include="MBCSDebug|x64">
+      <Configuration>MBCSDebug</Configuration>
       <Platform>x64</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="MBCS Release|Win32">
-      <Configuration>MBCS Release</Configuration>
+    <ProjectConfiguration Include="MBCSRelease|Win32">
+      <Configuration>MBCSRelease</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="MBCS Release|x64">
-      <Configuration>MBCS Release</Configuration>
+    <ProjectConfiguration Include="MBCSRelease|x64">
+      <Configuration>MBCSRelease</Configuration>
       <Platform>x64</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Unicode Debug|Win32">
-      <Configuration>Unicode Debug</Configuration>
+    <ProjectConfiguration Include="UnicodeDebug|Win32">
+      <Configuration>UnicodeDebug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Unicode Debug|x64">
-      <Configuration>Unicode Debug</Configuration>
+    <ProjectConfiguration Include="UnicodeDebug|x64">
+      <Configuration>UnicodeDebug</Configuration>
       <Platform>x64</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Unicode Release|Win32">
-      <Configuration>Unicode Release</Configuration>
+    <ProjectConfiguration Include="UnicodeRelease|Win32">
+      <Configuration>UnicodeRelease</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Unicode Release|x64">
-      <Configuration>Unicode Release</Configuration>
+    <ProjectConfiguration Include="UnicodeRelease|x64">
+      <Configuration>UnicodeRelease</Configuration>
       <Platform>x64</Platform>
     </ProjectConfiguration>
   </ItemGroup>
     <ProjectGuid>{06035D5C-5F95-47F2-88B4-D614B0E06D2F}</ProjectGuid>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'" Label="Configuration">
     <UseOfAtl>Static</UseOfAtl>
     <CharacterSet>Unicode</CharacterSet>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'" Label="Configuration">
     <UseOfAtl>Static</UseOfAtl>
     <CharacterSet>MultiByte</CharacterSet>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'" Label="Configuration">
     <UseOfAtl>Static</UseOfAtl>
     <CharacterSet>Unicode</CharacterSet>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <PlatformToolset>v120</PlatformToolset>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'" Label="Configuration">
     <UseOfAtl>Static</UseOfAtl>
     <CharacterSet>Unicode</CharacterSet>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">
     <ClCompile>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <ImageHasSafeExceptionHandlers>true</ImageHasSafeExceptionHandlers>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">
     <ClCompile>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>false</GenerateDebugInformation>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">
     <ClCompile>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>false</GenerateDebugInformation>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">
     <ClCompile>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>false</GenerateDebugInformation>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
       <Culture>0x0411</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">
+    <Link>
+      <ModuleDefinitionFile>SeraphyScriptTools.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="CommDialog.cpp" />
     <ClCompile Include="Control.cpp" />
     <ClCompile Include="SeraphyScriptTools.cpp" />
     <ClCompile Include="Shell.cpp" />
     <ClCompile Include="StdAfx.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">Create</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="TreeItem.cpp" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
     <Midl Include="SeraphyScriptTools.idl">
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">true</GenerateStublessProxies>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">true</GenerateStublessProxies>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">true</GenerateStublessProxies>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">true</GenerateStublessProxies>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">SeraphyScriptTools.h</HeaderFileName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">SeraphyScriptTools.h</HeaderFileName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">SeraphyScriptTools.h</HeaderFileName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">SeraphyScriptTools.h</HeaderFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">true</GenerateStublessProxies>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">true</GenerateStublessProxies>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">true</GenerateStublessProxies>
-      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">true</GenerateStublessProxies>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">SeraphyScriptTools.h</HeaderFileName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">SeraphyScriptTools.h</HeaderFileName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">SeraphyScriptTools.h</HeaderFileName>
-      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">SeraphyScriptTools.h</HeaderFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
-      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">true</GenerateStublessProxies>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">true</GenerateStublessProxies>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">true</GenerateStublessProxies>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">true</GenerateStublessProxies>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">SeraphyScriptTools.h</HeaderFileName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">SeraphyScriptTools.h</HeaderFileName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">SeraphyScriptTools.h</HeaderFileName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">SeraphyScriptTools.h</HeaderFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">true</GenerateStublessProxies>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">true</GenerateStublessProxies>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">true</GenerateStublessProxies>
+      <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">true</GenerateStublessProxies>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">SeraphyScriptTools.h</HeaderFileName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">SeraphyScriptTools.h</HeaderFileName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">SeraphyScriptTools.h</HeaderFileName>
+      <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">SeraphyScriptTools.h</HeaderFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
+      <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
     </Midl>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="SeraphyScriptTools.rc">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCSDebug|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='UnicodeRelease|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCSRelease|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="CComEnumDynaVARIANT.h" />
     <ClInclude Include="CommDialog.h" />
     <ClInclude Include="Control.h" />
     <ClInclude Include="Draw.h" />
     <ClInclude Include="StdAfx.h" />
     <ClInclude Include="TreeItem.h" />
   </ItemGroup>
+  <ItemGroup>
+    <Image Include="commdial.bmp" />
+    <Image Include="instance.bmp" />
+    <Image Include="popupwin.bmp" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
index 4ca2aed..48929bc 100644 (file)
     <ClInclude Include="generic.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="CComEnumDynaVARIANT.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="commdial.bmp">
+      <Filter>Resource Files</Filter>
+    </Image>
+    <Image Include="popupwin.bmp">
+      <Filter>Resource Files</Filter>
+    </Image>
+    <Image Include="instance.bmp">
+      <Filter>Resource Files</Filter>
+    </Image>
   </ItemGroup>
 </Project>
\ No newline at end of file
index fc29bb2..2415dd4 100644 (file)
@@ -1,32 +1,4 @@
-#ifndef _SERAPHYSCRIPTTOOLSCP_H_
-#define _SERAPHYSCRIPTTOOLSCP_H_
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#pragma once
 
 template <class T>
 class CProxy_IOverlappedWindowEvents : public IConnectionPointImpl<T, &DIID__IOverlappedWindowEvents, CComDynamicUnkArray>
@@ -39,22 +11,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0xa, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRClick()
        {
@@ -62,22 +32,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0xb, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnDblClick()
        {
@@ -85,22 +53,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0xc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRDblClick()
        {
@@ -108,22 +74,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0xd, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnSize()
        {
@@ -131,22 +95,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0xe, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnCommand()
        {
@@ -154,22 +116,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0xf, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnDropFiles()
        {
@@ -177,22 +137,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x10, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnMouseMove()
        {
@@ -200,22 +158,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x11, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnClickOut()
        {
@@ -223,22 +179,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x12, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRClickOut()
        {
@@ -246,22 +200,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x13, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnClickCancel()
        {
@@ -269,22 +221,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x14, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRClickCancel()
        {
@@ -292,22 +242,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x15, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnTimer()
        {
@@ -315,22 +263,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x16, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnOK()
        {
@@ -338,22 +284,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x17, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnCancel()
        {
@@ -361,22 +305,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x18, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnExit()
        {
@@ -384,22 +326,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x19, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_InitWindow()
        {
@@ -407,22 +347,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x1a, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_ExitWindow()
        {
@@ -430,22 +368,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x1b, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnClickEx(IUnknown * varObj)
        {
@@ -454,24 +390,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x6e, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRClickEx(IUnknown * varObj)
        {
@@ -480,24 +414,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x6f, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnDblClickEx(IUnknown * varObj)
        {
@@ -506,24 +438,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x70, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRDblClickEx(IUnknown * varObj)
        {
@@ -532,24 +462,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x71, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnSizeEx(IUnknown * varObj)
        {
@@ -558,24 +486,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x72, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnCommandEx(IUnknown * varObj)
        {
@@ -584,24 +510,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x73, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnDropFilesEx(IUnknown * varObj)
        {
@@ -610,24 +534,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x74, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnMouseMoveEx(IUnknown * varObj)
        {
@@ -636,24 +558,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x75, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnClickOutEx(IUnknown * varObj)
        {
@@ -662,24 +582,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x76, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRClickOutEx(IUnknown * varObj)
        {
@@ -688,24 +606,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x77, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnClickCancelEx(IUnknown * varObj)
        {
@@ -714,24 +630,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x78, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnRClickCancelEx(IUnknown * varObj)
        {
@@ -740,24 +654,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x79, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnTimerEx(IUnknown * varObj)
        {
@@ -766,24 +678,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x7a, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnOKEx(IUnknown * varObj)
        {
@@ -792,24 +702,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x7b, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnCancelEx(IUnknown * varObj)
        {
@@ -818,24 +726,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x7c, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnExitEx(IUnknown * varObj)
        {
@@ -844,24 +750,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x7d, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_InitWindowEx(IUnknown * varObj)
        {
@@ -870,24 +774,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x7e, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_ExitWindowEx(IUnknown * varObj)
        {
@@ -896,24 +798,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = varObj;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x7f, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnContextMenu()
        {
@@ -921,22 +821,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x80, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnContextMenuEx(IUnknown * punkVal)
        {
@@ -945,24 +843,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = punkVal;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x81, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnContextDelete()
        {
@@ -970,22 +866,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x82, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnContextDeleteEx(IUnknown * punkVal)
        {
@@ -994,24 +888,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = punkVal;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x83, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnKeydown()
        {
@@ -1019,22 +911,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x84, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnKeydownEx(IUnknown * punkVal)
        {
@@ -1043,24 +933,22 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = punkVal;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x85, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnKeydown2()
        {
@@ -1068,22 +956,20 @@ public:
                T* pT = static_cast<T*>(this);
                int nConnectionIndex;
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
-                               DISPPARAMS disp = { NULL, NULL, 0, 0 };
+                               DISPPARAMS disp = {NULL, NULL, 0, 0};
                                pDispatch->Invoke(0x86, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                return varResult.scode;
-       
+
        }
        HRESULT Fire_OnKeydown2Ex(IUnknown * punkVal)
        {
@@ -1092,24 +978,21 @@ public:
                int nConnectionIndex;
                CComVariant* pvars = new CComVariant[1];
                int nConnections = m_vec.GetSize();
-               
-               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
-               {
+
+               for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) {
                        pT->Lock();
                        CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
                        pT->Unlock();
                        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
-                       if (pDispatch != NULL)
-                       {
+                       if (pDispatch != NULL) {
                                VariantClear(&varResult);
                                pvars[0] = punkVal;
-                               DISPPARAMS disp = { pvars, NULL, 1, 0 };
+                               DISPPARAMS disp = {pvars, NULL, 1, 0};
                                pDispatch->Invoke(0x87, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
                        }
                }
                delete[] pvars;
                return varResult.scode;
-       
+
        }
 };
-#endif
\ No newline at end of file
index c0e91cf..074edf4 100644 (file)
--- a/Shell.cpp
+++ b/Shell.cpp
@@ -12,20 +12,6 @@ using namespace std;
 /////////////////////////////////////////////////////////////////////////////
 // CShell
 
-STDMETHODIMP CShell::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_ISeraphyScriptTools_Shell
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
 STDMETHODIMP CShell::ShellExecute(VARIANT path, VARIANT param, VARIANT initdir, VARIANT show, VARIANT *punkVal)
 {
        ATL::CString szPath;
@@ -49,26 +35,25 @@ STDMETHODIMP CShell::ShellExecute(VARIANT path, VARIANT param, VARIANT initdir,
        int nShow = SW_SHOWNORMAL;
        CComVariant varMode;
        if (varMode.ChangeType(VT_I2, &show) == S_OK) {
-               switch (varMode.iVal)
-               {
-               case 0:
+               switch (varMode.iVal) {
+                       case 0:
                        nShow = SW_HIDE;
                        break;
 
-               case 1:
-               default:
+                       case 1:
+                       default:
                        nShow = SW_SHOWNORMAL;
                        break;
 
-               case 2:
+                       case 2:
                        nShow = SW_SHOWMAXIMIZED;
                        break;
 
-               case 3:
+                       case 3:
                        nShow = SW_SHOWMINIMIZED;
                        break;
 
-               case 4:
+                       case 4:
                        nShow = SW_SHOWMINNOACTIVE;
                        break;
                }
@@ -77,13 +62,13 @@ STDMETHODIMP CShell::ShellExecute(VARIANT path, VARIANT param, VARIANT initdir,
        //
        SHELLEXECUTEINFO info = {0};
        info.cbSize = sizeof(SHELLEXECUTEINFO);
-       info.fMask  = SEE_MASK_DOENVSUBST | SEE_MASK_NOCLOSEPROCESS;
-       info.hwnd   = GetMainWindow();
+       info.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_NOCLOSEPROCESS;
+       info.hwnd = GetMainWindow();
        info.lpVerb = _TEXT("OPEN");
        info.lpFile = szPath;
        info.lpParameters = szParam;
-       info.lpDirectory  = szInitDir;
-       info.nShow  = nShow;
+       info.lpDirectory = szInitDir;
+       info.nShow = nShow;
        if (ShellExecuteEx(&info)) {
                // ShellExecObj\82Ì\90\90¬
                CComObject<CShellExecObj>* pExec = NULL;
@@ -91,7 +76,7 @@ STDMETHODIMP CShell::ShellExecute(VARIANT path, VARIANT param, VARIANT initdir,
                        pExec->m_hProcess = info.hProcess;
                        IUnknown* pUnk = NULL;
                        pExec->QueryInterface(IID_IUnknown, (void**)&pUnk);
-                       punkVal->vt      = VT_UNKNOWN;
+                       punkVal->vt = VT_UNKNOWN;
                        punkVal->punkVal = pUnk;
                }
        }
@@ -124,7 +109,7 @@ STDMETHODIMP CShellExecObj::Wait(VARIANT tim, VARIANT *pVal)
                        bExit = false;
                }
        }
-       pVal->vt      = VT_BOOL;
+       pVal->vt = VT_BOOL;
        pVal->boolVal = bExit ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
@@ -142,7 +127,7 @@ class SPECIALFOLDERPAIR
 public:
        SPECIALFOLDERPAIR(LPCTSTR arg_name, int arg_id) {
                name = arg_name;
-               id   = arg_id;
+               id = arg_id;
        }
        LPCTSTR name;
        int id;
@@ -202,7 +187,7 @@ STDMETHODIMP CShell::GetSpecialFolderLocations(IUnknown *punkVal)
                lst.push_back(SPECIALFOLDERPAIR(_TEXT("TEMPLATES"), CSIDL_TEMPLATES));
                lst.push_back(SPECIALFOLDERPAIR(_TEXT("WINDOWS"), CSIDL_WINDOWS));
        }
-       else{
+       else {
                // Win9x
                lst.push_back(SPECIALFOLDERPAIR(_TEXT("ADMINTOOLS"), CSIDL_ADMINTOOLS));
                lst.push_back(SPECIALFOLDERPAIR(_TEXT("ALTSTARTUP"), CSIDL_ALTSTARTUP));
@@ -264,7 +249,7 @@ STDMETHODIMP CShell::get_IsWindowNT(BOOL *pVal)
        OSVERSIONINFO vinfo = {0};
        vinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
        GetVersionEx(&vinfo);
-       *pVal = (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
+       *pVal = (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
        return S_OK;
 }
 
@@ -282,30 +267,30 @@ STDMETHODIMP CShell::get_WindowsVersion(long *pVal)
        return S_OK;
 }
 
-STDMETHODIMP CShell::GetDLLVersion(VARIANT text,VARIANT min, VARIANT *pVal)
+STDMETHODIMP CShell::GetDLLVersion(VARIANT text, VARIANT min, VARIANT *pVal)
 {
        ATL::CString lpszDllName;
        CComVariant varText;
-       if (varText.ChangeType(VT_BSTR,&text) == S_OK) {
+       if (varText.ChangeType(VT_BSTR, &text) == S_OK) {
                lpszDllName = varText.bstrVal;
        }
 
        BOOL bMin = false;
        CComVariant varMin;
-       if(varMin.ChangeType(VT_I2,&min) == S_OK){
+       if (varMin.ChangeType(VT_I2, &min) == S_OK) {
                bMin = varMin.iVal;
        }
 
        CComVariant ret;
-       DWORD siz = GetFileVersionInfoSize(lpszDllName,0);
+       DWORD siz = GetFileVersionInfoSize(lpszDllName, 0);
        if (siz) {
                std::vector<BYTE> buf(siz + 1);
                LPBYTE pBuf = &buf[0];
-               if (GetFileVersionInfo(lpszDllName, 0, siz,pBuf)) {
+               if (GetFileVersionInfo(lpszDllName, 0, siz, pBuf)) {
                        // \83o\81[\83W\83\87\83\93\8fî\95ñ\82ð\8eæ\93¾\82·\82é
                        VS_FIXEDFILEINFO* pverInfo;
                        UINT sz = 0;
-                       if (VerQueryValue(pBuf,_TEXT("\\"), (void**) &pverInfo, &sz)) {
+                       if (VerQueryValue(pBuf, _TEXT("\\"), (void**)&pverInfo, &sz)) {
                                // \83o\81[\83W\83\87\83\93\82ð\8am\94F\89Â\94\\82Å\82 \82é
                                TCHAR mes[256];
                                if (bMin) {
@@ -337,13 +322,13 @@ STDMETHODIMP CShell::ParseName(VARIANT text, VARIANT *pVal)
        ::VariantInit(pVal);
 
        CComVariant varText;
-       if (varText.ChangeType(VT_BSTR,&text) == S_OK) {
+       if (varText.ChangeType(VT_BSTR, &text) == S_OK) {
                CComObject<CParseName>* pParse = NULL;
                if (pParse->CreateInstance(&pParse) == S_OK) {
                        pParse->m_bstr_path = (LPCWSTR)varText.bstrVal;
                        IUnknown* pUnk = NULL;
-                       if (pParse->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK) {
-                               pVal->vt      = VT_UNKNOWN;
+                       if (pParse->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
+                               pVal->vt = VT_UNKNOWN;
                                pVal->punkVal = pUnk;
                        }
                }
@@ -360,7 +345,7 @@ STDMETHODIMP CParseName::InterfaceSupportsErrorInfo(REFIID riid)
                &IID_ISeraphyScriptTool_ParseName
        };
 
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) {
+       for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) {
                if (IsEqualGUID(*arr[i], riid)) {
                        return S_OK;
                }
@@ -401,9 +386,9 @@ STDMETHODIMP CParseName::put_FileName(BSTR newVal)
        WCHAR buf[MAX_PATH];
        lstrcpyW(buf, m_bstr_path);
        LPWSTR p = buf;
-       while(*p)p++;
-       while(p > buf){
-               if(*p == '\\' || *p == '/'){
+       while (*p)p++;
+       while (p > buf) {
+               if (*p == '\\' || *p == '/') {
                        // \96\96\94ö\82©\82ç\8dÅ\8f\89\82É\94­\8c©\82³\82ê\82½\83t\83H\83\8b\83_\83v\83\8c\81[\83X\82Å\8e~\82Ü\82é
                        p++;
                        break;
@@ -419,7 +404,7 @@ STDMETHODIMP CParseName::get_Extention(BSTR *pVal)
 {
        BOOL bFind = false;
        LPWSTR p = m_bstr_path;
-       while(*p)p++;
+       while (*p)p++;
        while (p > (LPCWSTR)m_bstr_path) {
                if (*p == '.') {
                        bFind = true;
@@ -442,7 +427,7 @@ STDMETHODIMP CParseName::get_Extention(BSTR *pVal)
 STDMETHODIMP CParseName::put_Extention(BSTR newVal)
 {
        WCHAR buf[MAX_PATH];
-       lstrcpyW(buf,m_bstr_path);
+       lstrcpyW(buf, m_bstr_path);
        BOOL bFind = false;
        LPWSTR p = buf;
        while (*p) p++;
@@ -471,19 +456,19 @@ STDMETHODIMP CParseName::put_Extention(BSTR newVal)
 STDMETHODIMP CParseName::get_Name(BSTR *pVal)
 {
        WCHAR buf[MAX_PATH];
-       lstrcpyW(buf,m_bstr_path);
+       lstrcpyW(buf, m_bstr_path);
        LPWSTR p = buf;
-       while(*p)p++;
-       while(p > buf){
-               if(*p == '\\' || *p == '/'){
+       while (*p)p++;
+       while (p > buf) {
+               if (*p == '\\' || *p == '/') {
                        p++;
                        break;
                }
                p--;
        }
        LPWSTR p2 = p;
-       while(*p2){
-               if(*p2 == '.'){
+       while (*p2) {
+               if (*p2 == '.') {
                        *p2 = 0;
                        break;
                }
@@ -496,30 +481,30 @@ STDMETHODIMP CParseName::get_Name(BSTR *pVal)
 STDMETHODIMP CParseName::put_Name(BSTR newVal)
 {
        WCHAR buf[MAX_PATH];
-       WCHAR ext[MAX_PATH] = { 0 };
-       lstrcpyW(buf,m_bstr_path);
+       WCHAR ext[MAX_PATH] = {0};
+       lstrcpyW(buf, m_bstr_path);
        LPWSTR p = buf;
-       while(*p)p++;
-       while(p > buf){
-               if(*p == '\\' || *p == '/'){
+       while (*p)p++;
+       while (p > buf) {
+               if (*p == '\\' || *p == '/') {
                        p++;
                        break;
                }
                p--;
        }
        LPWSTR p2 = p;
-       while(*p2){
-               if(*p2 == '.'){
+       while (*p2) {
+               if (*p2 == '.') {
                        p2++;
-                       lstrcpyW(ext,p2);
+                       lstrcpyW(ext, p2);
                        break;
                }
                p2++;
        }
-       lstrcpyW(p,newVal);
-       while(*p)p++;
+       lstrcpyW(p, newVal);
+       while (*p)p++;
        *p++ = '.';
-       lstrcpyW(p,ext);
+       lstrcpyW(p, ext);
        m_bstr_path = buf;
        return S_OK;
 }
@@ -527,12 +512,12 @@ STDMETHODIMP CParseName::put_Name(BSTR newVal)
 STDMETHODIMP CParseName::get_Drive(BSTR *pVal)
 {
        WCHAR buf[MAX_PATH];
-       lstrcpyW(buf,m_bstr_path);
+       lstrcpyW(buf, m_bstr_path);
        LPWSTR p = buf;
-       while(*p){
-               if(*p == ':'){
+       while (*p) {
+               if (*p == ':') {
                        // \83h\83\89\83C\83u\8bæ\90Ø\82è\81A\82Ü\82½\82Í\83v\83\8d\83g\83R\83\8b\82ð\94­\8c©\82µ\82½
-                       *(p+1) = 0;
+                       *(p + 1) = 0;
                        p = buf;
                        break;
                }
@@ -545,13 +530,13 @@ STDMETHODIMP CParseName::get_Drive(BSTR *pVal)
 STDMETHODIMP CParseName::put_Drive(BSTR newVal)
 {
        WCHAR buf[MAX_PATH];
-       lstrcpyW(buf,newVal);
+       lstrcpyW(buf, newVal);
        LPWSTR p2 = buf;
-       while(*p2)p2++;
+       while (*p2)p2++;
        LPWSTR p = m_bstr_path;
        BOOL bFind = false;
-       while(*p){
-               if(*p == ':'){
+       while (*p) {
+               if (*p == ':') {
                        // \83h\83\89\83C\83u\8bæ\90Ø\82è\81A\82Ü\82½\82Í\83v\83\8d\83g\83R\83\8b\82ð\94­\8c©\82µ\82½
                        p++;
                        bFind = true;
@@ -559,10 +544,10 @@ STDMETHODIMP CParseName::put_Drive(BSTR newVal)
                }
                p++;
        }
-       if(!bFind){
+       if (!bFind) {
                p = m_bstr_path;
        }
-       lstrcpyW(p2,p);
+       lstrcpyW(p2, p);
        m_bstr_path = buf;
        return S_OK;
 }
@@ -572,8 +557,8 @@ STDMETHODIMP CParseName::get_Directory(BSTR *pVal)
        WCHAR buf[MAX_PATH];
        LPWSTR p = m_bstr_path;
        BOOL bFind = false;
-       while(*p){
-               if(*p == ':'){
+       while (*p) {
+               if (*p == ':') {
                        // \83h\83\89\83C\83u\8bæ\90Ø\82è\81A\82Ü\82½\82Í\83v\83\8d\83g\83R\83\8b\82ð\94­\8c©\82µ\82½
                        p++;
                        bFind = true;
@@ -581,16 +566,16 @@ STDMETHODIMP CParseName::get_Directory(BSTR *pVal)
                }
                p++;
        }
-       if(!bFind){
+       if (!bFind) {
                p = m_bstr_path;
        }
-       lstrcpyW(buf,p);
+       lstrcpyW(buf, p);
        p = buf;
-       while(*p)p++;
-       while(p >= buf){
-               if(*p == '\\' || *p== '/'){
+       while (*p)p++;
+       while (p >= buf) {
+               if (*p == '\\' || *p == '/') {
                        // \83t\83H\83\8b\83_\83v\83\8c\83C\83X\82ð\94­\8c©\82µ\82½
-                       if(p-1 > buf && (*(p-1) == '\\' || *(p-1) == '/')){
+                       if (p - 1 > buf && (*(p - 1) == '\\' || *(p - 1) == '/')) {
                                // \83l\83b\83g\83\8f\81[\83N\83p\83X\82É\93\9e\92B\82µ\82½\8fê\8d\87\82Í\96³\8e\8b\82·\82é
                                break;
                        }
@@ -608,7 +593,7 @@ STDMETHODIMP CParseName::get_Directory(BSTR *pVal)
 
 STDMETHODIMP CShell::get_Confirm(BOOL *pVal)
 {
-       *pVal = (m_bConfirm)?VB_TRUE:VB_FALSE;
+       *pVal = (m_bConfirm) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -620,7 +605,7 @@ STDMETHODIMP CShell::put_Confirm(BOOL newVal)
 
 STDMETHODIMP CShell::get_Silent(BOOL *pVal)
 {
-       *pVal = (m_bSilent)?VB_TRUE:VB_FALSE;
+       *pVal = (m_bSilent) ? VB_TRUE : VB_FALSE;
        return S_OK;
 }
 
@@ -645,7 +630,7 @@ STDMETHODIMP CShell::Move(VARIANT from, VARIANT to, VARIANT *pVal)
        return FileOperationCore(FO_MOVE, 0, &from, &to, pVal);
 }
 
-STDMETHODIMP CShell::Delete(VARIANT from,VARIANT *pVal)
+STDMETHODIMP CShell::Delete(VARIANT from, VARIANT *pVal)
 {
        return FileOperationCore(FO_DELETE, 0, &from, NULL, pVal);
 }
@@ -658,7 +643,7 @@ HRESULT CShell::FileOperationCore(UINT wFunc, FILEOP_FLAGS flag, VARIANT *from,
        ATL::CString szTo;
        if (to) {
                CComVariant varTo;
-               if(to->vt != VT_NULL && to->vt != VT_ERROR || to->vt == VT_EMPTY
+               if (to->vt != VT_NULL && to->vt != VT_ERROR || to->vt == VT_EMPTY
                        || varTo.ChangeType(VT_BSTR, to) != S_OK) {
                        return DISP_E_TYPEMISMATCH;
                }
@@ -675,11 +660,11 @@ HRESULT CShell::FileOperationCore(UINT wFunc, FILEOP_FLAGS flag, VARIANT *from,
        }
 
        SHFILEOPSTRUCT info = {0};
-       info.fFlags = flag | FOF_ALLOWUNDO | (m_bSilent?FOF_SILENT:0) | (m_bConfirm?0:(FOF_NOCONFIRMMKDIR|FOF_NOCONFIRMATION));
-       info.hwnd   = GetMainWindow();
-       info.pFrom  = &buf[0];
-       info.pTo    = pTo;
-       info.wFunc  = wFunc;
+       info.fFlags = flag | FOF_ALLOWUNDO | (m_bSilent ? FOF_SILENT : 0) | (m_bConfirm ? 0 : (FOF_NOCONFIRMMKDIR | FOF_NOCONFIRMATION));
+       info.hwnd = GetMainWindow();
+       info.pFrom = &buf[0];
+       info.pTo = pTo;
+       info.wFunc = wFunc;
        int ret = SHFileOperation(&info);
 
        result = (bool)(!ret && !info.fAnyOperationsAborted);
@@ -697,14 +682,14 @@ bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
                int bufsiz = tmp.GetLength() + 2; // \83_\83u\83\8b\83k\83\8b\8fI\92[\95ª
                buf.resize(bufsiz, 0);
                LPTSTR pBuf = &buf[0];
-               StringCbCopy(pBuf, bufsiz, tmp);
+               StringCchCopy(pBuf, bufsiz, tmp);
                return true;
        }
 
        // Unknown -> IObjectVector \82É\95Ï\8a·\89Â\94\\82©?
        if (varFrom.ChangeType(VT_UNKNOWN, &from) == S_OK) {
                IObjectVector* pVector = NULL;
-               if (varFrom.punkVal->QueryInterface(IID_IObjectVector,(void**)&pVector) != S_OK) {
+               if (varFrom.punkVal->QueryInterface(IID_IObjectVector, (void**)&pVector) != S_OK) {
                        // IObjectVector\82Å\82Í\82È\82¢\82È\82ç\83G\83\89\81[
                        return false;
                }
@@ -715,11 +700,11 @@ bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
                long cnt = 0;
                // \94z\97ñ\91S\91Ì\82Ì\83T\83C\83Y\82ð\8b\81\82ß\82é
                DWORD needsize = 0;
-               for(cnt = 0 ; cnt < mx ; cnt++){
+               for (cnt = 0; cnt < mx; cnt++) {
                        CComVariant tmp;
                        CComVariant idx((long)cnt);
-                       pVector->get_Value(idx,&tmp);
-                       if(tmp.ChangeType(VT_BSTR) != S_OK){
+                       pVector->get_Value(idx, &tmp);
+                       if (tmp.ChangeType(VT_BSTR) != S_OK) {
                                // \95\8e\9a\97ñ\82É\95Ï\8a·\95s\89Â\94\
                                return false;
                        }
@@ -732,13 +717,13 @@ bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
                buf.resize(needsize, 0);
                LPTSTR pBuf = &buf[0];
                LPTSTR p = pBuf;
-               for (cnt = 0 ; cnt < mx ; cnt++) {
+               for (cnt = 0; cnt < mx; cnt++) {
                        CComVariant tmp;
                        CComVariant idx((long)cnt);
                        if (SUCCEEDED(pVector->get_Value(idx, &tmp))) {
                                if (tmp.ChangeType(VT_BSTR) == S_OK) {
                                        ATL::CString szTmp(tmp.bstrVal);
-                                       StringCbCopy(p, needsize, szTmp);
+                                       StringCchCopy(p, needsize, szTmp);
                                        int len = szTmp.GetLength() + 1;
                                        p += len;
                                        needsize -= len;
@@ -771,7 +756,7 @@ bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
        DWORD needsize = 0;
        long dim[1];
        // \83o\83b\83t\83@\82É\95K\97v\82È\83T\83C\83Y\82ð\8b\81\82ß\82é
-       for (long cnt = 0 ; cnt <= ub ; cnt++) {
+       for (long cnt = 0; cnt <= ub; cnt++) {
                CComVariant tmp;
                dim[0] = cnt;
                SafeArrayGetElement(pArray, dim, &tmp);
@@ -788,7 +773,7 @@ bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
        buf.resize(needsize);
        LPTSTR pBuf = &buf[0];
        LPTSTR p = pBuf;
-       for (long cnt = 0 ; cnt <= ub ; cnt++) {
+       for (long cnt = 0; cnt <= ub; cnt++) {
                CComVariant tmp;
                dim[0] = cnt;
                SafeArrayGetElement(pArray, dim, &tmp);
@@ -798,7 +783,7 @@ bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
                }
 
                ATL::CString szTmp(tmp.bstrVal);
-               StringCbCopy(p, needsize, szTmp);
+               StringCchCopy(p, needsize, szTmp);
                int len = szTmp.GetLength() + 1;
                p += len;
                needsize -= len;
@@ -832,7 +817,7 @@ STDMETHODIMP CShell::EmptyRecycleBin(VARIANT dir)
                }
        }
 
-       SHEmptyRecycleBin(NULL, pTarget, (m_bConfirm?0:SHERB_NOCONFIRMATION) | (m_bSilent?(SHERB_NOPROGRESSUI|SHERB_NOSOUND) : 0));
+       SHEmptyRecycleBin(NULL, pTarget, (m_bConfirm ? 0 : SHERB_NOCONFIRMATION) | (m_bSilent ? (SHERB_NOPROGRESSUI | SHERB_NOSOUND) : 0));
        return S_OK;
 }
 
@@ -840,22 +825,22 @@ STDMETHODIMP CShell::RecentDocs(VARIANT text)
 {
        LPCTSTR pTarget = NULL;
 
-       if(text.vt == VT_NULL || text.vt == VT_ERROR || text.vt == VT_EMPTY){
+       if (text.vt == VT_NULL || text.vt == VT_ERROR || text.vt == VT_EMPTY) {
                // \97\9a\97ð\82ð\83N\83\8a\83A\82·\82é
                pTarget = NULL;
        }
        else {
                ATL::CString szPath;
                CComVariant varText;
-               if (varText.ChangeType(VT_BSTR, &text) == S_OK){
+               if (varText.ChangeType(VT_BSTR, &text) == S_OK) {
                        // \93Á\92è\82Ì\83t\83@\83C\83\8b\82ð\92Ç\89Á\82·\82é
-                       szPath = text.bstrVal;
+                       szPath = varText.bstrVal;
                        if (!szPath.IsEmpty()) {
                                // \8bó\95\8e\9a\82Å\82È\82¯\82ê\82Î
                                pTarget = szPath;
                        }
                }
-               else{
+               else {
                        // \95Ï\8a·\95s\89Â
                        return DISP_E_TYPEMISMATCH;
                }
@@ -867,7 +852,7 @@ STDMETHODIMP CShell::RecentDocs(VARIANT text)
 STDMETHODIMP CShell::SetMainWindow(VARIANT varUnk)
 {
        // \8aù\91\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82Ì\89ð\95ú
-       if(m_pMainWindow){
+       if (m_pMainWindow) {
                m_pMainWindow->Release();
                m_pMainWindow = NULL;
        }
@@ -886,14 +871,14 @@ STDMETHODIMP CShell::IsExist(VARIANT name, VARIANT *pVal)
        CComVariant varRet;
 
        CComVariant varName;
-       if (varName.ChangeType(VT_BSTR, &name) != S_OK){
+       if (varName.ChangeType(VT_BSTR, &name) != S_OK) {
                return DISP_E_TYPEMISMATCH;
        }
 
        ATL::CString szPath(varName.bstrVal);
 
        DWORD attr = GetFileAttributes(szPath);
-       if (attr != (DWORD) -1) {
+       if (attr != (DWORD)-1) {
                if (attr & FILE_ATTRIBUTE_DIRECTORY) {
                        varRet = 2;
                }
diff --git a/Shell.h b/Shell.h
index 75c7af8..5d5b381 100644 (file)
--- a/Shell.h
+++ b/Shell.h
@@ -1,7 +1,6 @@
 // Shell.h : CShell \82Ì\90é\8c¾
 
-#ifndef __SHELL_H_
-#define __SHELL_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 
@@ -9,25 +8,26 @@
 
 /////////////////////////////////////////////////////////////////////////////
 // CShell
-class ATL_NO_VTABLE CShell : 
+class ATL_NO_VTABLE CShell :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CShell, &CLSID_SeraphyScriptTools_Shell>,
-       public ISupportErrorInfo,
+       public ISupportErrorInfoImpl<&IID_ISeraphyScriptTools_Shell>,
        public IDispatchImpl<ISeraphyScriptTools_Shell, &IID_ISeraphyScriptTools_Shell, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
        CShell()
        {
                m_bConfirm = true;
-               m_bSilent  = false;
+               m_bSilent = false;
                //
                m_pMainWindow = NULL;
-               m_pMalloc  = NULL;
+               m_pMalloc = NULL;
                SHGetMalloc(&m_pMalloc);
        }
+
        void FinalRelease()
        {
-               if(m_pMalloc){
+               if (m_pMalloc) {
                        m_pMalloc->Release();
                        m_pMalloc = NULL;
                }
@@ -36,35 +36,28 @@ public:
        HWND GetMainWindow()
        {
                HWND hWnd = NULL;//m_hStaticMainWindow;
-               if(m_pMainWindow){
+               if (m_pMainWindow) {
                        m_pMainWindow->get_HWND((long*)&hWnd);
                }
                return hWnd;
        }
 
-DECLARE_REGISTRY_RESOURCEID(IDR_SHELL)
+       DECLARE_REGISTRY_RESOURCEID(IDR_SHELL)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CShell)
-       COM_INTERFACE_ENTRY(ISeraphyScriptTools_Shell)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
-
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
+       BEGIN_COM_MAP(CShell)
+               COM_INTERFACE_ENTRY(ISeraphyScriptTools_Shell)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+       END_COM_MAP()
 
-// ISeraphyScriptTools_Shell
+       // ISeraphyScriptTools_Shell
 public:
        STDMETHOD(IsExist)(/*[in]*/VARIANT name,/*[out,retval]*/VARIANT* pVal);
        STDMETHOD(SetMainWindow)(/*[in]*/VARIANT varUnk);
        STDMETHOD(RecentDocs)(/*[in,optional]*/VARIANT text);
        STDMETHOD(EmptyRecycleBin)(/*[in,optional]*/VARIANT dir);
-       BOOL m_bSilent;
-       BOOL m_bConfirm;
-       HRESULT FileOperationCore(UINT wFunc,FILEOP_FLAGS flag,VARIANT* from,VARIANT* to,VARIANT* pResult);
-       bool CreateDNStringFromVariant(VARIANT& from, std::vector<TCHAR> &buf);
        STDMETHOD(get_Silent)(/*[out, retval]*/ BOOL *pVal);
        STDMETHOD(put_Silent)(/*[in]*/ BOOL newVal);
        STDMETHOD(get_Confirm)(/*[out, retval]*/ BOOL *pVal);
@@ -79,9 +72,15 @@ public:
        STDMETHOD(get_IsWindowNT)(/*[out, retval]*/ BOOL *pVal);
        STDMETHOD(GetSpecialFolderLocations)(/*[in]*/IUnknown* punkVal);
        STDMETHOD(ShellExecute)(/*[in]*/VARIANT path,/*[in,optional]*/VARIANT param,/*[in,optional]*/VARIANT initdir,/*[in,optional]*/VARIANT mode, /*[out,retval]*/VARIANT* punkVal);
+
 protected:
+       BOOL m_bSilent;
+       BOOL m_bConfirm;
        IMalloc* m_pMalloc;
        IOverlappedWindow* m_pMainWindow;
+
+       HRESULT FileOperationCore(UINT wFunc, FILEOP_FLAGS flag, VARIANT* from, VARIANT* to, VARIANT* pResult);
+       bool CreateDNStringFromVariant(VARIANT& from, std::vector<TCHAR> &buf);
 };
 
 // Shell.h : CShellExecObj \82Ì\90é\8c¾
@@ -89,9 +88,9 @@ protected:
 
 /////////////////////////////////////////////////////////////////////////////
 // CShellExecObj
-class ATL_NO_VTABLE CShellExecObj : 
+class ATL_NO_VTABLE CShellExecObj :
        public CComObjectRootEx<CComSingleThreadModel>,
-//     public CComCoClass<CShellExecObj, &CLSID_ShellExecObj>,
+       //      public CComCoClass<CShellExecObj, &CLSID_ShellExecObj>,
        public IDispatchImpl<IShellExecObj, &IID_IShellExecObj, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
@@ -101,21 +100,21 @@ public:
        }
        void FinalRelease()
        {
-               if(m_hProcess){
+               if (m_hProcess) {
                        CloseHandle(m_hProcess);
                        m_hProcess = NULL;
                }
        }
-DECLARE_REGISTRY_RESOURCEID(IDR_SHELLEXECOBJ)
+       DECLARE_REGISTRY_RESOURCEID(IDR_SHELLEXECOBJ)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CShellExecObj)
-       COM_INTERFACE_ENTRY(IShellExecObj)
-       COM_INTERFACE_ENTRY(IDispatch)
-END_COM_MAP()
+       BEGIN_COM_MAP(CShellExecObj)
+               COM_INTERFACE_ENTRY(IShellExecObj)
+               COM_INTERFACE_ENTRY(IDispatch)
+       END_COM_MAP()
 
-// IShellExecObj
+       // IShellExecObj
 public:
        STDMETHOD(get_ExitCode)(/*[out, retval]*/ long *pVal);
        STDMETHOD(Wait)(/*[in,optional]*/VARIANT tim,/*[out,retval]*/VARIANT* pVal);
@@ -127,7 +126,7 @@ public:
 
 /////////////////////////////////////////////////////////////////////////////
 // CParseName
-class ATL_NO_VTABLE CParseName : 
+class ATL_NO_VTABLE CParseName :
        public CComObjectRootEx<CComSingleThreadModel>,
        public CComCoClass<CParseName, &CLSID_ParseName>,
        public ISupportErrorInfo,
@@ -138,20 +137,20 @@ public:
        {
        }
 
-DECLARE_REGISTRY_RESOURCEID(IDR_PARSENAME)
+       DECLARE_REGISTRY_RESOURCEID(IDR_PARSENAME)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CParseName)
-       COM_INTERFACE_ENTRY(ISeraphyScriptTool_ParseName)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
+       BEGIN_COM_MAP(CParseName)
+               COM_INTERFACE_ENTRY(ISeraphyScriptTool_ParseName)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+       END_COM_MAP()
 
-// ISupportsErrorInfo
+       // ISupportsErrorInfo
        STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
 
-// ISeraphyScriptTool_ParseName
+       // ISeraphyScriptTool_ParseName
 public:
        STDMETHOD(get_Directory)(/*[out, retval]*/ BSTR *pVal);
        STDMETHOD(get_Drive)(/*[out, retval]*/ BSTR *pVal);
@@ -166,5 +165,3 @@ public:
        STDMETHOD(put_PathName)(/*[in]*/ BSTR newVal);
        CComBSTR m_bstr_path;
 };
-
-#endif //__SHELL_H_
index f4a5b38..5b830dd 100644 (file)
--- a/StdAfx.h
+++ b/StdAfx.h
@@ -2,23 +2,41 @@
 //            \82Ü\82½\82Í\8eQ\8fÆ\89ñ\90\94\82ª\91½\82­\81A\82©\82Â\82 \82Ü\82è\95Ï\8dX\82³\82ê\82È\82¢
 //            \83v\83\8d\83W\83F\83N\83g\90ê\97p\82Ì\83C\83\93\83N\83\8b\81[\83\83t\83@\83C\83\8b\82ð\8bL\8fq\82µ\82Ü\82·\81B
 
-#if !defined(AFX_STDAFX_H__8CB29832_BD58_4AC5_92EB_DB8B53DF0C73__INCLUDED_)
-#define AFX_STDAFX_H__8CB29832_BD58_4AC5_92EB_DB8B53DF0C73__INCLUDED_
-
-#if _MSC_VER > 1000
 #pragma once
-#endif // _MSC_VER > 1000
 
 #define STRICT
+
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0500
 #endif
+
 #define _ATL_APARTMENT_THREADED
 
+//#define _ATL_NO_AUTOMATIC_NAMESPACE
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS     // \88ê\95\94\82Ì CString \83R\83\93\83X\83g\83\89\83N\83^\82Í\96¾\8e¦\93I\82Å\82·\81B
+
+// Enabling Visual Style
+#define ISOLATION_AWARE_ENABLED 1
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif 
+
 #include <atlbase.h>
+
 // CComModule \83N\83\89\83X\82©\82ç\94h\90\82µ\82½\83N\83\89\83X\82ð\8eg\97p\82µ\82Ä\81A\83I\81[\83o\81[\83\89\83C\83h\82·\82é\8fê\8d\87
 // _Module \82Ì\96¼\91O\82Í\95Ï\8dX\82µ\82È\82¢\82Å\82­\82¾\82³\82¢\81B
-extern CComModule _Module;
+extern ATL::CComModule _Module;
+
 #include <atlcom.h>
 #include <atlctl.h>
 #include <atlstr.h>
@@ -32,7 +50,13 @@ extern CComModule _Module;
 #define WM_MOVENEXT_OVERLAPPED (WM_USER + 100)
 #define WM_KEYDOWN_EX (WM_USER + 101)
 
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ \82Í\91O\8ds\82Ì\92¼\91O\82É\92Ç\89Á\82Ì\90é\8c¾\82ð\91}\93ü\82µ\82Ü\82·\81B
+#define VB_TRUE -1
+#define        VB_FALSE 0
 
-#endif // !defined(AFX_STDAFX_H__8CB29832_BD58_4AC5_92EB_DB8B53DF0C73__INCLUDED)
+/*
+#if defined(_DEBUG)
+#define ATLTRACE(mes) OutputDebugString(mes)
+#else
+#define ATLTRACE(mes)
+#endif
+*/
index 8075018..fb52d0e 100644 (file)
@@ -10,7 +10,7 @@ With Obj.MainFrame
         .Label("HELLO!")
         .Button("Create New Frame").SetID(50)
     End With
-    .SetPlacement ,,300,150
+    .SetPlacement ,,,150
     .Open "SeraphyScriptTools Test1"
 End With
 
index 878e5d2..bf422b5 100644 (file)
@@ -15,12 +15,12 @@ class mainframe
                set instance = createobject("seraphyscripttools.instance")
                with instance.mainframe
                        .classobject = me
-                       .SetMenu "/&FILE,&NEW@OnNew,\8aJ\82­(&O)@OnOpen,&SAVE@OnSave,SAVE &AS@OnSaveAs:EXIT/&EDIT,&COPY@OnClipboardCopy,CUT(&X),&PASTE@OnClipboardPaste"
+                       .SetMenu "/&FILE,&NEW@OnNew,\8aJ\82­(&O)@OnOpen,&SAVE@OnSave,SAVE &AS@OnSaveAs:EXIT/&EDIT,&COPY@OnClipboardCopy,CUT(&X)@OnClipboardCut,&PASTE@OnClipboardPaste"
                        with .form
                                .label "\93ü\97Í\97\93"
-                               set edit = .edit(,,5)
-                               .button("\83N\83\8a\83b\83v\83{\81[\83h\82©\82ç\8eæ\93¾").SetClassEvent("OnClipboardCopy").SetID(50)
-                               .button("\83N\83\8a\83b\83v\83{\81[\83h\82É\93ü\82ê\82é").SetClassEvent("OnClipboardPaste").SetID(51)
+                               set edt = .edit(,,5)
+                               .button("\83N\83\8a\83b\83v\83{\81[\83h\82©\82ç\8eæ\93¾").SetClassEvent("OnClipboardPaste").SetID(50)
+                               .button("\83N\83\8a\83b\83v\83{\81[\83h\82É\93ü\82ê\82é").SetClassEvent("OnClipboardCopy").SetID(51)
                        end with
                        .caption = "\83N\83\8a\83b\83v\83{\81[\83h\83e\83X\83g"
                        .open
@@ -30,14 +30,23 @@ class mainframe
        end sub
 
        public sub OnClipboardCopy
-               msgbox "copy"
+                instance.mainframe.SetClipboardText(edt.Text)
        end sub
 
        public sub OnClipboardPaste
-               msgbox "paste"
+               dim text
+               text = instance.mainframe.GetClipboardText()
+               if Not IsEmpty(text) then
+                       edt.Text = text
+               end if
+       end sub
+       
+       public sub OnClipboardCut
+               instance.mainframe.SetClipboardText(edt.Text)
+               edt.Text = ""
        end sub
 
-       public sub OnMenuO
-               msgbox "open"
+       public sub OnNew
+               edt.Text = ""
        end sub
 end class
index 29e7cf4..e8df55b 100644 (file)
@@ -100,7 +100,7 @@ sub printset_margin
        with obj.mainframe
                .enable = false
                with .CreateChild
-                       .SetPlacement ,,300,100
+                       .SetPlacement ,,300,120
                        with .form
                                .ControlPad ,5
                                .label "\8d\97]\94\92",5
index 1330e3e..b90f30a 100644 (file)
@@ -16,8 +16,8 @@ dim cmd1,cmd2
 dim retcode
 wscript.ConnectObject obj.mainframe, "event_"
 with obj.mainframe
-       .backcolor = "&HC0C0C0"
-       .SetPlacement ,,,500
+       .backcolor = "&HD0D0F0"
+       .SetPlacement ,,,510
        with .form
                .label "\83\89\83x\83\8b"
                .statuslabel "\83X\83e\81[\83^\83X\83\89\83x\83\8b"+vbcrlf+"#2",,2
index be94eb0..58dc1ad 100644 (file)
@@ -4,13 +4,13 @@ dim obj
 set obj = CreateObject("SeraphyScriptTools.Instance")
 
 dim slst,mlst
-dim cmd1,cmd2,cmd3,cmd4
+dim cmd1,cmd2,cmd3,cmd4,cmd5
 dim count
 
 wscript.ConnectObject obj.mainframe, "event_"
 with obj.mainframe
        .backcolor = "&HF0F0FF"
-       .SetPlacement ,,,320
+       .SetPlacement ,,,350
        .SetWindowStyle 0,1,0
        with .form
                .ControlPad ,5
@@ -25,7 +25,8 @@ with obj.mainframe
                .controlbreak
                set cmd3 = .button("\91I\91ð\82Ì\95\\8e¦",6)
                set cmd4 = .button("\8d\80\96Ú\82Ì\95\\8e¦",6)
-               .controlpad 5
+               set cmd5 = .button("\90æ\93ª",4)
+               .controlbreak
                .button("\8fI\97¹",5).SetID(1)
        end with
        .open "\83\8a\83X\83g\83{\83b\83N\83X\83T\83\93\83v\83\8b"
@@ -76,5 +77,12 @@ sub event_OnCommand
                                mlst.ItemObject(enm).Value("COUNT") = x
                        next
                        obj.dialog.messagebox mes
+               case cmd5.id
+                       if slst.GetCount > 0 then
+                               slst.currentselecteditem = 0
+                       end if
+                       if mlst.GetCount > 0 then
+                               mlst.currentselecteditem = 0
+                       end if
        end select
 end sub
index a28a20f..2bff399 100644 (file)
@@ -9,7 +9,7 @@ With Obj.MainFrame
                .Label("HELLO!")
                .Button("Create New Frame").SetID(50)
        End With
-       .SetPlacement ,,300,150
+       .SetPlacement ,,,150
        .Open "SeraphyScriptTools Test1"
 End With
 
index 5c5995e..24c8904 100644 (file)
@@ -19,10 +19,10 @@ public sub OnKeydown
        code = wnd.event.parameter
        excode = wnd.event.extparameter
        select case code
-       case 104 py = py - 10
-       case  98 py = py + 10
-       case 100 px = px - 10
-       case 102 px = px + 10
+       case 87 py = py - 10 ' W
+       case 83 py = py + 10 ' S
+       case 65 px = px - 10 ' A
+       case 68 px = px + 10 ' D
        end select
 end sub
 
index 6c2b274..6e7702b 100644 (file)
@@ -22,7 +22,7 @@ do
        sec.value("VALUE1") = sec.value("VALUE1") + 100
        sec.value("VALUE2") = sec.value("VALUE2") & "ABC"
        dim array,mes
-       array = sec.GetSectionNames()
+       array = sec.GetKeyNames()
        for each x in array
                mes = mes & "," & x
        next
diff --git a/TestScript/pro3err.vbs b/TestScript/pro3err.vbs
new file mode 100644 (file)
index 0000000..f78805c
--- /dev/null
@@ -0,0 +1,5 @@
+dim pro1
+set pro1 = createobject("SeraphyScriptTools.privateprofile")
+
+dim sec1
+set sec1 = pro1.OpenSection("")
index daae3b3..110b646 100644 (file)
@@ -105,12 +105,16 @@ end sub
 
 sub DeleteListItem
        dim x
-       if(listview.selectedcount > 0) then
+       if listview.selectedcount > 0 then
                ' \91I\91ð\83A\83C\83e\83\80\82Ì\97ñ\8b\93\82Í\83X\83i\83b\83v\83V\83\87\83b\83g\82È\82Ì\82Å
                ' \97ñ\8b\93\92\86\82É\83A\83C\83e\83\80\82Ì\8c¸\8f­\82ª\82 \82é\82Æ\83X\83i\83b\83v\83V\83\87\83b\83g\82Í\96³\8cø\82É\82È\82é
+               x = listview.CurrentSelectedItem
                listview.DeleteSelectedItem
+               if x < listview.GetCount then
+                       listview.currentselecteditem = x
+               end if
        else
-               obj.dialog.messagebox "\91I\91ð\82ª\82 \82è\82Ü\82¹\82ñ",0,1
+               obj.dialog.messagebox "\91I\91ð\82ª\82 \82è\82Ü\82¹\82ñ", 0, 1
        end if
 end sub
 
index 7587599..5b6c707 100644 (file)
@@ -10,55 +10,41 @@ using namespace std;
 /////////////////////////////////////////////////////////////////////////////
 // CTreeItem
 
-STDMETHODIMP CTreeItem::InterfaceSupportsErrorInfo(REFIID riid)
-{
-       static const IID* arr[] = 
-       {
-               &IID_ITreeItem
-       };
-       for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
-       {
-               if (IsEqualGUID(*arr[i],riid))
-                       return S_OK;
-       }
-       return S_FALSE;
-}
-
-BOOL CTreeItem::DeleteTreeItemWithData(HWND hWnd,HTREEITEM hItem)
+BOOL CTreeItem::DeleteTreeItemWithData(HWND hWnd, HTREEITEM hItem)
 {
        HTREEITEM hRoot = hItem;
        list<HTREEITEM> lst;
        lst.push_back(hItem);
-       while(!lst.empty()){
-                hItem = lst.front();
-                lst.pop_front();
-                while(hItem){
-                        HTREEITEM hChild = TreeView_GetChild(hWnd,hItem);
-                        if(hChild){
-                                // \8eq\83O\83\8b\81[\83v\82ð\8c\9f\8d¸\82·\82é\82æ\82¤\82É\83X\83^\83b\83N\82·\82é
-                                lst.push_back(hChild);
-                        }
-                        // \82±\82Ì\83A\83C\83e\83\80\82É\8aÖ\98A\82Ã\82¯\82ç\82ê\82½\83I\83u\83W\83F\83N\83g\82ð\89ð\95ú\82·\82é
-                        TVITEM itm = {0};
-                        itm.mask  = TVIF_PARAM;
-                        itm.hItem = hItem;
-                        if(TreeView_GetItem(hWnd,&itm) && itm.lParam){
+       while (!lst.empty()) {
+               hItem = lst.front();
+               lst.pop_front();
+               while (hItem) {
+                       HTREEITEM hChild = TreeView_GetChild(hWnd, hItem);
+                       if (hChild) {
+                               // \8eq\83O\83\8b\81[\83v\82ð\8c\9f\8d¸\82·\82é\82æ\82¤\82É\83X\83^\83b\83N\82·\82é
+                               lst.push_back(hChild);
+                       }
+                       // \82±\82Ì\83A\83C\83e\83\80\82É\8aÖ\98A\82Ã\82¯\82ç\82ê\82½\83I\83u\83W\83F\83N\83g\82ð\89ð\95ú\82·\82é
+                       TVITEM itm = {0};
+                       itm.mask = TVIF_PARAM;
+                       itm.hItem = hItem;
+                       if (TreeView_GetItem(hWnd, &itm) && itm.lParam) {
                                IUnknown* pUnk = (IUnknown*)itm.lParam;
                                pUnk->Release();
                                itm.lParam = NULL;
-                               TreeView_SetItem(hWnd,&itm);
-                        }      
-                        // \82Â\82¬\82Ì\83A\83C\83e\83\80\82ð\92T\82·
-                        if(hRoot == hItem){
-                                // \8aJ\8en\88Ê\92u\82Ì\8cZ\92í\82Í\92T\82µ\82Ä\82Í\82È\82ç\82È\82¢
-                                hItem = NULL;
-                        }
-                        else{
-                                hItem = TreeView_GetNextSibling(hWnd,hItem);
-                        }
-                }
+                               TreeView_SetItem(hWnd, &itm);
+                       }
+                       // \82Â\82¬\82Ì\83A\83C\83e\83\80\82ð\92T\82·
+                       if (hRoot == hItem) {
+                               // \8aJ\8en\88Ê\92u\82Ì\8cZ\92í\82Í\92T\82µ\82Ä\82Í\82È\82ç\82È\82¢
+                               hItem = NULL;
+                       }
+                       else {
+                               hItem = TreeView_GetNextSibling(hWnd, hItem);
+                       }
+               }
        }
-       TreeView_DeleteItem(hWnd,hRoot);
+       TreeView_DeleteItem(hWnd, hRoot);
        return true;
 }
 
@@ -67,24 +53,24 @@ void CTreeItem::CreateTreeItem(HWND hWnd, HTREEITEM hParent, LPCTSTR text, IUnkn
        // \83A\83C\83e\83\80\82ª\95Û\97L\82·\82é\98A\91z\94z\97ñ\82ð\90\90¬\82·\82é
        IUnknown* pUnk = NULL;
        CComObject<CObjectMap>* pMap = NULL;
-       if (pMap->CreateInstance(&pMap) == S_OK) {
+       if (SUCCEEDED(pMap->CreateInstance(&pMap))) {
                pMap->QueryInterface(IID_IUnknown, (void**)&pUnk);
        }
        // \91}\93ü\82·\82é\83A\83C\83e\83\80\82Ì\92è\8b`
        ATL::CString tmp(text);
-       TVINSERTSTRUCT is = { 0 };
-       is.hParent       = hParent;
-       is.hInsertAfter  = TVI_LAST;
-       is.item.mask     = TVIF_TEXT | TVIF_PARAM;
-       is.item.pszText  = tmp.GetBuffer();
+       TVINSERTSTRUCT is = {0};
+       is.hParent = hParent;
+       is.hInsertAfter = TVI_LAST;
+       is.item.mask = TVIF_TEXT | TVIF_PARAM;
+       is.item.pszText = tmp.GetBuffer();
        is.item.cchTextMax = tmp.GetLength();
-       is.item.lParam   = (LPARAM)pUnk;
+       is.item.lParam = (LPARAM)pUnk;
 
        HTREEITEM hNewItem = TreeView_InsertItem(hWnd, &is);
        if (hNewItem) {
                // \83A\83C\83e\83\80\82Ö\82Ì\83I\83u\83W\83F\83N\83g\82ð\8dì\90¬\82·\82é
                CComObject<CTreeItem>* pItem = NULL;
-               if (pItem->CreateInstance(&pItem) == S_OK) {
+               if (SUCCEEDED(pItem->CreateInstance(&pItem))) {
                        pItem->SetParam(hWnd, hNewItem);
                        pItem->QueryInterface(IID_IUnknown, (void**)punkVal);
                }
index 53e662c..1e0877d 100644 (file)
@@ -1,17 +1,16 @@
 // TreeItem.h : CTreeItem \82Ì\90é\8c¾
 
-#ifndef __TREEITEM_H_
-#define __TREEITEM_H_
+#pragma once
 
 #include "resource.h"       // \83\81\83C\83\93 \83V\83\93\83{\83\8b
 #include "generic.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // CTreeItem
-class ATL_NO_VTABLE CTreeItem : 
+class ATL_NO_VTABLE CTreeItem :
        public CComObjectRootEx<CComSingleThreadModel>,
-//     public CComCoClass<CTreeItem, &CLSID_TreeItem>,
-       public ISupportErrorInfo,
+       public CComCoClass<CTreeItem, &CLSID_TreeItem>,
+       public ISupportErrorInfoImpl<&IID_ITreeItem>,
        public IDispatchImpl<ITreeItem, &IID_ITreeItem, &LIBID_SERAPHYSCRIPTTOOLSLib>
 {
 public:
@@ -20,32 +19,29 @@ public:
                m_hWnd = NULL;
                m_hItem = NULL;
        }
-static BOOL DeleteTreeItemWithData(HWND hWnd,HTREEITEM hItem);
-//DECLARE_REGISTRY_RESOURCEID(IDR_TREEITEM)
+       static BOOL DeleteTreeItemWithData(HWND hWnd, HTREEITEM hItem);
+       //DECLARE_REGISTRY_RESOURCEID(IDR_TREEITEM)
 
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+       DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-BEGIN_COM_MAP(CTreeItem)
-       COM_INTERFACE_ENTRY(ITreeItem)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-END_COM_MAP()
+       BEGIN_COM_MAP(CTreeItem)
+               COM_INTERFACE_ENTRY(ITreeItem)
+               COM_INTERFACE_ENTRY(IDispatch)
+               COM_INTERFACE_ENTRY(ISupportErrorInfo)
+       END_COM_MAP()
 
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
-
-// ITreeItem
+       // ITreeItem
 public:
        STDMETHOD(IsValid)(/*[out,retval]*/BOOL* pResult);
-       static void CreateTreeItem(HWND hWnd,HTREEITEM hParent, LPCTSTR text, IUnknown** punkVal);
+       static void CreateTreeItem(HWND hWnd, HTREEITEM hParent, LPCTSTR text, IUnknown** punkVal);
        STDMETHOD(Sort)()
        {
                HRESULT ret = InitialCheck();
-               if(ret == S_OK){
-                       if(m_hItem){
-                               TreeView_SortChildren(m_hWnd,m_hItem,0);
+               if (ret == S_OK) {
+                       if (m_hItem) {
+                               TreeView_SortChildren(m_hWnd, m_hItem, 0);
                        }
-                       else{
+                       else {
                                // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                                ret = DISP_E_EXCEPTION;
                        }
@@ -55,11 +51,11 @@ public:
        STDMETHOD(Expand)()
        {
                HRESULT ret = InitialCheck();
-               if(ret == S_OK){
-                       if(m_hItem){
-                               TreeView_Expand(m_hWnd,m_hItem,TVE_EXPAND);
+               if (ret == S_OK) {
+                       if (m_hItem) {
+                               TreeView_Expand(m_hWnd, m_hItem, TVE_EXPAND);
                        }
-                       else{
+                       else {
                                // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                                ret = DISP_E_EXCEPTION;
                        }
@@ -69,11 +65,11 @@ public:
        STDMETHOD(Select)()
        {
                HRESULT ret = InitialCheck();
-               if(ret == S_OK){
-                       if(m_hItem){
-                               TreeView_SelectItem(m_hWnd,m_hItem);
+               if (ret == S_OK) {
+                       if (m_hItem) {
+                               TreeView_SelectItem(m_hWnd, m_hItem);
                        }
-                       else{
+                       else {
                                // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                                ret = DISP_E_EXCEPTION;
                        }
@@ -83,15 +79,15 @@ public:
        STDMETHOD(Erase)()
        {
                HRESULT ret = InitialCheck();
-               if(ret == S_OK){
-                       if(m_hItem){
-                               if(DeleteTreeItemWithData(m_hWnd,m_hItem)){
+               if (ret == S_OK) {
+                       if (m_hItem) {
+                               if (DeleteTreeItemWithData(m_hWnd, m_hItem)) {
                                        // \8dí\8f\9c\82É\90¬\8c÷\82µ\82½\82ç\81A\82±\82Ì\83n\83\93\83h\83\8b\82ð\96³\8cø\82É\82·\82é
                                        m_hWnd = NULL;
                                        m_hItem = NULL;
                                }
                        }
-                       else{
+                       else {
                                // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                                ret = DISP_E_EXCEPTION;
                        }
@@ -125,18 +121,18 @@ public:
                // \83A\83C\83e\83\80\82É\8aÖ\98A\95t\82¯\82ç\82ê\82½\98A\91z\94z\97ñ\83I\83u\83W\83F\83N\83g\82ð\8eæ\93¾\82·\82é
                ::VariantInit(pVal);
                HRESULT ret = InitialCheck();
-               if(!m_hItem){
+               if (!m_hItem) {
                        ret = DISP_E_EXCEPTION;
                }
-               if(ret == S_OK){
+               if (ret == S_OK) {
                        TVITEM itm = {0};
-                       itm.mask   = TVIF_PARAM;
-                       itm.hItem  = m_hItem;
-                       if(TreeView_GetItem(m_hWnd,&itm)){
+                       itm.mask = TVIF_PARAM;
+                       itm.hItem = m_hItem;
+                       if (TreeView_GetItem(m_hWnd, &itm)) {
                                IUnknown* pUnk = (IUnknown*)itm.lParam;
-                               if(pUnk){
+                               if (pUnk) {
                                        pUnk->AddRef();
-                                       pVal->vt      = VT_UNKNOWN;
+                                       pVal->vt = VT_UNKNOWN;
                                        pVal->punkVal = pUnk;
                                }
                        }
@@ -146,11 +142,10 @@ public:
        HRESULT InitialCheck()
        {
                // \83E\83B\83\93\83h\83E\82ª\97L\8cø\82©\8c\9f\8d¸\82·\82é
-               if(m_hWnd && ::IsWindow(m_hWnd)){
+               if (m_hWnd && ::IsWindow(m_hWnd)) {
                        return S_OK;
                }
-               ErrorInfo(IDS_ERR_TREEERROR);
-               return DISP_E_EXCEPTION;
+               return Error(IDS_ERR_TREEERROR);
        }
 
        STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal)
@@ -163,13 +158,13 @@ public:
                }
 
                if (ret == S_OK) {
-                       TCHAR text[MAX_PATH] = { 0 };
+                       TCHAR text[MAX_PATH] = {0};
                        TVITEM itm = {0};
-                       itm.mask       = TVIF_TEXT;
-                       itm.hItem      = m_hItem;
-                       itm.pszText    = text;
+                       itm.mask = TVIF_TEXT;
+                       itm.hItem = m_hItem;
+                       itm.pszText = text;
                        itm.cchTextMax = MAX_PATH;
-                       if (TreeView_GetItem(m_hWnd,&itm)) {
+                       if (TreeView_GetItem(m_hWnd, &itm)) {
                                CComBSTR ret(text);
                                *pVal = ret.Detach();
                        }
@@ -188,9 +183,9 @@ public:
                if (ret == S_OK) {
                        ATL::CString tmp(newVal);
                        TVITEM itm = {0};
-                       itm.mask       = TVIF_TEXT;
-                       itm.hItem      = m_hItem;
-                       itm.pszText    = tmp.GetBuffer();
+                       itm.mask = TVIF_TEXT;
+                       itm.hItem = m_hItem;
+                       itm.pszText = tmp.GetBuffer();
                        itm.cchTextMax = tmp.GetLength(); // Set\82Ì\8fê\8d\87\82Í\96³\8e\8b\82³\82ê\82é
                        TreeView_SetItem(m_hWnd, &itm);
                }
@@ -202,16 +197,16 @@ public:
                // \91O\82Ì\83A\83C\83e\83\80
                *pVal = NULL;
                HRESULT ret = InitialCheck();
-               if(!m_hItem){
+               if (!m_hItem) {
                        // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                        ret = DISP_E_EXCEPTION;
                }
-               if(ret == S_OK){
-                       HTREEITEM hNewItem = TreeView_GetPrevSibling(m_hWnd,m_hItem);
+               if (ret == S_OK) {
+                       HTREEITEM hNewItem = TreeView_GetPrevSibling(m_hWnd, m_hItem);
                        CComObject<CTreeItem>* pItem = NULL;
-                       if(pItem->CreateInstance(&pItem) == S_OK){
-                               pItem->SetParam(m_hWnd,hNewItem);
-                               ret = pItem->QueryInterface(IID_IUnknown,(void**)pVal);
+                       if (pItem->CreateInstance(&pItem) == S_OK) {
+                               pItem->SetParam(m_hWnd, hNewItem);
+                               ret = pItem->QueryInterface(IID_IUnknown, (void**)pVal);
                        }
                }
                return ret;
@@ -221,16 +216,16 @@ public:
                // \8e\9f\82Ì\83A\83C\83e\83\80
                *pVal = NULL;
                HRESULT ret = InitialCheck();
-               if(!m_hItem){
+               if (!m_hItem) {
                        // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                        ret = DISP_E_EXCEPTION;
                }
-               if(ret == S_OK){
-                       HTREEITEM hNewItem = TreeView_GetNextSibling(m_hWnd,m_hItem);
+               if (ret == S_OK) {
+                       HTREEITEM hNewItem = TreeView_GetNextSibling(m_hWnd, m_hItem);
                        CComObject<CTreeItem>* pItem = NULL;
-                       if(pItem->CreateInstance(&pItem) == S_OK){
-                               pItem->SetParam(m_hWnd,hNewItem);
-                               ret = pItem->QueryInterface(IID_IUnknown,(void**)pVal);
+                       if (pItem->CreateInstance(&pItem) == S_OK) {
+                               pItem->SetParam(m_hWnd, hNewItem);
+                               ret = pItem->QueryInterface(IID_IUnknown, (void**)pVal);
                        }
                }
                return ret;
@@ -240,16 +235,16 @@ public:
                // \8eq\83A\83C\83e\83\80
                *pVal = NULL;
                HRESULT ret = InitialCheck();
-               if(!m_hItem){
+               if (!m_hItem) {
                        // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                        ret = DISP_E_EXCEPTION;
                }
-               if(ret == S_OK){
-                       HTREEITEM hNewItem = TreeView_GetChild(m_hWnd,m_hItem);
+               if (ret == S_OK) {
+                       HTREEITEM hNewItem = TreeView_GetChild(m_hWnd, m_hItem);
                        CComObject<CTreeItem>* pItem = NULL;
-                       if(pItem->CreateInstance(&pItem) == S_OK){
-                               pItem->SetParam(m_hWnd,hNewItem);
-                               ret = pItem->QueryInterface(IID_IUnknown,(void**)pVal);
+                       if (pItem->CreateInstance(&pItem) == S_OK) {
+                               pItem->SetParam(m_hWnd, hNewItem);
+                               ret = pItem->QueryInterface(IID_IUnknown, (void**)pVal);
                        }
                }
                return S_OK;
@@ -259,22 +254,22 @@ public:
                // \90e\83A\83C\83e\83\80
                *pVal = NULL;
                HRESULT ret = InitialCheck();
-               if(!m_hItem){
+               if (!m_hItem) {
                        // \95s\90³\82È\83A\83C\83e\83\80\82ð\8eQ\8fÆ\82µ\82Ä\82¢\82é
                        ret = DISP_E_EXCEPTION;
                }
-               if(ret == S_OK){
-                       HTREEITEM hNewItem = TreeView_GetParent(m_hWnd,m_hItem);
+               if (ret == S_OK) {
+                       HTREEITEM hNewItem = TreeView_GetParent(m_hWnd, m_hItem);
                        CComObject<CTreeItem>* pItem = NULL;
-                       if(pItem->CreateInstance(&pItem) == S_OK){
-                               pItem->SetParam(m_hWnd,hNewItem);
-                               ret = pItem->QueryInterface(IID_IUnknown,(void**)pVal);
+                       if (pItem->CreateInstance(&pItem) == S_OK) {
+                               pItem->SetParam(m_hWnd, hNewItem);
+                               ret = pItem->QueryInterface(IID_IUnknown, (void**)pVal);
                        }
                }
                return S_OK;
        }
        //
-       void SetParam(HWND hWnd,HTREEITEM hItem)
+       void SetParam(HWND hWnd, HTREEITEM hItem)
        {
                m_hWnd = hWnd;
                m_hItem = hItem;
@@ -283,5 +278,3 @@ protected:
        HWND m_hWnd;
        HTREEITEM m_hItem;
 };
-
-#endif //__TREEITEM_H_
index 7e7025c..bd30b8e 100644 (file)
@@ -2,53 +2,33 @@
 #include "SeraphyScriptTools.h"
 #include "generic.h"
 
-void ErrorInfo(int nMessageID)
-{
-       ICreateErrorInfo *pCErrInfo;
-       if(CreateErrorInfo(&pCErrInfo) == S_OK){
-               TCHAR mes[MAX_PATH];
-               if (LoadString(_Module.m_hInst, nMessageID, mes, MAX_PATH)) {
-                       CComBSTR tmp(mes);
-                       pCErrInfo->SetDescription((LPOLESTR) tmp);
-                       pCErrInfo->SetGUID(IID_IOverlappedWindow);
-                       pCErrInfo->SetSource(L"SeraphyScriptTools");
-                       IErrorInfo* perrinfo;
-                       if(pCErrInfo->QueryInterface(IID_IErrorInfo, (LPVOID FAR*) &perrinfo) == S_OK){
-                               SetErrorInfo(0, perrinfo);
-                               perrinfo->Release();
-                       }
-                       pCErrInfo->Release();
-               }
-       }
-}
-
-SAFEARRAY* GetArrayFromVariant(VARIANT& var,VARTYPE* pVt)
+SAFEARRAY* GetArrayFromVariant(VARIANT& var, VARTYPE* pVt)
 {
        // \8c^\82Ì\8f\89\8aú\89»
-       if(pVt){
+       if (pVt) {
                *pVt = VT_ERROR;
        }
        VARIANT* pParseVariant = &var;
        SAFEARRAY* pArray = NULL;
-       if(!(var.vt & VT_ARRAY) && (var.vt & (VT_BYREF|VT_VARIANT))){
+       if (!(var.vt & VT_ARRAY) && (var.vt & (VT_BYREF | VT_VARIANT))) {
                // \94z\97ñ\82Å\82Í\82È\82­\82Ä\81A\83o\83\8a\83A\83\93\83g\82Ì\8eQ\8fÆ\93n\82µ\82Å\82 \82ê\82Î\81A\82»\82Ì\83|\83C\83\93\83^\82É\89ð\90Í\82ð\82 \82í\82¹\82é
                pParseVariant = var.pvarVal;
        }
-       if(!(pParseVariant->vt & VT_ARRAY)){
+       if (!(pParseVariant->vt & VT_ARRAY)) {
                // \94z\97ñ\88È\8aO\82È\82ç\8fI\97¹
                return NULL;
        }
        // \94z\97ñ\82Å\82 \82é
-       if(pParseVariant->vt & VT_BYREF){
+       if (pParseVariant->vt & VT_BYREF) {
                // \94z\97ñ\82Ì\8eQ\8fÆ\93n\82µ\82Å\82 \82é
                pArray = *pParseVariant->pparray;
        }
-       else{
+       else {
                // \94z\97ñ\82»\82Ì\82à\82Ì\82Å\82 \82é
                pArray = pParseVariant->parray;
        }
        // \8c^\8fî\95ñ\82Ì\8eæ\82è\8fo\82µ (SafeArray\82É\82Í\8c^\8fî\95ñ\82Í\95K\90{\82Å\82Í\82È\82¢\82½\82ß)
-       if(pVt){
+       if (pVt) {
                *pVt = (pParseVariant->vt & VT_TYPEMASK);
        }
        return pArray;
index d03af5f..c91759c 100644 (file)
--- a/generic.h
+++ b/generic.h
@@ -1,122 +1,5 @@
 // GENERIC.h
 
-#if !defined(SERAPHYSCRIPTTOOLS_GENERIC_HEADER)
-#define SERAPHYSCRIPTTOOLS_GENERIC_HEADER
+#pragma once
 
-#define VB_TRUE -1
-#define        VB_FALSE 0
-
-/*
-#if defined(_DEBUG)
-#define ATLTRACE(mes) OutputDebugString(mes)
-#else
-#define ATLTRACE(mes)
-#endif
-*/
-
-void ErrorInfo(int nMessageID);
-SAFEARRAY* GetArrayFromVariant(VARIANT& var,VARTYPE* pVt);
-
-// \92l\82ð\83R\83s\81[\82·\82é\83o\83\8a\83A\83\93\83g\97ñ\8b\93\8c^
-typedef CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > CComEnumVARIANT;
-
-// \93®\93I\82È\83o\83\8a\83A\83\93\83g\97ñ\8b\93\8c^
-template <class T>
-class CComEnumDynaVARIANT :public IEnumVARIANT , public CComObjectRootEx<CComSingleThreadModel>
-{
-public:
-BEGIN_COM_MAP(CComEnumDynaVARIANT)
-       COM_INTERFACE_ENTRY(IEnumVARIANT)
-       COM_INTERFACE_ENTRY(IUnknown)
-END_COM_MAP()
-
-       CComEnumDynaVARIANT()
-       {
-               m_current = 0;
-               m_pObj = NULL;
-       }
-    STDMETHODIMP Next(unsigned long celt, VARIANT FAR* rgvar,  unsigned long FAR* pceltFetched);
-    STDMETHODIMP Skip(unsigned long celt);
-    STDMETHODIMP Reset();
-    STDMETHODIMP Clone(IEnumVARIANT FAR* FAR* ppenum);
-    void FinalRelease()
-       {
-               if(m_pObj){
-                       m_pObj->Release();
-                       m_pObj = NULL;
-               }
-               ATLTRACE("CComEnumDynaVARINAT::FinalRelease\r\n");
-       }
-       void Init(T* pObj,unsigned long current)
-       {
-               m_current = current;
-               m_pObj = pObj;
-               if(m_pObj){
-                       m_pObj->AddRef();
-               }
-       }
-protected:
-       unsigned long m_current;
-       T* m_pObj;
-};
-
-template<class T>
-STDMETHODIMP CComEnumDynaVARIANT<T>::Next(unsigned long celt, VARIANT FAR* rgvar,  unsigned long FAR* pceltFetched)
-{
-       // \96ß\82·\94z\97ñ\82Ì\92l\82ð\8f\89\8aú\89»
-       if(!m_pObj){
-               return S_FALSE;
-       }
-       unsigned long i = 0;
-       for(i=0;i<celt;i++){
-               ::VariantInit(&rgvar[i]);
-       }
-       unsigned long cnt = 0;
-       unsigned long mx  = 0;
-       m_pObj->get_Count((long*)&mx);
-       while(cnt < celt  && m_current < mx){
-               CComVariant varIdx((long)m_current);
-               m_pObj->get_Value(varIdx,&rgvar[cnt]);
-               m_current++;
-               celt--;
-               cnt++;
-       }
-       // \8eÀ\8dÛ\82É\8f\91\82«\96ß\82µ\82½\92l\82ð\8f\89\8aú\89»\82·\82é
-       if(pceltFetched){
-               *pceltFetched = cnt;
-       }
-       return (celt > cnt)?S_FALSE:S_OK;
-}
-
-template<class T>
-STDMETHODIMP CComEnumDynaVARIANT<T>::Skip(unsigned long celt)
-{
-       if(m_pObj){
-               unsigned long mx  = 0;
-               m_pObj->get_Count((long*)&mx);
-               if(m_current + celt < mx){
-                       m_current += celt;
-                       return S_OK;
-               }
-       }
-       return S_FALSE;
-}
-
-template<class T>
-STDMETHODIMP CComEnumDynaVARIANT<T>::Reset()
-{
-       m_current = 0;
-       return S_OK;
-}
-
-template<class T>
-STDMETHODIMP CComEnumDynaVARIANT<T>::Clone(IEnumVARIANT FAR* FAR* ppenum)
-{
-       CComObject< CComEnumDynaVARIANT<T> >* pClone = NULL;
-       pClone->CreateInstance(&pClone);
-       pClone->Init(m_pObj,m_current);
-       pClone->QueryInterface(IID_IEnumVARIANT,(void**)ppenum);
-       return S_OK;
-}
-
-#endif
+SAFEARRAY* GetArrayFromVariant(VARIANT& var, VARTYPE* pVt);
index 2a94509..c0a860f 100644 (file)
@@ -1,34 +1,21 @@
 //{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by SeraphyScriptTools.rc
+// Microsoft Visual C++ \82Å\90\90¬\82³\82ê\82½\83C\83\93\83N\83\8b\81[\83\83t\83@\83C\83\8b\81B
+// SeraphyScriptTools.rc \82Å\8eg\97p
 //
 #define IDS_PROJNAME                    100
 #define IDB_COMMDIALOG                  101
-#define IDS_ERR_LAYERBOUND              101
 #define IDR_COMMDIALOG                  102
-#define IDS_ERR_CREATEDWND              102
 #define IDB_OVERLAPPEDWINDOW            103
 #define IDS_ERR_NOCREATED               103
 #define IDR_OVERLAPPEDWINDOW            104
 #define IDS_ERR_ANTHERINTERFACE         104
 #define IDS_ERR_NEEDINTERFACES          105
-#define IDS_ERR_NODEFPRINTER            106
-#define IDS_ERR_NEED2DIM                107
-#define IDS_ERR_MAXCONTROL              108
 #define IDR_CONTROL                     109
-#define IDS_ERR_DESTROYED               109
-#define IDS_ERR_NOCREATEMENU            110
-#define IDS_ERR_PRINTERSETTING          111
 #define IDR_CANVAS                      112
-#define IDS_ERR_NOTSUPPORTCONTROL       112
 #define IDR_LAYER                       113
-#define IDS_ERR_RANDEOUT                113
 #define IDR_FORM                        114
-#define IDS_ERR_TREEERROR               114
 #define IDR_EVENT                       115
-#define IDS_ERR_PROFILEPATH             115
 #define IDB_INSTANCE                    116
-#define IDS_ERR_PICTURELOADFAIL         116
 #define IDR_INSTANCE                    117
 #define IDR_ENUMSELECT                  118
 #define IDR_TREEITEM                    119
 #define IDR_PROFILESECTION              124
 #define IDR_PARSENAME                   125
 #define IDR_PRIVATEPROFILE              126
+#define IDS_ERR_LAYERBOUND              516
+#define IDS_ERR_CREATEDWND              517
+#define IDS_ERR_NODEFPRINTER            518
+#define IDS_ERR_NEED2DIM                519
+#define IDS_ERR_MAXCONTROL              520
+#define IDS_ERR_DESTROYED               521
+#define IDS_ERR_NOCREATEMENU            522
+#define IDS_ERR_PRINTERSETTING          523
+#define IDS_ERR_NOTSUPPORTCONTROL       524
+#define IDS_ERR_RANDEOUT                525
+#define IDS_ERR_TREEERROR               526
+#define IDS_ERR_PROFILEPATH             527
+#define IDS_ERR_PICTURELOADFAIL         528
 
 // Next default values for new objects
 //