• R/O
  • HTTP
  • SSH
  • HTTPS

SeraphyScriptTools: Commit

SeraphyScriptTools v1.1以降のソースコード管理


Commit MetaInfo

Revision31b7fd93b6ea8ccc4d7f091f92cc1b1227bcb077 (tree)
Time2015-08-14 22:51:54
Authorseraphy <seraphy@sera...>
Commiterseraphy

Log Message

UNICODEビルド、X64ビルドでコンパイルエラーが発生しないように修正した。
動作するかは未確認。

Change Summary

Incremental Difference

--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,10 @@
11 /Debug
22 /ipch
3+/MBCS Debug
4+/MBCS Release
5+/Unicode Debug
6+/Unicode Release
7+/x64
38 SeraphyScriptTools.sdf
49 dlldata.c
510 SeraphyScriptTools.tlb
--- a/CommDialog.cpp
+++ b/CommDialog.cpp
@@ -9,61 +9,79 @@
99 /////////////////////////////////////////////////////////////////////////////
1010 // CCommDialog
1111
12-void CCommDialog::CommFileDialog(VARIANT* pvarReturn,VARIANT varPathName, VARIANT varFilter,BOOL bMode,DWORD flag)
12+void CCommDialog::CommFileDialog(VARIANT *pvarReturn, VARIANT varPathName, VARIANT varFilter, BOOL bMode, DWORD flag)
1313 {
1414 ::VariantInit(pvarReturn);
1515
1616 // ファイルを開く・保存ダイアログ共通ルーチン
17- CComVariant path;
18- CComVariant filter;
19- const int PATHBUFMAX = 8192;
20- CHAR szPathName[PATHBUFMAX] = {0};
21- CHAR szFilter [MAX_PATH+2] = {0};
22- CHAR szDefExtention[MAX_PATH] = {0};
23- CHAR szInitialDir[MAX_PATH] = {0};
24-
25- if(path.ChangeType(VT_BSTR,&varPathName) == S_OK){
26- // ファイル名の取り出し
27- WideCharToMultiByte(GetACP(),0,path.bstrVal,-1,szPathName,PATHBUFMAX,NULL,NULL);
17+
18+ ATL::CString szPathName;
19+ {
20+ CComVariant path;
21+ if (path.ChangeType(VT_BSTR, &varPathName) == S_OK) {
22+ // ファイル名の取り出し
23+ szPathName = path.bstrVal;
24+ }
25+ }
26+
27+ ATL::CString szFilter;
28+ {
29+ CComVariant filter;
30+ if (filter.ChangeType(VT_BSTR, &varFilter) == S_OK) {
31+ // フィルタ指定がある
32+ szFilter = varFilter.bstrVal;
33+ }
2834 }
29- if(filter.ChangeType(VT_BSTR,&varFilter) == S_OK){
30- // フィルタ指定がある
31- WideCharToMultiByte(GetACP(),0,filter.bstrVal,-1,szFilter,MAX_PATH,NULL,NULL);
32- LPSTR p = szFilter;
33- LPSTR pExt = NULL;
34- while(*p){
35- if(*p == '|'){
36- *p++ = 0;
37- if(!pExt){
35+
36+ ATL::CString szDefExtention;
37+ if (!szFilter.IsEmpty()) {
38+ LPTSTR p = szFilter.GetBuffer();
39+ LPTSTR pExt = NULL;
40+ while (*p) {
41+ if (*p == '|') {
42+ *p++ = 0; // 文字区切りで終端させる
43+ if (!pExt) {
3844 // 最初の区切りマークが最初の拡張子マークであろう。
3945 pExt = p;
4046 }
4147 }
42- p = CharNextA(p);
48+ p = CharNext(p);
4349 }
50+
4451 // 複数拡張子フィルタであれば最初の拡張子のみ取り出す
45- lstrcpyA(szDefExtention,pExt);
46- pExt = szDefExtention;
47- while(*pExt){
48- if(*pExt == ';'){
52+ if (pExt) {
53+ szDefExtention = pExt;
54+ }
55+ pExt = szDefExtention.GetBuffer();
56+ while (*pExt) {
57+ if (*pExt == ';'){
58+ *pExt = 0; // 最初の拡張子で終了させる
4959 break;
5060 }
51- pExt = CharNextA(pExt);
61+ pExt = CharNext(pExt);
5262 }
5363 }
5464
65+ ATL::CString szInitialDir;
66+ if (m_bstr_InitialDir.length() > 0) {
67+ // 初期ディレクトリ
68+ szInitialDir = (LPCWSTR) m_bstr_InitialDir;
69+ }
70+
71+ ATL::CString strFile(szPathName);
72+ const int MAXBUFSIZ = MAX_PATH * 10;
73+ LPTSTR pStrFileBuf = strFile.GetBufferSetLength(MAXBUFSIZ + 1);
74+
5575 OPENFILENAME ofn = {0};
5676 ofn.lStructSize = sizeof(OPENFILENAME);
5777 ofn.lpstrFilter = szFilter;
58- ofn.lpstrFile = szPathName;
59- ofn.nMaxFile = PATHBUFMAX;
78+ ofn.lpstrFile = pStrFileBuf;
79+ ofn.nMaxFile = MAXBUFSIZ;
6080 ofn.lpstrDefExt = szDefExtention;
6181 ofn.Flags = flag;
6282 ofn.hwndOwner = GetMainWindow();
6383
64- if(m_bstr_InitialDir.length() > 0){
65- // 初期ディレクトリ
66- WideCharToMultiByte(GetACP(),0,m_bstr_InitialDir,-1,szInitialDir,MAX_PATH,NULL,NULL);
84+ if (!szInitialDir.IsEmpty()) {
6785 ofn.lpstrInitialDir = szInitialDir;
6886 }
6987
@@ -72,80 +90,86 @@ void CCommDialog::CommFileDialog(VARIANT* pvarReturn,VARIANT varPathName, VARIAN
7290 ofn.Flags |= OFN_NODEREFERENCELINKS;
7391 }
7492
75- TCHAR szCaption[MAX_PATH] = {0};
93+ ATL::CString szCaption;
7694 BOOL result = false;
77- if(bMode){
95+ if (bMode) {
7896 // 開くダイアログ
79- ofn.Flags |= (m_bReadonly)?OFN_READONLY:0;
80- if(m_bstr_OpenFileCaption.length() > 0){
81- WideCharToMultiByte(GetACP(),0,m_bstr_OpenFileCaption,-1,szCaption,MAX_PATH,NULL,NULL);
97+ ofn.Flags |= (m_bReadonly) ? OFN_READONLY : 0;
98+ if (m_bstr_OpenFileCaption.length() > 0) {
99+ szCaption = (LPCWSTR) m_bstr_OpenFileCaption;
82100 ofn.lpstrTitle = szCaption;
83101 }
84102 result = GetOpenFileName(&ofn);
85- if(result){
86- m_bReadonly = (ofn.Flags & OFN_READONLY)?true:false;
103+ if (result) {
104+ m_bReadonly = (ofn.Flags & OFN_READONLY) ? true : false;
87105 }
88106 }
89107 else{
90108 // 保存ダイアログ
91- if(m_bstr_SaveFileCaption.length() > 0){
92- WideCharToMultiByte(GetACP(),0,m_bstr_SaveFileCaption,-1,szCaption,MAX_PATH,NULL,NULL);
109+ if (m_bstr_SaveFileCaption.length() > 0) {
110+ szCaption = (LPCWSTR) m_bstr_SaveFileCaption;
93111 ofn.lpstrTitle = szCaption;
94112 }
95113 result = GetSaveFileName(&ofn);
96114 }
97115
98- if(result){
99- if(!(ofn.Flags & OFN_ALLOWMULTISELECT)){
116+ if (result) {
117+ if (!(ofn.Flags & OFN_ALLOWMULTISELECT)) {
100118 // 単一ファイル選択
101119 CComVariant retpath;
102- retpath = (LPCSTR)ofn.lpstrFile;
120+ retpath = ofn.lpstrFile;
103121 retpath.Detach(pvarReturn);
104122 }
105123 else{
106- // 複数ファイル選択
124+ // 複数ファイル選択(ダブルヌル終端)
107125 // 返されたファイル数を計数する
108126 int cnt = 0;
109- LPCSTR p = szPathName;
110- while(*p){
127+ LPCTSTR p = ofn.lpstrFile;
128+ while (*p) {
111129 cnt++;
112- while(*p++);
130+ while (*p++);
113131 }
132+
114133 // シングルまたはマルチ
115134 SAFEARRAY *pArray = NULL;
116- if(cnt == 1){
135+ if (cnt == 1) {
117136 // 1つだけならフルパスが返っている
118- CComVariant tmp((LPCSTR)szPathName);
119- pArray = SafeArrayCreateVector(VT_VARIANT,0,1);
137+ CComVariant tmp(ofn.lpstrFile);
138+ pArray = SafeArrayCreateVector(VT_VARIANT, 0, 1);
120139 long indx = 0;
121- SafeArrayPutElement(pArray,&indx,&tmp);
140+ SafeArrayPutElement(pArray, &indx, &tmp);
122141 }
123- else if(cnt > 1){
142+ else if (cnt > 1) {
124143 // SAFEARRAYの作成
125- pArray = SafeArrayCreateVector(VT_VARIANT,0,cnt-1);
144+ pArray = SafeArrayCreateVector(VT_VARIANT, 0, cnt - 1);
145+
126146 // 複数なら最初がディレクトリ名、2番目以降がファイル名
127- p = szPathName;
128- _bstr_t dirname = (LPCSTR)p;
147+ p = ofn.lpstrFile;
148+ _bstr_t dirname = p;
149+
129150 // 末尾がフォルダプレイスが終わってなければ追加する
130151 LPCWSTR wp = dirname;
131- while(*wp)wp++;
132- if(wp - 1 > (LPCWSTR)dirname && *(wp - 1) != '\\'){
152+ while (*wp) wp++;
153+ if (wp - 1 > (LPCWSTR) dirname && *(wp - 1) != '\\') {
133154 dirname += L"\\";
134155 }
135- while(*p++);
156+
157+ while (*p++);
136158 // 2番目以降の取得
137159 long indx = 0;
138- while(*p){
139- _bstr_t name = (LPCSTR)p;
160+ while (*p) {
161+ _bstr_t name = p;
140162 _bstr_t path = dirname + name;
141- CComVariant tmp((BSTR)path);
142- SafeArrayPutElement(pArray,&indx,&tmp);
143- while(*p++);
163+
164+ CComVariant tmp((LPCWSTR) path);
165+ SafeArrayPutElement(pArray, &indx, &tmp);
166+ while (*p++);
144167 indx++;
145168 }
146169 }
170+
147171 // SAFEARRAYが作成されていれば
148- if(pArray){
172+ if (pArray) {
149173 pvarReturn->vt = VT_ARRAY | VT_VARIANT;
150174 pvarReturn->parray = pArray;
151175 }
@@ -291,35 +315,44 @@ STDMETHODIMP CCommDialog::put_BrowseForFolderCaption(BSTR newVal)
291315 return S_OK;
292316 }
293317
294-STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption,VARIANT varDir, VARIANT varMode,VARIANT* pvarReturn)
318+STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption, VARIANT varDir, VARIANT varMode, VARIANT* pvarReturn)
295319 {
296320 ::VariantInit(pvarReturn);
321+
297322 // キャプションの設定
298323 CComVariant caption;
299324 if(varCaption.vt != VT_ERROR && varCaption.vt != VT_NULL && varCaption.vt != VT_EMPTY &&
300- caption.ChangeType(VT_BSTR,&varCaption) == S_OK){
325+ caption.ChangeType(VT_BSTR, &varCaption) == S_OK) {
301326 put_BrowseForFolderCaption(caption.bstrVal);
302327 }
303328
304- TCHAR szDirName[MAX_PATH];
305- TCHAR szTitle[MAX_PATH];
306- BROWSEINFO binfo = {0};
329+ BROWSEINFO binfo = { 0 };
307330 binfo.hwndOwner = GetMainWindow();
308- if(m_bstr_BrowseForFolderCaption.length() > 0){
309- WideCharToMultiByte(GetACP(),0,m_bstr_BrowseForFolderCaption,-1,szTitle,MAX_PATH,NULL,NULL);
310- binfo.lpszTitle = szTitle;
331+
332+ ATL::CString szTitle;
333+ {
334+ if (m_bstr_BrowseForFolderCaption.length() > 0) {
335+ szTitle = (LPCWSTR)m_bstr_BrowseForFolderCaption;
336+ binfo.lpszTitle = szTitle;
337+ }
311338 }
312- CComVariant path;
313- if(path.ChangeType(VT_BSTR,&varDir) == S_OK){
314- // ファイル名の取り出し
315- WideCharToMultiByte(GetACP(),0,path.bstrVal,-1,szDirName,MAX_PATH,NULL,NULL);
339+
340+ ATL::CString szDirName;
341+ {
342+ CComVariant path;
343+ if (path.ChangeType(VT_BSTR, &varDir) == S_OK){
344+ // ファイル名の取り出し
345+ szDirName = path.bstrVal;
346+ }
347+ binfo.pszDisplayName = szDirName.GetBuffer();
316348 }
317- binfo.pszDisplayName = szDirName;
349+
318350 int mode = 0;
319351 CComVariant varTmp;
320352 if(varTmp.ChangeType(VT_I4,&varMode) == S_OK){
321353 mode = varTmp.lVal;
322354 }
355+
323356 binfo.ulFlags = 0;//BIF_NEWDIALOGSTYLE; // BIF_USENEWUI
324357 switch(mode & 0x0f)
325358 {
@@ -327,37 +360,49 @@ STDMETHODIMP CCommDialog::BrowseForFolder(VARIANT varCaption,VARIANT varDir, VAR
327360 default:
328361 binfo.ulFlags |= BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
329362 binfo.lpfn = BrowseCallbackProc;
330- binfo.lParam = (LPARAM)szDirName;
363+ binfo.lParam = (LPARAM)(LPCTSTR)szDirName;
331364 break;
365+
332366 case 1:
333367 binfo.ulFlags |= BIF_BROWSEFORCOMPUTER;
334368 break;
369+
335370 case 2:
336371 binfo.ulFlags |= BIF_BROWSEFORPRINTER;
337372 break;
373+
338374 case 3:
339375 binfo.ulFlags |= BIF_RETURNFSANCESTORS;
340376 break;
341377 }
342- if(mode & 0x10){
378+
379+ if (mode & 0x10) {
343380 binfo.ulFlags |= BIF_BROWSEINCLUDEFILES;
344381 }
345- if(mode & 0x20){
382+ if (mode & 0x20) {
346383 binfo.ulFlags |= BIF_BROWSEINCLUDEURLS;
347384 }
348- if(mode & 0x40){
385+ if (mode & 0x40) {
349386 binfo.ulFlags |= BIF_DONTGOBELOWDOMAIN;
350387 }
351388
352389 LPITEMIDLIST idlst = NULL;
353- if((idlst = SHBrowseForFolder(&binfo)) != NULL){
354- IMalloc *pMalloc;
355- SHGetMalloc(&pMalloc);
356- SHGetPathFromIDList(idlst,szDirName);
390+ if ((idlst = SHBrowseForFolder(&binfo)) != NULL) {
391+ IMalloc *pMalloc = NULL;
392+ HRESULT hr = SHGetMalloc(&pMalloc);
393+ if (FAILED(hr)) {
394+ return hr;
395+ }
396+
397+ ATL::CString ret;
398+ LPTSTR pRet = ret.GetBufferSetLength(MAX_PATH);
399+ SHGetPathFromIDList(idlst, pRet);
400+
357401 pMalloc->Free(idlst);
358402 pMalloc->Release();
359- CComVariant tmp((LPCSTR)szDirName);
360- tmp.Detach(pvarReturn);
403+
404+ CComVariant tmp(pRet);
405+ return tmp.Detach(pvarReturn);
361406 }
362407 return S_OK;
363408 }
@@ -412,64 +457,75 @@ STDMETHODIMP CCommDialog::SetMainWindow(VARIANT varUnk)
412457 STDMETHODIMP CCommDialog::MessageBox(VARIANT mes, VARIANT typ, VARIANT icon, VARIANT* pRet)
413458 {
414459 CComVariant ret;
415- LPSTR pBuf = NULL;
460+
461+ ATL::CString msg;
416462 CComVariant varMes;
417- if(varMes.ChangeType(VT_BSTR,&mes) == S_OK){
418- int sz = WideCharToMultiByte(GetACP(),0,varMes.bstrVal,-1,NULL,0,NULL,NULL);
419- pBuf = new CHAR[sz+1];
420- WideCharToMultiByte(GetACP(),0,varMes.bstrVal,-1,pBuf,sz,NULL,NULL);
421- pBuf[sz] = 0;
463+ if (varMes.ChangeType(VT_BSTR,&mes) == S_OK) {
464+ msg = mes.bstrVal;
422465 }
466+
423467 UINT mode = MB_OK;
424468 CComVariant varType,varIcon;
425- if(varType.ChangeType(VT_I2,&typ) == S_OK){
426- if(varType.iVal / 10){
469+ if (varType.ChangeType(VT_I2, &typ) == S_OK) {
470+ if (varType.iVal / 10) {
427471 mode = MB_DEFBUTTON2;
428472 }
473+
429474 switch(varType.iVal % 10)
430475 {
431476 case 0:
432477 default:
433478 mode |= MB_OK;
434479 break;
480+
435481 case 1:
436482 mode |= MB_OKCANCEL;
437483 break;
484+
438485 case 2:
439486 mode |= MB_YESNO;
440487 break;
488+
441489 case 3:
442490 mode |= MB_YESNOCANCEL;
443491 break;
492+
444493 case 4:
445494 mode |= MB_RETRYCANCEL;
446495 break;
496+
447497 case 5:
448498 mode |= MB_ABORTRETRYIGNORE;
449499 break;
450500 }
451501 }
452- if(varIcon.ChangeType(VT_I2,&icon) == S_OK){
502+
503+ if (varIcon.ChangeType(VT_I2,&icon) == S_OK) {
453504 switch(varIcon.iVal)
454505 {
455506 case 0:
456507 default:
457508 break;
509+
458510 case 1:
459511 mode |= MB_ICONERROR;
460512 break;
513+
461514 case 2:
462515 mode |= MB_ICONWARNING;
463516 break;
517+
464518 case 3:
465519 mode |= MB_ICONINFORMATION;
466520 break;
521+
467522 case 4:
468523 mode |= MB_ICONQUESTION;
469524 break;
470525 }
471526 }
472- int md = ::MessageBox(GetMainWindow(),pBuf,GetMainCaption(),mode);
527+
528+ int md = ::MessageBox(GetMainWindow(), msg, GetMainCaption(),mode);
473529 switch(md)
474530 {
475531 case IDOK:
@@ -490,27 +546,22 @@ STDMETHODIMP CCommDialog::MessageBox(VARIANT mes, VARIANT typ, VARIANT icon, VAR
490546 return S_OK;
491547 }
492548
493-LPCSTR CCommDialog::GetMainCaption()
549+ATL::CString CCommDialog::GetMainCaption()
494550 {
495- static CHAR szCaption[MAX_PATH];
496- if(!m_bstr_MessageCaption.length() && m_pMainWindow){
551+ ATL::CString szCaption;
552+ if (m_bstr_MessageCaption.Length() == 0 && m_pMainWindow) {
497553 // キャプションが指定されていないなら取得する
498- BSTR bstrCaption;
499- m_pMainWindow->get_Caption(&bstrCaption);
500- int cnt = WideCharToMultiByte(GetACP(),0,bstrCaption,-1,szCaption,MAX_PATH,NULL,NULL);
501- szCaption[cnt] = 0;
502- SysFreeString(bstrCaption);
503- }
504- else{
505- int cnt = WideCharToMultiByte(GetACP(),0,m_bstr_MessageCaption,-1,szCaption,MAX_PATH,NULL,NULL);
506- szCaption[cnt] = 0;
554+ CComBSTR bstrCaption;
555+ if (SUCCEEDED(m_pMainWindow->get_Caption(&bstrCaption))) {
556+ szCaption = bstrCaption;
557+ }
507558 }
508559 return szCaption;
509560 }
510561
511562 STDMETHODIMP CCommDialog::get_MessageCaption(BSTR *pVal)
512563 {
513- *pVal = m_bstr_MessageCaption.copy();
564+ *pVal = m_bstr_MessageCaption.Copy();
514565 return S_OK;
515566 }
516567
--- a/CommDialog.h
+++ b/CommDialog.h
@@ -196,20 +196,22 @@ public:
196196 return S_OK;
197197 }
198198 CComBSTR m_bstrCaption;
199+
199200 public:
200201 STDMETHOD(ColorDialog)(/*[out,retval]*/VARIANT* pcolorVal);
201202 STDMETHOD(get_MessageCaption)(/*[out, retval]*/ BSTR *pVal);
202203 STDMETHOD(put_MessageCaption)(/*[in]*/ BSTR newVal);
203- LPCSTR GetMainCaption();
204+ ATL::CString GetMainCaption();
204205 STDMETHOD(MessageBox)(/*[in]*/VARIANT mes,/*[in,optional]*/VARIANT typ,/*[in,optional]*/VARIANT icon,/*[out,retval]*/VARIANT* pRet);
205206 STDMETHOD(SetMainWindow)(/*[in]*/VARIANT varUnk);
206207 HWND GetMainWindow();
207208 HWND m_hStaticMainWindow;
209+
208210 protected:
209211 CHOOSECOLOR m_color;
210212 COLORREF m_colors[16];
211213 IOverlappedWindow* m_pMainWindow;
212- _bstr_t m_bstr_MessageCaption;
214+ CComBSTR m_bstr_MessageCaption;
213215 };
214216
215217 #endif //__COMMDIALOG_H_
--- a/Control.cpp
+++ b/Control.cpp
@@ -6,6 +6,8 @@
66 #include "generic.h"
77 #include "objectmap.h"
88 #include <list>
9+#include <vector>
10+
911 using namespace std;
1012
1113 /////////////////////////////////////////////////////////////////////////////
@@ -27,33 +29,36 @@ STDMETHODIMP CControl::InterfaceSupportsErrorInfo(REFIID riid)
2729
2830 STDMETHODIMP CControl::get_Text(BSTR *pVal)
2931 {
30- if(!m_hParent || !m_hWnd){
31- ErrorInfo(IDS_ERR_DESTROYED);
32- return DISP_E_EXCEPTION;
32+ if (!m_hParent || !m_hWnd) {
33+ return Error(IDS_ERR_DESTROYED);
3334 }
35+
3436 DWORD siz = ::GetWindowTextLength(m_hWnd);
35- LPSTR pMes = new CHAR[siz+1];
36- GetWindowText(m_hWnd,pMes,siz+1);
37- _bstr_t tmp = (LPCSTR)pMes;
38- *pVal = tmp.copy();
39- delete[]pMes;
37+
38+ ATL::CString tmp;
39+ LPTSTR pMes = tmp.GetBufferSetLength(siz + 1);
40+ GetWindowText(m_hWnd, pMes, siz + 1);
41+ tmp.ReleaseBuffer();
42+
43+ CComBSTR ret(tmp);
44+ *pVal = ret.Detach();
4045 return S_OK;
4146 }
4247
4348 STDMETHODIMP CControl::put_Text(BSTR newVal)
4449 {
4550 if(!m_hParent || !m_hWnd){
46- ErrorInfo(IDS_ERR_DESTROYED);
47- return DISP_E_EXCEPTION;
51+ return Error(IDS_ERR_DESTROYED);
4852 }
49- _bstr_t tmp(newVal,true);
50- ::SetWindowText(m_hWnd,(LPCSTR)tmp);
53+
54+ ATL::CString tmp(newVal);
55+ ::SetWindowText(m_hWnd, tmp);
5156 return S_OK;
5257 }
5358
5459 STDMETHODIMP CControl::get_ID(short *pVal)
5560 {
56- if(m_hWnd){
61+ if (m_hWnd) {
5762 m_nID = (int)GetWindowLong(m_hWnd,GWL_ID);
5863 }
5964 *pVal = m_nID;
@@ -63,13 +68,13 @@ STDMETHODIMP CControl::get_ID(short *pVal)
6368 STDMETHODIMP CControl::put_ID(short newVal)
6469 {
6570 m_nID = newVal;
66- if(m_hWnd){
67- SetWindowLong(m_hWnd,GWL_ID,newVal);
68- if((m_nID == IDOK) && !lstrcmp(m_classname,"BUTTON")){
71+ if (m_hWnd) {
72+ SetWindowLong(m_hWnd, GWL_ID, newVal);
73+ if((m_nID == IDOK) && !lstrcmp(m_classname, _TEXT("BUTTON"))) {
6974 // IDOKならポッシュボタン型をディフォルトボタンに変化させる
7075 DWORD m_style = ::GetWindowLong(m_hWnd,GWL_STYLE);
7176 m_style |= BS_DEFPUSHBUTTON;
72- ::SetWindowLong(m_hWnd,GWL_STYLE,m_style);
77+ ::SetWindowLong(m_hWnd, GWL_STYLE, m_style);
7378 }
7479 }
7580 return S_OK;
@@ -77,34 +82,33 @@ STDMETHODIMP CControl::put_ID(short newVal)
7782
7883 STDMETHODIMP CControl::get_Visibility(BOOL *pVal)
7984 {
80- if(!m_hParent || !m_hWnd){
85+ if (!m_hParent || !m_hWnd) {
8186 *pVal = 0;
82- ErrorInfo(IDS_ERR_DESTROYED);
83- return DISP_E_EXCEPTION;
87+ return Error(IDS_ERR_DESTROYED);
8488 }
89+
8590 WINDOWPLACEMENT pls = {0};
8691 pls.length = sizeof(WINDOWPLACEMENT);
87- ::GetWindowPlacement(m_hWnd,&pls);
88- *pVal = (pls.showCmd != SW_HIDE)?true:false;
92+ ::GetWindowPlacement(m_hWnd, &pls);
93+ *pVal = (pls.showCmd != SW_HIDE) ? true : false;
8994 return S_OK;
9095 }
9196
9297 STDMETHODIMP CControl::put_Visibility(BOOL newVal)
9398 {
94- if(!m_hParent || !m_hWnd){
95- ErrorInfo(IDS_ERR_DESTROYED);
96- return DISP_E_EXCEPTION;
99+ if (!m_hParent || !m_hWnd) {
100+ return Error(IDS_ERR_DESTROYED);
97101 }
98- ::ShowWindow(m_hWnd,newVal?SW_SHOWNORMAL:SW_HIDE);
102+
103+ ::ShowWindow(m_hWnd, newVal ? SW_SHOWNORMAL : SW_HIDE);
99104 return S_OK;
100105 }
101106
102107 STDMETHODIMP CControl::get_Enable(BOOL *pVal)
103108 {
104- if(!m_hParent || !m_hWnd){
109+ if (!m_hParent || !m_hWnd) {
105110 *pVal = 0;
106- ErrorInfo(IDS_ERR_DESTROYED);
107- return DISP_E_EXCEPTION;
111+ return Error(IDS_ERR_DESTROYED);
108112 }
109113 *pVal = ::IsWindowEnabled(m_hWnd);
110114 return S_OK;
@@ -112,9 +116,8 @@ STDMETHODIMP CControl::get_Enable(BOOL *pVal)
112116
113117 STDMETHODIMP CControl::put_Enable(BOOL newVal)
114118 {
115- if(!m_hParent || !m_hWnd){
116- ErrorInfo(IDS_ERR_DESTROYED);
117- return DISP_E_EXCEPTION;
119+ if (!m_hParent || !m_hWnd) {
120+ return Error(IDS_ERR_DESTROYED);
118121 }
119122 ::EnableWindow(m_hWnd,newVal);
120123 return S_OK;
@@ -132,9 +135,9 @@ STDMETHODIMP CControl::get_CheckState(short *pVal)
132135 STDMETHODIMP CControl::put_CheckState(short newVal)
133136 {
134137 m_bChecked = newVal;
135- if(m_hWnd && newVal >= 0 && newVal <= 2){
138+ if (m_hWnd && newVal >= 0 && newVal <= 2) {
136139 // 0:Unchecked 1:Checked 2:interminate
137- ::SendMessage(m_hWnd,BM_SETCHECK,newVal,0);
140+ ::SendMessage(m_hWnd, BM_SETCHECK, newVal, 0);
138141 }
139142 return S_OK;
140143 }
@@ -142,7 +145,7 @@ STDMETHODIMP CControl::put_CheckState(short newVal)
142145 BOOL CControl::Create(HWND hParent)
143146 {
144147 // << ディフォルトのプッシュボタンに変化させるクロ魔術 >>
145- if((m_nID == IDOK) && !lstrcmp(m_classname,"BUTTON")){
148+ if ((m_nID == IDOK) && !lstrcmp(m_classname, _TEXT("BUTTON"))) {
146149 // IDOKなら変更する
147150 m_style |= BS_DEFPUSHBUTTON;
148151 }
@@ -157,8 +160,8 @@ BOOL CControl::Create(HWND hParent)
157160 ,NULL
158161 ,_Module.m_hInst
159162 ,NULL);
160- ::SetWindowLong(m_hWnd, GWL_ID, m_nID);
161- ::SetWindowLong(m_hWnd, GWL_USERDATA,(LPARAM)this);
163+ ::SetWindowLongPtr(m_hWnd, GWLP_ID, m_nID);
164+ ::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR) this);
162165 ::SetWindowText(m_hWnd,m_caption);
163166
164167 // 親がディセーブルなら子もディセーブル状態で作成する
@@ -168,7 +171,7 @@ BOOL CControl::Create(HWND hParent)
168171
169172 //////////////////////////
170173 // 事前状態の設定
171- if(!lstrcmp(m_classname,"BUTTON")){
174+ if (!lstrcmp(m_classname, _TEXT("BUTTON"))) {
172175 // ボタンならチェック状態のセット
173176 if(m_bChecked){
174177 ::SendMessage(m_hWnd,BM_SETCHECK,1,0);
@@ -177,11 +180,11 @@ BOOL CControl::Create(HWND hParent)
177180 else if(!lstrcmp(m_classname,WC_LISTVIEW)){
178181 // リストビューならカラムの設定を行う
179182 TCHAR szColumn[MAX_PATH];
180- LPCSTR p = m_caption;
183+ LPCTSTR p = m_caption;
181184 m_nColumnCount = 0;
182185 // ウィンドウキャプションから列見出しを作成する
183186 while(*p){
184- LPCSTR d = p;
187+ LPCTSTR d = p;
185188 while(*p && *p != ',' && *p != ':'){
186189 p = CharNext(p);
187190 }
@@ -414,67 +417,69 @@ STDMETHODIMP CControl::put_Exstyle(long newVal)
414417
415418 STDMETHODIMP CControl::get_ClassName(BSTR *pVal)
416419 {
417- WCHAR wmes[MAX_PATH];
418- MultiByteToWideChar(GetACP(),0,m_classname,-1,wmes,MAX_PATH);
419- *pVal = SysAllocString(wmes);
420+ CComBSTR tmp(m_classname);
421+ *pVal = tmp.Detach();
420422 return S_OK;
421423 }
422424
423425 STDMETHODIMP CControl::Refresh()
424426 {
425- if(!m_hParent || !m_hWnd){
426- ErrorInfo(IDS_ERR_DESTROYED);
427- return DISP_E_EXCEPTION;
428- }
429- ::SetWindowPos(m_hWnd,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOCOPYBITS);
427+ if (!m_hParent || !m_hWnd) {
428+ return Error(IDS_ERR_DESTROYED);
429+ }
430+ ::SetWindowPos(
431+ m_hWnd,
432+ NULL,
433+ 0, 0, 0, 0,
434+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
430435 return S_OK;
431436 }
432437
433438 STDMETHODIMP CControl::get_HWND(long *pVal)
434439 {
435- *pVal = (long)m_hWnd;
440+ *pVal = (long) m_hWnd;
436441 return S_OK;
437442 }
438443
439-LPSTR CControl::ConvertVariantToString(VARIANT text)
444+HRESULT CControl::ConvertVariantToString(VARIANT text, ATL::CString &retval)
440445 {
441446 CComVariant varText;
442- if(varText.ChangeType(VT_BSTR,&text) != S_OK){
443- // 文字に変換できなければ何もしない
444- return NULL;
445- }
446- int sz = WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,NULL,0,NULL,NULL);
447- LPSTR pBuf = new CHAR[sz+1];
448- WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,pBuf,sz,NULL,NULL);
449- pBuf[sz] = 0;
450- return pBuf;
447+ HRESULT hr = varText.ChangeType(VT_BSTR, &text);
448+ if (FAILED(hr)) {
449+ return hr;
450+ }
451+
452+ retval = varText.bstrVal;
453+ return S_OK;
451454 }
452455
453456 STDMETHODIMP CControl::AddString(VARIANT text,VARIANT* pRet)
454457 {
455- CComVariant ret;
456458 ::VariantInit(pRet);
457- if(!m_hParent || !m_hWnd){
458- ErrorInfo(IDS_ERR_DESTROYED);
459- return DISP_E_EXCEPTION;
459+
460+ if (!m_hParent || !m_hWnd) {
461+ return Error(IDS_ERR_DESTROYED);
460462 }
461- LPSTR pBuf;
462- if(!(pBuf = ConvertVariantToString(text))){
463- return DISP_E_TYPEMISMATCH;
463+
464+ ATL::CString buf;
465+ HRESULT hr = ConvertVariantToString(text, buf);
466+ if (FAILED(hr)) {
467+ return hr;
464468 }
465469
466- HRESULT retcode = S_OK;
467- if(!lstrcmp(m_classname,"COMBOBOX")){
470+ CComVariant ret;
471+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
468472 // コンボボックスに文字列を追加する
469- ret = (short)SendMessage(m_hWnd,CB_ADDSTRING,0,(LPARAM)pBuf);
473+ ret = (short)SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)buf);
470474 }
471- else if(!lstrcmp(m_classname,"LISTBOX")){
475+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
472476 // リストボックスに文字列を追加する
473- int nIdx = SendMessage(m_hWnd,LB_ADDSTRING,0,(LPARAM)pBuf);
477+ int nIdx = SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)buf);
478+
474479 // 連想配列オブジェクトをバインドする
475480 CComObject<CObjectMap>* pMap = NULL;
476481 IUnknown* pUnk = NULL;
477- if(pMap->CreateInstance(&pMap) == S_OK){
482+ if (pMap->CreateInstance(&pMap) == S_OK) {
478483 pMap->QueryInterface(IID_IUnknown,(void**)&pUnk);
479484 }
480485 ::SendMessage(m_hWnd,LB_SETITEMDATA,nIdx,(LPARAM)pUnk);
@@ -485,194 +490,185 @@ STDMETHODIMP CControl::AddString(VARIANT text,VARIANT* pRet)
485490 int cnt = ListView_GetItemCount(m_hWnd);
486491 LVITEM item = {0};
487492 item.mask = LVIF_TEXT;
488- item.pszText = pBuf;
493+ item.pszText = buf.GetBuffer();
489494 item.iItem = cnt;
490- int nIdx = ListView_InsertItem(m_hWnd,&item);
495+ int nIdx = ListView_InsertItem(m_hWnd, &item);
496+
491497 // サブカラムは空文を埋める
492- int i;
493- for(i = 1 ; i<m_nColumnCount ; i++){
494- ListView_SetItemText(m_hWnd,nIdx,i,"");
498+ for(int i = 1 ; i < m_nColumnCount ; i++) {
499+ ListView_SetItemText(m_hWnd, nIdx, i, _TEXT(""));
495500 }
501+
496502 // 連想配列オブジェクトをバインドする
497503 CComObject<CObjectMap>* pMap = NULL;
498504 IUnknown* pUnk = NULL;
499- if(pMap->CreateInstance(&pMap) == S_OK){
500- pMap->QueryInterface(IID_IUnknown,(void**)&pUnk);
505+ if (pMap->CreateInstance(&pMap) == S_OK) {
506+ pMap->QueryInterface(IID_IUnknown, (void**)&pUnk);
501507 }
502508 LVITEM itm = {0};
503509 itm.iItem = nIdx;
504510 itm.mask = LVIF_PARAM;
505- itm.lParam = (LPARAM)pUnk;
506- ListView_SetItem(m_hWnd,&itm);
511+ itm.lParam = (LPARAM) pUnk;
512+ ListView_SetItem(m_hWnd, &itm);
507513 ret = (short)nIdx;
508514 }
509- else if(!lstrcmp(m_classname,WC_TREEVIEW)){
515+ else if (!lstrcmp(m_classname, WC_TREEVIEW)) {
510516 // ツリービューのルートにアイテムを作成する
511517 IUnknown* pUnk = NULL;
512- CTreeItem::CreateTreeItem(m_hWnd,TVI_ROOT,pBuf,&pUnk);
518+ CTreeItem::CreateTreeItem(m_hWnd,TVI_ROOT, buf, &pUnk);
513519 if(pUnk != NULL){
514520 ret = (IUnknown*)pUnk;
515521 }
516522 }
517523 else{
518524 // それ以外はサポート外
519- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
520- retcode = DISP_E_EXCEPTION;
525+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
521526 }
522- ret.Detach(pRet);
523- delete[]pBuf;
524- return retcode;
527+ return ret.Detach(pRet);
525528 }
526529
527530 STDMETHODIMP CControl::SetColumnText(VARIANT item, VARIANT col, VARIANT text)
528531 {
529- if(!m_hParent || !m_hWnd){
532+ if (!m_hParent || !m_hWnd) {
530533 ErrorInfo(IDS_ERR_DESTROYED);
531534 return DISP_E_EXCEPTION;
532535 }
533536
534537 int nIdx = -1;
535538 int nCol = -1;
536- CComVariant varIdx,varCol;
537- if(varIdx.ChangeType(VT_I2,&item) == S_OK){
539+ CComVariant varIdx, varCol;
540+ if (varIdx.ChangeType(VT_I2, &item) == S_OK) {
538541 nIdx = varIdx.iVal;
539542 }
540- if(varCol.ChangeType(VT_I2,&col) == S_OK){
543+ if (varCol.ChangeType(VT_I2, &col) == S_OK) {
541544 nCol = varCol.iVal;
542545 }
543- if(nIdx < 0 || nCol < 0){
546+ if (nIdx < 0 || nCol < 0) {
544547 // 行・桁が取得できなかった場合
545548 return DISP_E_TYPEMISMATCH;
546549 }
547550
548- LPSTR pBuf;
549- if(!(pBuf = ConvertVariantToString(text))){
550- return DISP_E_TYPEMISMATCH;
551+ ATL::CString buf;
552+ HRESULT hr = ConvertVariantToString(text, buf);
553+ if (FAILED(hr)) {
554+ return hr;
551555 }
552556
553- HRESULT retcode = S_OK;
554- if(!lstrcmp(m_classname,WC_LISTVIEW)){
557+ if (!lstrcmp(m_classname, WC_LISTVIEW)) {
555558 int mx = ListView_GetItemCount(m_hWnd);
556- if(nIdx >= mx || nCol >= m_nColumnCount){
559+ if (nIdx >= mx || nCol >= m_nColumnCount) {
557560 // 行または桁がオーバーしている場合
558- ErrorInfo(IDS_ERR_RANDEOUT);
559- retcode = DISP_E_EXCEPTION;
561+ return Error(IDS_ERR_RANDEOUT);
560562 }
561- else{
563+ else {
562564 // リストビューに文字列を追加する
563- ListView_SetItemText(m_hWnd,nIdx,nCol,pBuf);
565+ ListView_SetItemText(m_hWnd, nIdx, nCol, buf.GetBuffer());
564566 }
565567 }
566- else{
568+ else {
567569 // それ以外はサポート外
568- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
569- retcode = DISP_E_EXCEPTION;
570+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
570571 }
571- delete[]pBuf;
572- return retcode;
572+ return S_OK;
573573 }
574574
575575 STDMETHODIMP CControl::GetColumnText(VARIANT idx, VARIANT col, VARIANT *pText)
576576 {
577577 CComVariant ret;
578- if(!m_hParent || !m_hWnd){
579- ErrorInfo(IDS_ERR_DESTROYED);
580- return DISP_E_EXCEPTION;
578+ if (!m_hParent || !m_hWnd) {
579+ return Error(IDS_ERR_DESTROYED);
581580 }
582581
583582 int nIdx = -1;
584583 int nCol = -1;
585- CComVariant varIdx,varCol;
586- if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
584+ CComVariant varIdx, varCol;
585+ if (varIdx.ChangeType(VT_I2, &idx) == S_OK) {
587586 nIdx = varIdx.iVal;
588587 }
589- if(varCol.ChangeType(VT_I2,&col) == S_OK){
588+ if (varCol.ChangeType(VT_I2, &col) == S_OK) {
590589 nCol = varCol.iVal;
591590 }
592- if(nIdx < 0 || nCol < 0){
593- return DISP_E_TYPEMISMATCH;
591+
592+ if (nIdx < 0 || nCol < 0) {
593+ return DISP_E_BADINDEX;
594594 }
595- HRESULT retcode = S_OK;
596- if(!lstrcmp(m_classname,WC_LISTVIEW)){
595+
596+ if (!lstrcmp(m_classname, WC_LISTVIEW)) {
597597 // インデックスを調査
598598 int mx = ListView_GetItemCount(m_hWnd);
599- if(nIdx >= mx || nCol >= m_nColumnCount){
600- ErrorInfo(IDS_ERR_RANDEOUT);
601- return DISP_E_EXCEPTION;
599+ if (nIdx >= mx || nCol >= m_nColumnCount) {
600+ return Error(IDS_ERR_RANDEOUT);
602601 }
602+
603603 // リストビューから文字列を取得する
604- LPSTR pBuf = new CHAR[MAX_PATH+1];
605- ListView_GetItemText(m_hWnd,nIdx,nCol,pBuf,MAX_PATH);
604+ ATL::CString buf;
605+ LPTSTR pBuf = buf.GetBufferSetLength(MAX_PATH);
606+ ListView_GetItemText(m_hWnd, nIdx, nCol, pBuf, MAX_PATH);
606607 ret = pBuf;
607- delete[]pBuf;
608608 }
609- else{
609+ else {
610610 // それ以外はサポート外
611- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
612- retcode = DISP_E_EXCEPTION;
611+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
613612 }
614- ret.Detach(pText);
615- return retcode;
613+ return ret.Detach(pText);
616614 }
617615
618616 STDMETHODIMP CControl::get_ItemObject(VARIANT idx, VARIANT *pVal)
619617 {
620618 ::VariantInit(pVal);
621- if(!m_hParent || !m_hWnd){
622- ErrorInfo(IDS_ERR_DESTROYED);
623- return DISP_E_EXCEPTION;
619+ if (!m_hParent || !m_hWnd) {
620+ return Error(IDS_ERR_DESTROYED);
624621 }
625622
626623 int nIdx = -1;
627624 CComVariant varIdx;
628- if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
625+ if (varIdx.ChangeType(VT_I2,&idx) == S_OK) {
629626 nIdx = varIdx.iVal;
630627 }
631- if(nIdx < 0 ){
632- return DISP_E_TYPEMISMATCH;
628+
629+ if (nIdx < 0 ) {
630+ return DISP_E_BADINDEX;
633631 }
634632
635633 IUnknown* pUnk = NULL;
636- HRESULT retcode = S_OK;
637- if(!lstrcmp(m_classname,"LISTBOX")){
634+ if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
638635 // リストボックスから連想配列オブジェクトを取得する
639636 int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
640- if(nIdx >= mx){
641- ErrorInfo(IDS_ERR_RANDEOUT);
642- return DISP_E_EXCEPTION;
637+ if (nIdx >= mx) {
638+ return Error(IDS_ERR_RANDEOUT);
643639 }
644- DWORD data = ::SendMessage(m_hWnd,LB_GETITEMDATA ,nIdx,0);
645- if(data != LB_ERR && data){
646- pUnk = (IUnknown*)data;
640+ DWORD data = ::SendMessage(m_hWnd, LB_GETITEMDATA, nIdx, 0);
641+ if (data != LB_ERR && data) {
642+ pUnk = (IUnknown*) data;
647643 }
648644 }
649- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
645+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
650646 // リストビューから連想配列オブジェクトを取得する
651647 int mx = ListView_GetItemCount(m_hWnd);
652- if(nIdx >= mx){
653- ErrorInfo(IDS_ERR_RANDEOUT);
654- return DISP_E_EXCEPTION;
648+ if (nIdx >= mx) {
649+ return Error(IDS_ERR_RANDEOUT);
655650 }
651+
656652 LVITEM itm = {0};
657653 itm.mask = LVIF_PARAM;
658654 itm.iItem = nIdx;
659- if(ListView_GetItem(m_hWnd,&itm)){
660- if(itm.lParam){
661- pUnk = (IUnknown*)itm.lParam;
655+ if (ListView_GetItem(m_hWnd, &itm)) {
656+ if (itm.lParam) {
657+ pUnk = (IUnknown*) itm.lParam;
662658 }
663659 }
664660 }
665- else{
661+ else {
666662 // それ以外はサポート外
667- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
668- retcode = DISP_E_EXCEPTION;
663+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
669664 }
670- if(pUnk){
665+
666+ if (pUnk) {
671667 pUnk->AddRef();
672668 pVal->vt = VT_UNKNOWN;
673669 pVal->punkVal = pUnk;
674670 }
675- return retcode;
671+ return S_OK;
676672 }
677673
678674 STDMETHODIMP CControl::DeleteAllItems()
@@ -682,51 +678,49 @@ STDMETHODIMP CControl::DeleteAllItems()
682678 return DISP_E_EXCEPTION;
683679 }
684680 // コントロールの内部アイテムに関連付けられていた連想配列オブジェクトを解放する
685- if(!lstrcmp(m_classname,"LISTBOX")){
681+ if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
686682 // リストの解放
687- int mx = ::SendMessage(m_hWnd,CB_GETCOUNT,0,0);
688- int i;
689- for(i=0;i<mx;i++){
690- DWORD data = ::SendMessage(m_hWnd,LB_GETITEMDATA ,i ,0);
691- if(data != LB_ERR && data){
692- ((IUnknown*)data)->Release();
683+ int mx = ::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0);
684+ for (int i = 0; i < mx; i++) {
685+ DWORD data = ::SendMessage(m_hWnd, LB_GETITEMDATA, i, 0);
686+ if (data != LB_ERR && data) {
687+ ((IUnknown*) data)->Release();
693688 }
694689 }
695690 }
696- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
691+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
697692 // リストビューの連想配列の解放
698693 int mx = ListView_GetItemCount(m_hWnd);
699694 LVITEM itm = {0};
700- int i;
701- for(i=0;i<mx;i++){
695+ for(int i = 0; i < mx; i++) {
702696 itm.mask = LVIF_PARAM;
703697 itm.iItem = i;
704- if(ListView_GetItem(m_hWnd,&itm)){
705- if(itm.lParam){
706- ((IUnknown*)itm.lParam)->Release();
698+ if (ListView_GetItem(m_hWnd,&itm)) {
699+ if (itm.lParam) {
700+ ((IUnknown*) itm.lParam)->Release();
707701 }
708702 }
709703 }
710704 }
711- else if(!lstrcmp(m_classname,WC_TREEVIEW)){
705+ else if (!lstrcmp(m_classname, WC_TREEVIEW)) {
712706 // ツリービューの連想配列の解放
713707 HTREEITEM hItem = TreeView_GetRoot(m_hWnd);
714- while(hItem){
708+ while (hItem) {
715709 HTREEITEM hNextItem = TreeView_GetNextSibling(m_hWnd,hItem);
716- CTreeItem::DeleteTreeItemWithData(m_hWnd,hItem);
710+ CTreeItem::DeleteTreeItemWithData(m_hWnd, hItem);
717711 hItem = hNextItem;
718712 }
719713 }
720714 // 連想配列をもたないコントロールの初期化
721- else if(!lstrcmp(m_classname,"COMBOBOX")){
715+ else if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
722716 // COMBOBOX
723- int cnt = ::SendMessage(m_hWnd,CB_GETCOUNT,0,0);
724- while(cnt > 0){
725- ::SendMessage(m_hWnd,CB_DELETESTRING,0,0);
717+ int cnt = ::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0);
718+ while (cnt > 0) {
719+ ::SendMessage(m_hWnd, CB_DELETESTRING, 0, 0);
726720 cnt--;
727721 }
728722 }
729- else if(!lstrcmp(m_classname,"EDIT")){
723+ else if (!lstrcmp(m_classname, _TEXT("EDIT"))) {
730724 // Edit。
731725 CComVariant dmy(L"");
732726 put_Text(dmy.bstrVal);
@@ -735,160 +729,159 @@ STDMETHODIMP CControl::DeleteAllItems()
735729 }
736730 STDMETHODIMP CControl::DeleteString(VARIANT idx, VARIANT *pRet)
737731 {
738- CComVariant ret;
739732 ::VariantInit(pRet);
740- if(!m_hParent || !m_hWnd){
741- ErrorInfo(IDS_ERR_DESTROYED);
742- return DISP_E_EXCEPTION;
733+
734+ if (!m_hParent || !m_hWnd) {
735+ return Error(IDS_ERR_DESTROYED);
743736 }
744737
745738 int nIdx = -1;
746739 CComVariant varIdx;
747- if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
740+ if (varIdx.ChangeType(VT_I2, &idx) == S_OK) {
748741 nIdx = varIdx.iVal;
749742 }
750- if(nIdx < 0 ){
751- return DISP_E_TYPEMISMATCH;
743+ if (nIdx < 0 ) {
744+ return DISP_E_BADINDEX;
752745 }
753746
754- HRESULT retcode = S_OK;
755- if(!lstrcmp(m_classname,"COMBOBOX")){
747+ CComVariant ret;
748+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
756749 // コンボボックスから文字列を削除する
757- int mx = ::SendMessage(m_hWnd,CB_GETCOUNT,0,0);
758- if(nIdx >= mx){
759- ErrorInfo(IDS_ERR_RANDEOUT);
760- return DISP_E_EXCEPTION;
750+ int mx = ::SendMessage(m_hWnd,CB_GETCOUNT, 0, 0);
751+ if (nIdx >= mx) {
752+ return Error(IDS_ERR_RANDEOUT);
761753 }
762- int result = ::SendMessage(m_hWnd,CB_DELETESTRING,nIdx,0);
754+ int result = ::SendMessage(m_hWnd,CB_DELETESTRING, nIdx, 0);
763755 ret = (bool)(result != LB_ERR);
764756 }
765- else if(!lstrcmp(m_classname,"LISTBOX")){
757+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
766758 // リストボックスから文字列を削除する
767- int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
768- if(nIdx >= mx){
769- ErrorInfo(IDS_ERR_RANDEOUT);
770- return DISP_E_EXCEPTION;
759+ int mx = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
760+ if (nIdx >= mx) {
761+ return Error(IDS_ERR_RANDEOUT);
771762 }
763+
772764 // 連想配列オブジェクトを破棄する
773- DWORD data = ::SendMessage(m_hWnd,LB_GETITEMDATA ,nIdx,0);
774- if(data != LB_ERR && data){
765+ DWORD data = ::SendMessage(m_hWnd,LB_GETITEMDATA, nIdx, 0);
766+ if (data != LB_ERR && data) {
775767 ((IUnknown*)data)->Release();
776768 }
769+
777770 // 削除
778- int result = ::SendMessage(m_hWnd,LB_DELETESTRING,nIdx,0);
771+ int result = ::SendMessage(m_hWnd, LB_DELETESTRING, nIdx, 0);
779772 ret = (bool)(result != LB_ERR);
780773 }
781- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
774+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
782775 // リストビューから文字列を削除する
783776 int mx = ListView_GetItemCount(m_hWnd);
784- if(nIdx >= mx){
785- ErrorInfo(IDS_ERR_RANDEOUT);
786- return DISP_E_EXCEPTION;
777+ if (nIdx >= mx) {
778+ return Error(IDS_ERR_RANDEOUT);
787779 }
780+
788781 // 連想配列オブジェクトを破棄する
789782 LVITEM itm = {0};
790783 itm.mask = LVIF_PARAM;
791784 itm.iItem = nIdx;
792- if(ListView_GetItem(m_hWnd,&itm)){
793- if(itm.lParam){
794- ((IUnknown*)itm.lParam)->Release();
785+ if (ListView_GetItem(m_hWnd,&itm)) {
786+ if (itm.lParam) {
787+ ((IUnknown*) itm.lParam)->Release();
795788 }
796789 }
790+
797791 // 削除
798- ret = (bool)(ListView_DeleteItem(m_hWnd,nIdx)?true:false);
792+ ret = ListView_DeleteItem(m_hWnd, nIdx) ? true : false;
799793 }
800794 else{
801795 // それ以外はサポート外
802- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
803- retcode = DISP_E_EXCEPTION;
796+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
804797 }
805- *pRet = ret;
806- return retcode;
798+
799+ return ret.Detach(pRet);
807800 }
808801
809802 STDMETHODIMP CControl::GetCount(VARIANT *pRet)
810803 {
811- CComVariant ret;
812804 ::VariantInit(pRet);
813- if(!m_hParent || !m_hWnd){
814- ErrorInfo(IDS_ERR_DESTROYED);
815- return DISP_E_EXCEPTION;
805+
806+ if (!m_hParent || !m_hWnd){
807+ return Error(IDS_ERR_DESTROYED);
816808 }
817809
818- HRESULT retcode = S_OK;
819- if(!lstrcmp(m_classname,"COMBOBOX")){
810+ CComVariant ret;
811+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
820812 // リストボックスのカウント
821- int mx = ::SendMessage(m_hWnd,CB_GETCOUNT,0,0);
822- if(mx == LB_ERR) mx = 0;
813+ int mx = ::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0);
814+ if (mx == LB_ERR) {
815+ mx = 0;
816+ }
823817 ret = (short)mx;
824818 }
825- else if(!lstrcmp(m_classname,"LISTBOX")){
819+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
826820 // リストボックスのカウント
827- int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
828- if(mx == LB_ERR) mx = 0;
821+ int mx = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
822+ if (mx == LB_ERR) {
823+ mx = 0;
824+ }
829825 ret = (short)mx;
830826 }
831- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
827+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
832828 // リストビューのカウント
833829 ret = (short)ListView_GetItemCount(m_hWnd);
834830 }
835831 else{
836832 // それ以外はサポート外
837- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
838- retcode = DISP_E_EXCEPTION;
833+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
839834 }
840- ret.Detach(pRet);
841- return retcode;
835+ return ret.Detach(pRet);
842836 }
843837
844838 STDMETHODIMP CControl::get_CurrentSelectedItem(VARIANT *pVal)
845839 {
846840 ::VariantInit(pVal);
847- if(!m_hParent || !m_hWnd){
848- ErrorInfo(IDS_ERR_DESTROYED);
849- return DISP_E_EXCEPTION;
841+
842+ if (!m_hParent || !m_hWnd) {
843+ return Error(IDS_ERR_DESTROYED);
850844 }
851845
852846 CComVariant ret;
853- HRESULT retcode = S_OK;
854- if(!lstrcmp(m_classname,"COMBOBOX")){
847+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
855848 // コンボボックスの現在の選択を返す
856- ret = (long)::SendMessage(m_hWnd,CB_GETCURSEL,0,0);
849+ ret = (long)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
857850 }
858- else if(!lstrcmp(m_classname,"LISTBOX")){
851+ else if(!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
859852 // リストボックスの現在の選択アイテムを返す
860- if(!(m_style & LBS_MULTIPLESEL)){
853+ if (!(m_style & LBS_MULTIPLESEL)) {
861854 // シングルセレクトの場合
862- ret = (long)::SendMessage(m_hWnd,LB_GETCURSEL,0,0);
855+ ret = (long)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);
863856 }
864857 else{
865858 // マルチセレクトの場合は最初の選択アイテムを返す
866859 ret = (long)-1;
867860 int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
868- if(mx > 0){
869- long* pBuf = new long[mx+1];
870- int cnt = ::SendMessage(m_hWnd,LB_GETSELITEMS,mx,(LPARAM)pBuf);
871- if(cnt != LB_ERR && cnt > 0){
872- ret = (long)pBuf[0];
861+ if (mx > 0) {
862+ std::vector<long> buf(mx + 1);
863+ long* pBuf = &buf[0];
864+ int cnt = ::SendMessage(m_hWnd, LB_GETSELITEMS, mx, (LPARAM)pBuf);
865+ if (cnt != LB_ERR && cnt > 0) {
866+ ret = buf[0];
873867 }
874- delete[]pBuf;
875868 }
876869 }
877870 }
878- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
871+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
879872 // リストビューの最初の選択アイテムを探す
880873 ret = (long)ListView_GetNextItem(m_hWnd,-1,LVNI_SELECTED);
881874 }
882- else if(!lstrcmp(m_classname,WC_TREEVIEW)){
875+ else if (!lstrcmp(m_classname, WC_TREEVIEW)) {
883876 // ツリービューの指定アイテムの属性を調べる
884877 HTREEITEM hItem = TreeView_GetSelection(m_hWnd);
885- if(hItem){
878+ if (hItem) {
886879 CComObject<CTreeItem>* pItem = NULL;
887- if(pItem->CreateInstance(&pItem) == S_OK){
880+ if (pItem->CreateInstance(&pItem) == S_OK) {
888881 pItem->AddRef();
889882 pItem->SetParam(m_hWnd,hItem);
890883 IUnknown* pUnk = NULL;
891- if(pItem->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
884+ if (pItem->QueryInterface(IID_IUnknown, (void**)&pUnk) == S_OK) {
892885 ret = pUnk;
893886 }
894887 }
@@ -896,63 +889,56 @@ STDMETHODIMP CControl::get_CurrentSelectedItem(VARIANT *pVal)
896889 }
897890 else{
898891 // それ以外はサポート外
899- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
900- retcode = DISP_E_EXCEPTION;
892+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
901893 }
902- ret.Detach(pVal);
903- return retcode;
894+ return ret.Detach(pVal);
904895 }
905896
906897 STDMETHODIMP CControl::put_CurrentSelectedItem(VARIANT newVal)
907898 {
908- if(!m_hParent || !m_hWnd){
909- ErrorInfo(IDS_ERR_DESTROYED);
910- return DISP_E_EXCEPTION;
899+ if (!m_hParent || !m_hWnd) {
900+ return Error(IDS_ERR_DESTROYED);
911901 }
912902
913- HRESULT retcode = S_OK;
914903 long nIdx = -1;
915904 CComVariant varIdx;
916905 if(varIdx.ChangeType(VT_I4,&newVal) == S_OK){
917906 nIdx = varIdx.lVal;
918907 }
919- if(!lstrcmp(m_classname,"COMBOBOX")){
908+
909+ if( !lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
920910 // コンボボックスを選択を指定する
921- ::SendMessage(m_hWnd,CB_SETCURSEL,nIdx,0);
911+ ::SendMessage(m_hWnd, CB_SETCURSEL, nIdx, 0);
922912 }
923- else if(!lstrcmp(m_classname,"LISTBOX")){
913+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
924914 // リストボックスの選択
925- if(!(m_style & LBS_MULTIPLESEL)){
915+ if (!(m_style & LBS_MULTIPLESEL)) {
926916 // シングルセレクトの場合
927- ::SendMessage(m_hWnd,LB_SETCURSEL,nIdx,0);
917+ ::SendMessage(m_hWnd, LB_SETCURSEL, nIdx, 0);
928918 }
929- else{
919+ else {
930920 // マルチセレクトの場合
931- int mx = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
932- int i;
933- for(i=0;i<mx;i++){
934- ::SendMessage(m_hWnd,LB_SETSEL,false,i);
921+ int mx = ::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0);
922+ for(int i = 0; i < mx; i++) {
923+ ::SendMessage(m_hWnd, LB_SETSEL, FALSE, i);
935924 }
936- if(nIdx >= 0 && nIdx < mx){
937- ::SendMessage(m_hWnd,LB_SETSEL,true,nIdx);
925+ if (nIdx >= 0 && nIdx < mx) {
926+ ::SendMessage(m_hWnd, LB_SETSEL, TRUE, nIdx);
938927 }
939928 }
940929 }
941- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
930+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
942931 // リストビューの選択
943932 int mx = ListView_GetItemCount(m_hWnd);
944- int i;
945- for(i = 0 ; i<mx ; i++){
946- ListView_SetItemState(m_hWnd,i,LVIS_SELECTED ,0);
947- }
948- if(nIdx >= 0 && nIdx < mx){
949- ListView_SetItemState(m_hWnd,i,LVIS_SELECTED ,LVIS_SELECTED);
933+ ListView_SetItemState(m_hWnd, -1, LVIS_SELECTED, 0); // TODO:要確認 -1で全アイテム対象、以前はmx回ループしていた。
934+ if (nIdx >= 0 && nIdx < mx) {
935+ // FIXME:TODO: 要確認 nIdxではなくiを使っていた?正しいとは思えない。
936+ ListView_SetItemState(m_hWnd, nIdx, LVIS_SELECTED, LVIS_SELECTED);
950937 }
951938 }
952939 else{
953940 // それ以外はサポート外
954- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
955- retcode = DISP_E_EXCEPTION;
941+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
956942 }
957943 return S_OK;
958944 }
@@ -960,81 +946,77 @@ STDMETHODIMP CControl::put_CurrentSelectedItem(VARIANT newVal)
960946 STDMETHODIMP CControl::get__NewEnum(IUnknown **pVal)
961947 {
962948 *pVal = NULL;
949+
963950 if(!m_hParent || !m_hWnd){
964- ErrorInfo(IDS_ERR_DESTROYED);
965- return DISP_E_EXCEPTION;
951+ return Error(IDS_ERR_DESTROYED);
966952 }
967953
968- VARIANT* pvarArray = NULL;
954+ std::vector<VARIANT> varArray;
969955 int mx = 0;
970956
971- HRESULT retcode = S_OK;
972- if(!lstrcmp(m_classname,"COMBOBOX")){
957+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
973958 // コンボボックスの現在の選択を返す
974959 int nIdx = ::SendMessage(m_hWnd,CB_GETCURSEL,0,0);
975960 mx = 1;
976- pvarArray = new VARIANT[1];
977- ::VariantInit(&pvarArray[0]);
978- pvarArray[0].vt = VT_I2;
979- pvarArray[0].iVal = nIdx;
961+ varArray.resize(1);
962+ ::VariantInit(&varArray[0]);
963+ varArray[0].vt = VT_I2;
964+ varArray[0].iVal = nIdx;
980965 }
981- else if(!lstrcmp(m_classname,"LISTBOX")){
966+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
982967 // リストボックスの現在の選択アイテムを返す
983- if(!(m_style & LBS_MULTIPLESEL)){
968+ if (!(m_style & LBS_MULTIPLESEL)) {
984969 // シングルセレクトの場合
985- int nIdx = ::SendMessage(m_hWnd,LB_GETCURSEL,0,0);
970+ int nIdx = ::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);
986971 mx = 1;
987- pvarArray = new VARIANT[1];
988- ::VariantInit(&pvarArray[0]);
989- pvarArray[0].vt = VT_I2;
990- pvarArray[0].iVal = nIdx;
972+ varArray.resize(1);
973+ ::VariantInit(&varArray[0]);
974+ varArray[0].vt = VT_I2;
975+ varArray[0].iVal = nIdx;
991976 }
992977 else{
993978 // マルチセレクトの場合は最初の選択アイテムを返す
994979 int sz = ::SendMessage(m_hWnd,LB_GETCOUNT,0,0);
995- long* pBuf = new long[sz+1];
996- mx = ::SendMessage(m_hWnd,LB_GETSELITEMS,sz,(LPARAM)pBuf);
997- if(mx != LB_ERR){
980+ std::vector<long> buf(sz + 1);
981+ long* pBuf = &buf[0];
982+ mx = ::SendMessage(m_hWnd, LB_GETSELITEMS, sz, (LPARAM)pBuf);
983+ if (mx != LB_ERR) {
998984 // 選択が返された場合
999- pvarArray = new VARIANT[mx+1];
1000- int i;
1001- for(i=0 ; i<mx ; i++){
1002- ::VariantInit(&pvarArray[i]);
1003- pvarArray[i].vt = VT_I2;
1004- pvarArray[i].iVal = (short)pBuf[i];
985+ varArray.resize(mx + 1);
986+ for (int i = 0; i < mx; i++) {
987+ ::VariantInit(&varArray[i]);
988+ varArray[i].vt = VT_I2;
989+ varArray[i].iVal = (short)pBuf[i];
1005990 }
1006991 }
1007- delete[]pBuf;
1008992 }
1009993 }
1010994 else if(!lstrcmp(m_classname,WC_LISTVIEW)){
1011995 // リストビューの最初の選択アイテムを探す
1012996 mx = ListView_GetSelectedCount(m_hWnd);
1013- pvarArray = new VARIANT[mx+1];
997+ varArray.resize(mx + 1);
1014998 int nIdx = -1;
1015999 int i = 0;
1016- while((nIdx = ListView_GetNextItem(m_hWnd,nIdx,LVNI_SELECTED)) != -1
1017- && i < mx){
1018- ::VariantInit(&pvarArray[i]);
1019- pvarArray[i].vt = VT_I2;
1020- pvarArray[i].iVal = (short)nIdx;
1000+ while ((nIdx = ListView_GetNextItem(m_hWnd,nIdx,LVNI_SELECTED)) != -1
1001+ && i < mx) {
1002+ ::VariantInit(&varArray[i]);
1003+ varArray[i].vt = VT_I2;
1004+ varArray[i].iVal = (short)nIdx;
10211005 i++;
10221006 }
10231007 }
10241008 else{
10251009 // それ以外はサポート外
1026- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1027- retcode = DISP_E_EXCEPTION;
1010+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
10281011 }
10291012
10301013 // 列挙インターフェイスの生成
10311014 CComObject<CComEnumVARIANT>* pCol = NULL;
1032- if(pCol->CreateInstance(&pCol) == S_OK){
1015+ if (CComObject<CComEnumVARIANT>::CreateInstance(&pCol) == S_OK) {
10331016 pCol->AddRef();
1034- pCol->Init(&pvarArray[0],&pvarArray[mx],pCol,AtlFlagCopy);
1017+ pCol->Init(&varArray[0], &varArray[mx], pCol, AtlFlagCopy);
10351018 *pVal = pCol;
10361019 }
1037- delete[]pvarArray;
10381020 return S_OK;
10391021 }
10401022
@@ -1055,90 +1037,86 @@ STDMETHODIMP CControl::get_ItemSelectState(VARIANT idx, VARIANT *pVal)
10551037 nIdx = idx.iVal;
10561038 }
10571039
1058- HRESULT retcode = S_OK;
1059- if(!lstrcmp(m_classname,"COMBOBOX")){
1040+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
10601041 // コンボボックスの現在の選択を返す
1061- int nSel = ::SendMessage(m_hWnd,CB_GETCURSEL,0,0);
1042+ int nSel = ::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
10621043 // 指定したアイテムと選択が一致していればtrue
10631044 ret = (bool)((nSel == nIdx)?true:false);
10641045 }
1065- else if(!lstrcmp(m_classname,"LISTBOX")){
1046+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
10661047 // リストボックスの現在の選択アイテムを返す
1067- if(!(m_style & LBS_MULTIPLESEL)){
1048+ if (!(m_style & LBS_MULTIPLESEL)) {
10681049 // シングルセレクトの場合
1069- int nSel = ::SendMessage(m_hWnd,LB_GETCURSEL,0,0);
1050+ int nSel = ::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);
10701051 // 指定したアイテムと選択が一致していればtrue
1071- ret = (bool)((nSel == nIdx)?true:false);
1052+ ret = (nSel == nIdx);
10721053 }
10731054 else{
10741055 // マルチセレクトの場合
1075- ret = (bool)(::SendMessage(m_hWnd,LB_GETSEL,nIdx,0)>0?true:false);
1056+ ret = ::SendMessage(m_hWnd, LB_GETSEL, nIdx, 0) > 0;
10761057 }
10771058 }
1078- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
1059+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
10791060 // リストビューの指定アイテムの属性を調べる
10801061 int mx = ListView_GetItemCount(m_hWnd);
1081- if(nIdx >= 0 && nIdx < mx){
1082- UINT state = ListView_GetItemState(m_hWnd,nIdx,LVNI_SELECTED);
1083- ret = (bool)((state & LVNI_SELECTED)?true:false);
1062+ if (nIdx >= 0 && nIdx < mx) {
1063+ UINT state = ListView_GetItemState(m_hWnd, nIdx, LVNI_SELECTED);
1064+ ret = (state & LVNI_SELECTED) != 0;
10841065 }
10851066 }
10861067 else{
10871068 // それ以外はサポート外
1088- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1089- retcode = DISP_E_EXCEPTION;
1069+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
10901070 }
10911071 ret.Detach(pVal);
1092- return retcode;
1072+ return S_OK;
10931073 }
10941074
10951075 STDMETHODIMP CControl::put_ItemSelectState(VARIANT idx, VARIANT newVal)
10961076 {
1097- if(!m_hParent || !m_hWnd){
1098- ErrorInfo(IDS_ERR_DESTROYED);
1099- return DISP_E_EXCEPTION;
1077+ if (!m_hParent || !m_hWnd) {
1078+ return Error(IDS_ERR_DESTROYED);
11001079 }
11011080
11021081 int nIdx = -1;
11031082 CComVariant varIdx;
1104- if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
1083+ if (varIdx.ChangeType(VT_I2,&idx) == S_OK) {
11051084 nIdx = idx.iVal;
11061085 }
1107- BOOL bSelected = false;
1086+
1087+ bool bSelected = false;
11081088 CComVariant varSelected;
1109- if(varSelected.ChangeType(VT_I2,&newVal) == S_OK){
1110- bSelected = newVal.iVal;
1089+ if (varSelected.ChangeType(VT_I2,&newVal) == S_OK) {
1090+ bSelected = newVal.iVal != 0;
11111091 }
11121092
1113- HRESULT retcode = S_OK;
1114- if(!lstrcmp(m_classname,"COMBOBOX")){
1093+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
11151094 // コンボボックスの現在の選択を変更する
1116- ::SendMessage(m_hWnd,CB_SETCURSEL,bSelected?nIdx:-1,0);
1095+ ::SendMessage(m_hWnd, CB_SETCURSEL, bSelected ? nIdx : -1, 0);
11171096 }
1118- else if(!lstrcmp(m_classname,"LISTBOX")){
1097+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
11191098 // リストボックスの現在の選択アイテムを返す
1120- if(!(m_style & LBS_MULTIPLESEL)){
1099+ if (!(m_style & LBS_MULTIPLESEL)) {
11211100 // シングルセレクトの場合
1122- ::SendMessage(m_hWnd,LB_SETCURSEL,bSelected?nIdx:-1,0);
1101+ ::SendMessage(m_hWnd, LB_SETCURSEL, bSelected ? nIdx : -1, 0);
11231102 }
1124- else{
1103+ else {
11251104 // マルチセレクト
1126- ::SendMessage(m_hWnd,LB_SETSEL,nIdx,bSelected);
1105+ ::SendMessage(m_hWnd, LB_SETSEL, nIdx, bSelected);
11271106 }
11281107 }
1129- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
1108+ else if(!lstrcmp(m_classname, WC_LISTVIEW)) {
11301109 // リストビューの指定アイテムの属性を調べる
11311110 int mx = ListView_GetItemCount(m_hWnd);
1132- if(nIdx >= 0 && nIdx < mx){
1133- ListView_SetItemState(m_hWnd,nIdx,bSelected?LVNI_SELECTED:0,LVNI_SELECTED);
1111+ if (nIdx >= 0 && nIdx < mx) {
1112+ ListView_SetItemState(m_hWnd, nIdx, bSelected ? LVNI_SELECTED : 0, LVNI_SELECTED);
11341113 }
11351114 }
11361115 else{
11371116 // それ以外はサポート外
1138- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1139- retcode = DISP_E_EXCEPTION;
1117+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
11401118 }
1141- return retcode;
1119+ return S_OK;
11421120 }
11431121
11441122 STDMETHODIMP CControl::get_SelectedCount(short *pVal)
@@ -1149,33 +1127,31 @@ STDMETHODIMP CControl::get_SelectedCount(short *pVal)
11491127 return DISP_E_EXCEPTION;
11501128 }
11511129
1152- HRESULT retcode = S_OK;
1153- if(!lstrcmp(m_classname,"COMBOBOX")){
1130+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
11541131 // リストボックスのカウント
11551132 int nIdx = ::SendMessage(m_hWnd,CB_GETCURSEL,0,0);
11561133 *pVal = (short)(nIdx>=0?1:0);
11571134 }
1158- else if(!lstrcmp(m_classname,"LISTBOX")){
1135+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
11591136 // リストボックスのカウント
1160- if(!(m_style & LBS_MULTIPLESEL)){
1161- int nIdx = ::SendMessage(m_hWnd,LB_GETCURSEL,0,0);
1162- *pVal = (short)(nIdx>=0?1:0);
1137+ if (!(m_style & LBS_MULTIPLESEL)) {
1138+ int nIdx = ::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);
1139+ *pVal = (short)(nIdx >= 0 ? 1 : 0);
11631140 }
11641141 else{
11651142 // マルチセレクト
1166- *pVal = (short)::SendMessage(m_hWnd,LB_GETSELCOUNT,0,0);
1143+ *pVal = (short)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0);
11671144 }
11681145 }
1169- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
1146+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
11701147 // リストビューのカウント
11711148 *pVal = (short)ListView_GetSelectedCount(m_hWnd);
11721149 }
11731150 else{
11741151 // それ以外はサポート外
1175- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1176- retcode = DISP_E_EXCEPTION;
1152+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
11771153 }
1178- return retcode;
1154+ return S_OK;
11791155 }
11801156
11811157 STDMETHODIMP CControl::get_TreeRoot(VARIANT *pVal)
@@ -1203,57 +1179,60 @@ STDMETHODIMP CControl::get_TreeRoot(VARIANT *pVal)
12031179
12041180 void CControl::ListSort(int column)
12051181 {
1206- if(!m_hParent || !m_hWnd){
1182+ if (!m_hParent || !m_hWnd) {
12071183 return;
12081184 }
1185+
12091186 // おなじカラムをソートした場合は逆順とする
1210- if(m_dLastSortColumn == column){
1187+ if (m_dLastSortColumn == column) {
12111188 m_bSortReverse = !m_bSortReverse;
12121189 }
1213- else{
1190+ else {
12141191 m_bSortReverse = false;
12151192 }
1193+
12161194 m_dLastSortColumn = column;
12171195 m_typCompare = VT_EMPTY;
12181196 // ソートを呼び出す
1219- ListView_SortItems(m_hWnd,CompareFunc,(LPARAM)this);
1197+ ListView_SortItems(m_hWnd, CompareFunc, (LPARAM)this);
12201198 }
12211199
12221200 int CControl::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
12231201 {
1224- if(!lParam1 || !lParam2){
1202+ if (!lParam1 || !lParam2) {
12251203 // イレギュラー。データーがないので比較不可能
12261204 return 0;
12271205 }
1206+
12281207 CControl* me = (CControl*)lParamSort;
12291208
12301209 IObjectMap* pMap1 = (IObjectMap*)lParam1;
12311210 IObjectMap* pMap2 = (IObjectMap*)lParam2;
12321211
1233- CHAR mes[16];
1234- wsprintf(mes,"SORT%d",me->m_dLastSortColumn);
1212+ TCHAR mes[16];
1213+ wsprintf(mes, _TEXT("SORT%d"), me->m_dLastSortColumn);
12351214 CComVariant key(mes);
12361215
12371216 CComVariant val1,val2;
1238- if(!me->m_bSortReverse){
1239- pMap1->get_Value(key,&val1);
1240- pMap2->get_Value(key,&val2);
1217+ if (!me->m_bSortReverse) {
1218+ pMap1->get_Value(key, &val1);
1219+ pMap2->get_Value(key, &val2);
12411220 }
12421221 else{
1243- pMap1->get_Value(key,&val2);
1244- pMap2->get_Value(key,&val1);
1222+ pMap1->get_Value(key, &val2);
1223+ pMap2->get_Value(key, &val1);
12451224 }
12461225
1247- if(me->m_typCompare == VT_EMPTY){
1226+ if (me->m_typCompare == VT_EMPTY) {
12481227 // まだ比較を開始していないなら比較タイプを決定する
12491228 me->m_typCompare = val1.vt;
1250- if(val1.vt != val2.vt){
1229+ if (val1.vt != val2.vt) {
12511230 me->m_typCompare = VT_BSTR;
12521231 }
12531232 }
12541233
12551234 int ret = 0;
1256- switch(me->m_typCompare)
1235+ switch (me->m_typCompare)
12571236 {
12581237 case VT_UI1:
12591238 {
@@ -1294,7 +1273,7 @@ int CControl::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
12941273 {
12951274 val1.ChangeType(VT_CY);
12961275 val2.ChangeType(VT_CY);
1297- ret = (int)(val1.cyVal.int64 - val2.cyVal.int64); //UNDONE: よろしくない。減算結果が桁あふれした場合、比較関数が破綻する。なおさねば。
1276+ ret = (int)(val1.cyVal.int64 - val2.cyVal.int64); //FIXME: よろしくない。減算結果が桁あふれした場合、比較関数が破綻する。なおさねば。
12981277 break;
12991278 }
13001279 case VT_DATE:
@@ -1320,13 +1299,14 @@ int CControl::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
13201299
13211300 void CControl::OnRClick()
13221301 {
1323- if(!m_hParent || !m_hWnd){
1302+ if (!m_hParent || !m_hWnd) {
13241303 return;
13251304 }
1326- if(!lstrcmp(m_classname,WC_TREEVIEW)){
1305+
1306+ if (!lstrcmp(m_classname, WC_TREEVIEW)) {
13271307 // ツリービューであればドロップハイライトを選択にする
13281308 HTREEITEM hItem = TreeView_GetDropHilight(m_hWnd);
1329- if(hItem){
1309+ if (hItem) {
13301310 TreeView_SelectItem(m_hWnd,hItem);
13311311 }
13321312 }
@@ -1335,167 +1315,166 @@ void CControl::OnRClick()
13351315
13361316 STDMETHODIMP CControl::get_ItemCheckState(VARIANT idx, BOOL *pVal)
13371317 {
1338- if(!m_hParent || !m_hWnd){
1339- ErrorInfo(IDS_ERR_DESTROYED);
1340- return DISP_E_EXCEPTION;
1318+ if (!m_hParent || !m_hWnd) {
1319+ return Error(IDS_ERR_DESTROYED);
13411320 }
1342- if(lstrcmp(m_classname,WC_LISTVIEW)){
1321+
1322+ if (lstrcmp(m_classname, WC_LISTVIEW)) {
13431323 // リストビュー以外はサポート外
1344- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1345- return DISP_E_EXCEPTION;
1324+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
13461325 }
1326+
13471327 CComVariant varIdx;
1348- if(varIdx.ChangeType(VT_I2,&idx) != S_OK){
1349- return DISP_E_TYPEMISMATCH;
1328+ HRESULT hr = varIdx.ChangeType(VT_I2, &idx);
1329+ if (FAILED(hr)) {
1330+ return hr;
13501331 }
1332+
13511333 *pVal = VB_FALSE;
1352- if(m_afterstyle & LVS_EX_CHECKBOXES){
1353- *pVal = ListView_GetCheckState(m_hWnd,varIdx.iVal)?VB_TRUE:VB_FALSE;
1334+ if (m_afterstyle & LVS_EX_CHECKBOXES) {
1335+ *pVal = ListView_GetCheckState(m_hWnd, varIdx.iVal) ? VB_TRUE : VB_FALSE;
13541336 }
13551337 return S_OK;
13561338 }
13571339
13581340 STDMETHODIMP CControl::put_ItemCheckState(VARIANT idx, BOOL newVal)
13591341 {
1360- if(!m_hParent || !m_hWnd){
1361- ErrorInfo(IDS_ERR_DESTROYED);
1362- return DISP_E_EXCEPTION;
1342+ if (!m_hParent || !m_hWnd) {
1343+ return Error(IDS_ERR_DESTROYED);
13631344 }
1364- if(lstrcmp(m_classname,WC_LISTVIEW)){
1345+
1346+ if (lstrcmp(m_classname,WC_LISTVIEW)) {
13651347 // リストビュー以外はサポート外
1366- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1367- return DISP_E_EXCEPTION;
1348+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
13681349 }
1350+
13691351 CComVariant varIdx;
1370- if(varIdx.ChangeType(VT_I2,&idx) != S_OK){
1371- return DISP_E_TYPEMISMATCH;
1352+ HRESULT hr = varIdx.ChangeType(VT_I2, &idx);
1353+ if (FAILED(hr)) {
1354+ return hr;
13721355 }
1373- if(m_afterstyle & LVS_EX_CHECKBOXES){
1374- ListView_SetCheckState(m_hWnd,varIdx.iVal,newVal);
1356+
1357+ if (m_afterstyle & LVS_EX_CHECKBOXES) {
1358+ ListView_SetCheckState(m_hWnd, varIdx.iVal, newVal);
13751359 }
13761360 return S_OK;
13771361 }
13781362
13791363 STDMETHODIMP CControl::DeleteSelectedItem()
13801364 {
1381- if(!m_hParent || !m_hWnd){
1382- ErrorInfo(IDS_ERR_DESTROYED);
1383- return DISP_E_EXCEPTION;
1365+ if (!m_hParent || !m_hWnd) {
1366+ return Error(IDS_ERR_DESTROYED);
13841367 }
1385- HRESULT retcode = S_OK;
1386- if(!lstrcmp(m_classname,"LISTBOX")){
1368+
1369+ if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
13871370 // リストボックスの選択削除
1388- CComVariant varRet,dmy;
1389- while(get_CurrentSelectedItem(&varRet) == S_OK && varRet.vt != VT_EMPTY){
1371+ CComVariant varRet, dmy;
1372+ while (get_CurrentSelectedItem(&varRet) == S_OK && varRet.vt != VT_EMPTY) {
13901373 varRet.ChangeType(VT_I4);
1391- if(varRet.lVal < 0){
1374+ if (varRet.lVal < 0) {
13921375 break;
13931376 }
1394- DeleteString(varRet,&dmy);
1377+ DeleteString(varRet, &dmy);
13951378 }
13961379 }
13971380 else if(!lstrcmp(m_classname,WC_LISTVIEW)){
13981381 // リストビューの削除
13991382 int nIdx = -1;
1400- while((nIdx = ListView_GetNextItem(m_hWnd,nIdx,LVNI_SELECTED)) != -1){
1401- CComVariant varIdx((long)nIdx),dmy;
1402- DeleteString(varIdx,&dmy);
1383+ while ((nIdx = ListView_GetNextItem(m_hWnd, nIdx, LVNI_SELECTED)) != -1) {
1384+ CComVariant varIdx((long)nIdx), dmy;
1385+ DeleteString(varIdx, &dmy);
14031386 nIdx = -1;
14041387 }
14051388 }
14061389 else{
14071390 // それ以外はサポート外
1408- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1409- retcode = DISP_E_EXCEPTION;
1391+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
14101392 }
14111393 return S_OK;
14121394 }
14131395
14141396 STDMETHODIMP CControl::get_ItemText(VARIANT idx, BSTR *pVal)
14151397 {
1416- _bstr_t tmp;
14171398 if(!m_hParent || !m_hWnd){
1418- ErrorInfo(IDS_ERR_DESTROYED);
1419- return DISP_E_EXCEPTION;
1399+ return Error(IDS_ERR_DESTROYED);
14201400 }
1401+
14211402 int nIdx = -1;
14221403 CComVariant varIdx;
1423- if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
1404+ if (varIdx.ChangeType(VT_I2,&idx) == S_OK) {
14241405 nIdx = varIdx.iVal;
14251406 }
1407+
14261408 if(nIdx < 0){
14271409 return DISP_E_TYPEMISMATCH;
14281410 }
14291411
1430- HRESULT retcode = S_OK;
1431- if(!lstrcmp(m_classname,"COMBOBOX")){
1412+ CComBSTR ret;
1413+ if (!lstrcmp(m_classname, _TEXT("COMBOBOX"))) {
14321414 // コンホボックスから文字列を取得する
1433- int siz = ::SendMessage(m_hWnd,CB_GETLBTEXTLEN,nIdx,0);
1434- if(siz > 0){
1435- LPTSTR p = new CHAR[siz+1];
1436- if(::SendMessage(m_hWnd,CB_GETLBTEXT,nIdx,(LPARAM)p) > 0){
1437- tmp = (LPCSTR)p;
1415+ int siz = ::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIdx, 0);
1416+ if (siz > 0) {
1417+ ATL::CString tmp;
1418+ LPTSTR p = tmp.GetBufferSetLength(siz + 1);
1419+ if (::SendMessage(m_hWnd, CB_GETLBTEXT, nIdx, (LPARAM)p) > 0) {
1420+ ret = p;
14381421 }
1439- delete[]p;
14401422 }
14411423 }
1442- else if(!lstrcmp(m_classname,"LISTBOX")){
1424+ else if (!lstrcmp(m_classname, _TEXT("LISTBOX"))) {
14431425 // リストから文字列を取得する
1444- int siz = ::SendMessage(m_hWnd,LB_GETTEXTLEN,nIdx,0);
1445- if(siz > 0){
1446- LPTSTR p = new CHAR[siz+1];
1447- if(::SendMessage(m_hWnd,LB_GETTEXT,nIdx,(LPARAM)p) > 0){
1448- tmp = (LPCSTR)p;
1426+ int siz = ::SendMessage(m_hWnd, LB_GETTEXTLEN, nIdx, 0);
1427+ if (siz > 0) {
1428+ ATL::CString tmp;
1429+ LPTSTR p = tmp.GetBufferSetLength(siz + 1);
1430+ if (::SendMessage(m_hWnd, LB_GETTEXT, nIdx, (LPARAM)p) > 0) {
1431+ ret = p;
14491432 }
1450- delete[]p;
14511433 }
14521434 }
1453- else if(!lstrcmp(m_classname,WC_LISTVIEW)){
1454- CComVariant arg,ret;
1435+ else if (!lstrcmp(m_classname, WC_LISTVIEW)) {
1436+ CComVariant arg, text;
14551437 arg = (long)0;
1456- if((retcode = GetColumnText(idx,arg,&ret)) == S_OK){
1457- if(ret.ChangeType(VT_BSTR) == S_OK){
1458- tmp = ret.bstrVal;
1438+ HRESULT hr;
1439+ if (SUCCEEDED(GetColumnText(idx, arg, &text))) {
1440+ if (SUCCEEDED(text.ChangeType(VT_BSTR))) {
1441+ ret = text.bstrVal;
14591442 }
14601443 }
14611444 }
14621445 else{
14631446 // それ以外はサポート外
1464- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1465- retcode = DISP_E_EXCEPTION;
1447+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
14661448 }
1467- *pVal = tmp.copy();
1468- return retcode;
1449+ *pVal = ret.Detach();
1450+ return S_OK;
14691451 }
14701452
14711453 STDMETHODIMP CControl::put_ItemText(VARIANT idx, BSTR newVal)
14721454 {
1473- if(!m_hParent || !m_hWnd){
1474- ErrorInfo(IDS_ERR_DESTROYED);
1475- return DISP_E_EXCEPTION;
1455+ if (!m_hParent || !m_hWnd) {
1456+ return Error(IDS_ERR_DESTROYED);
14761457 }
1458+
14771459 int nIdx = -1;
14781460 CComVariant varIdx;
1479- if(varIdx.ChangeType(VT_I2,&idx) == S_OK){
1461+ if (varIdx.ChangeType(VT_I2, &idx) == S_OK) {
14801462 nIdx = varIdx.iVal;
14811463 }
1482- if(nIdx < 0){
1483- return DISP_E_TYPEMISMATCH;
1464+
1465+ if (nIdx < 0) {
1466+ return DISP_E_BADINDEX;
14841467 }
14851468
1486- HRESULT retcode = S_OK;
1487- if(!lstrcmp(m_classname,WC_LISTVIEW)){
1488- CComVariant arg,text;
1469+ if (!lstrcmp(m_classname, WC_LISTVIEW)) {
1470+ CComVariant arg, text;
14891471 arg = (long)0;
14901472 text = (BSTR)newVal;
1491- retcode = SetColumnText(idx,arg,text);
1492- }
1493- else{
1494- // それ以外はサポート外
1495- ErrorInfo(IDS_ERR_NOTSUPPORTCONTROL);
1496- retcode = DISP_E_EXCEPTION;
1473+ return SetColumnText(idx, arg, text);
14971474 }
1498- return retcode;
1475+
1476+ // それ以外はサポート外
1477+ return Error(IDS_ERR_NOTSUPPORTCONTROL);
14991478 }
15001479
15011480 STDMETHODIMP CControl::SetClassEvent(BSTR name,VARIANT* pvarUnk)
@@ -1513,27 +1492,28 @@ void CControl::GetClassEvent(BSTR *pEventName)
15131492 STDMETHODIMP CControl::CreateChild(VARIANT text, VARIANT varItem, VARIANT* pvarUnk)
15141493 {
15151494 ::VariantInit(pvarUnk);
1516- if(!m_hParent || !m_hWnd){
1517- ErrorInfo(IDS_ERR_DESTROYED);
1518- return DISP_E_EXCEPTION;
1495+ if (!m_hParent || !m_hWnd) {
1496+ return Error(IDS_ERR_DESTROYED);
15191497 }
1498+
15201499 // アイテムの検証
15211500 CComVariant tmp;
1522- if(tmp.ChangeType(VT_UNKNOWN,&varItem) == S_OK){
1501+ if (tmp.ChangeType(VT_UNKNOWN, &varItem) == S_OK) {
15231502 ITreeItem * pItem = NULL;
1524- if(tmp.punkVal->QueryInterface(IID_ITreeItem,(void**)&pItem) != S_OK){
1503+ if (tmp.punkVal->QueryInterface(IID_ITreeItem, (void**) &pItem) != S_OK) {
15251504 return DISP_E_UNKNOWNINTERFACE;
15261505 }
1506+
15271507 IUnknown* pUnk = NULL;
1528- if(pItem->Create(text,&pUnk) == S_OK){
1508+ if (pItem->Create(text,&pUnk) == S_OK) {
15291509 pvarUnk->vt = VT_UNKNOWN;
15301510 pvarUnk->punkVal = pUnk;
15311511 }
15321512 pItem->Release();
15331513 }
15341514 else{
1535- tmp.ChangeType(VT_VARIANT,&varItem);
1536- if(tmp.vt == VT_ERROR || tmp.vt == VT_NULL || tmp.vt == VT_EMPTY){
1515+ tmp.ChangeType(VT_VARIANT, &varItem);
1516+ if (tmp.vt == VT_ERROR || tmp.vt == VT_NULL || tmp.vt == VT_EMPTY) {
15371517 // ルート上にアイテムを作成する
15381518 AddString(text,pvarUnk);
15391519 }
--- a/Control.h
+++ b/Control.h
@@ -10,7 +10,7 @@
1010 // CControl
1111 class ATL_NO_VTABLE CControl :
1212 public CComObjectRootEx<CComSingleThreadModel>,
13-// public CComCoClass<CControl, &CLSID_Control>,
13+ public CComCoClass<CControl, &CLSID_Control>,
1414 public ISupportErrorInfo,
1515 public IConnectionPointContainerImpl<CControl>,
1616 public IDispatchImpl<IControl, &IID_IControl, &LIBID_SERAPHYSCRIPTTOOLSLib>
@@ -34,32 +34,36 @@ public:
3434 m_nColumnCount = 0;
3535 m_dLastSortColumn = -1; //最後にソートしたカラム
3636 }
37- void SetParam(DWORD afterstyle,DWORD exstyle,LPCSTR classname,LPCSTR caption,DWORD style,int x,int y,int w,int h,int nID)
37+
38+ void SetParam(DWORD afterstyle, DWORD exstyle, LPCTSTR classname, LPCTSTR caption, DWORD style, int x, int y, int w, int h, int nID)
3839 {
39- CHAR tmp[64];
40- wsprintf(tmp,"OnCommand%d",nID);
40+ TCHAR tmp[64];
41+ wsprintf(tmp, _T("OnCommand%d"), nID);
4142 m_x = x;
4243 m_y = y;
4344 m_h = h;
4445 m_w = w;
45- m_exstyle = exstyle;
46- m_style = style;
47- lstrcpy(m_classname,classname);
48- lstrcpy(m_caption,caption);
49- m_nID = nID;
46+ m_exstyle = exstyle;
47+ m_style = style;
48+ lstrcpy(m_classname, classname);
49+ lstrcpy(m_caption, caption);
50+ m_nID = nID;
5051 m_bstrClassEvent = tmp;
5152 m_hWnd = NULL;
5253 m_hParent = NULL;
5354 m_afterstyle = afterstyle;
5455 }
56+
5557 HWND GetHWnd()
5658 {
5759 return m_hWnd;
5860 }
61+
5962 void Redraw()
6063 {
61- RedrawWindow(m_hWnd,NULL,NULL,RDW_ERASE|RDW_FRAME|RDW_INTERNALPAINT|RDW_INVALIDATE);
64+ RedrawWindow(m_hWnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INTERNALPAINT | RDW_INVALIDATE);
6265 }
66+
6367 void SetFont(HFONT hFont)
6468 {
6569 if(m_hWnd){
@@ -183,7 +187,7 @@ protected:
183187 VARTYPE m_typCompare;
184188 int m_dLastSortColumn;
185189 int m_nColumnCount;
186- LPSTR ConvertVariantToString(VARIANT text);
190+ HRESULT ConvertVariantToString(VARIANT text, ATL::CString &retval);
187191 };
188192
189193 #endif //__CONTROL_H_
--- a/Draw.cpp
+++ b/Draw.cpp
@@ -64,7 +64,7 @@ STDMETHODIMP CCanvas::get_Layer(VARIANT varLay, VARIANT *pVal)
6464 // 印刷メソッド・プロパティ
6565 STDMETHODIMP CCanvas::PrintAs(VARIANT print,VARIANT* pRet)
6666 {
67- CComVariant varRet,varPrint;
67+ CComVariant varRet, varPrint;
6868 PRINTDLG pdlg = {0};
6969 pdlg.lStructSize = sizeof(PRINTDLG);
7070 pdlg.hwndOwner = m_hParent;
@@ -77,11 +77,11 @@ STDMETHODIMP CCanvas::PrintAs(VARIANT print,VARIANT* pRet)
7777 delete m_pPrinterDeviceMode;
7878 }
7979 DEVMODE *pDevMode = (DEVMODE*)GlobalLock(pdlg.hDevMode);
80- m_pPrinterDeviceMode = (DEVMODE*)new BYTE[siz+1];
81- CopyMemory(m_pPrinterDeviceMode,pDevMode,siz);
80+ m_pPrinterDeviceMode = (DEVMODE*) new BYTE[siz + 1];
81+ CopyMemory(m_pPrinterDeviceMode, pDevMode, siz);
8282 // プリンタ名を保存
83- lstrcpy(m_szPrinterName,(LPCSTR)pDevMode->dmDeviceName);
84- varRet = (LPCSTR)(pDevMode->dmDeviceName);
83+ StringCbCopy(m_szPrinterName, MAX_PATH, (LPCTSTR) pDevMode->dmDeviceName);
84+ varRet = pDevMode->dmDeviceName;
8585 GlobalUnlock(pdlg.hDevMode);
8686 GlobalFree(pdlg.hDevMode);
8787 }
@@ -131,7 +131,7 @@ BOOL CCanvas::PrintCore(CDC dc)
131131 // プリンタのオープン
132132 DOCINFO dinfo = {0};
133133 dinfo.cbSize = sizeof(DOCINFO);
134- dinfo.lpszDocName = "SeraphyScriptTools";
134+ dinfo.lpszDocName = _TEXT("SeraphyScriptTools");
135135 int nJob = StartDoc(dc.m_hDC,&dinfo);
136136 StartPage(dc.m_hDC);
137137 // 印刷範囲の設定
@@ -159,35 +159,41 @@ BOOL CCanvas::PrintCore(CDC dc)
159159
160160 STDMETHODIMP CCanvas::GetPrinterDefault(VARIANT name)
161161 {
162- TCHAR szPrinterName[MAX_PATH];
163- DWORD namesz = MAX_PATH;
164162 CComVariant varName;
165- if(varName.ChangeType(VT_BSTR,&name) == S_OK){
166- WideCharToMultiByte(GetACP(),0,varName.bstrVal,-1,szPrinterName,MAX_PATH,NULL,NULL);
163+ ATL::CString szPrinterName(_TEXT(""));
164+ if (varName.ChangeType(VT_BSTR,&name) == S_OK) {
165+ szPrinterName = varName.bstrVal;
167166 }
168- else if(!GetDefaultPrinter(szPrinterName,&namesz)){
169- // 既定のプリンタが見つからなかった場合
170- ErrorInfo(IDS_ERR_NODEFPRINTER);
171- return DISP_E_EXCEPTION;
167+ else {
168+ DWORD namesz = MAX_PATH;
169+ LPTSTR pName = szPrinterName.GetBufferSetLength(namesz);
170+ if (!GetDefaultPrinter(pName, &namesz)){
171+ // 既定のプリンタが見つからなかった場合
172+ return Error(IDS_ERR_NODEFPRINTER);
173+ }
174+ szPrinterName.ReleaseBuffer();
172175 }
176+
173177 HANDLE hp;
174- if(OpenPrinter(szPrinterName,&hp,NULL)){
175- if(m_pPrinterDeviceMode){
178+ if (OpenPrinter(szPrinterName.GetBuffer(), &hp, NULL)) {
179+ if (m_pPrinterDeviceMode) {
176180 // 既存のバッフアをクリア
177181 delete m_pPrinterDeviceMode;
178182 }
183+
179184 // 必要なパラメーターの保持
180- DWORD sz = (DWORD)DocumentProperties(m_hParent,hp,szPrinterName,NULL,NULL,0);
185+ DWORD sz = (DWORD)DocumentProperties(m_hParent, hp, szPrinterName.GetBuffer(), NULL, NULL, 0);
181186 m_pPrinterDeviceMode = (DEVMODE*)new BYTE[sz+1];
182- DocumentProperties(m_hParent,hp,szPrinterName,m_pPrinterDeviceMode,NULL,DM_OUT_BUFFER);
187+
188+ DocumentProperties(m_hParent, hp, szPrinterName.GetBuffer(), m_pPrinterDeviceMode, NULL, DM_OUT_BUFFER);
183189 ClosePrinter(hp);
190+
184191 // プリンタ名の保存
185- lstrcpy(m_szPrinterName,szPrinterName);
192+ lstrcpy(m_szPrinterName, szPrinterName);
186193 }
187194 else{
188195 // プリンタ情報の取得に失敗した場合
189- ErrorInfo(IDS_ERR_PRINTERSETTING);
190- return DISP_E_EXCEPTION;
196+ return Error(IDS_ERR_PRINTERSETTING);
191197 }
192198 return S_OK;
193199 }
--- a/Form.cpp
+++ b/Form.cpp
@@ -65,25 +65,39 @@ STDMETHODIMP CForm::get_Control(VARIANT varNum, VARIANT *pVal)
6565
6666 STDMETHODIMP CForm::SetControlFont(VARIANT fontname, VARIANT fontsize)
6767 {
68- CComVariant varName,varSize;
69- TCHAR szFontName[MAX_PATH] = {0};
70- if(varName.ChangeType(VT_BSTR,&fontname) == S_OK){
71- WideCharToMultiByte(GetACP(),0,varName.bstrVal,-1,szFontName,MAX_PATH,NULL,NULL);
68+ CComVariant varName;
69+ ATL::CString szFontName;
70+ if (varName.ChangeType(VT_BSTR,&fontname) == S_OK) {
71+ szFontName = varName.bstrVal;
7272 }
73+
74+ CComVariant varSize;
7375 int siz = 20;
74- if(varSize.ChangeType(VT_I2,&fontsize) == S_OK){
76+ if (varSize.ChangeType(VT_I2, &fontsize) == S_OK) {
7577 siz = varSize.iVal;
7678 }
79+
7780 // 確保済みフォントを解放する
78- if(m_hControlFont){
81+ if (m_hControlFont) {
7982 DeleteObject(m_hControlFont);
8083 }
84+
8185 // 新しいフォントを作成する
82- m_hControlFont = CreateFont(siz,0,0,0,0,false,false,false,SHIFTJIS_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,szFontName);
86+ m_hControlFont = CreateFont(
87+ siz,
88+ 0, 0, 0, 0, false, false, false,
89+ SHIFTJIS_CHARSET,
90+ OUT_DEFAULT_PRECIS,
91+ CLIP_DEFAULT_PRECIS,
92+ DEFAULT_QUALITY,
93+ FF_DONTCARE,
94+ szFontName);
95+
8396 m_nControlFontSize = siz;
97+
8498 // 現在のコントロールすべてに適用する(生成されていれば)
8599 list<CComObject<CControl>*>::iterator p = m_lstControl.begin();
86- while(p != m_lstControl.end()){
100+ while (p != m_lstControl.end()) {
87101 (*p)->SetFont(m_hControlFont);
88102 p++;
89103 }
@@ -93,49 +107,49 @@ STDMETHODIMP CForm::SetControlFont(VARIANT fontname, VARIANT fontsize)
93107 STDMETHODIMP CForm::Label(VARIANT text, VARIANT width, VARIANT *pvarUnk)
94108 {
95109 CComVariant dmy;
96- CreateControlCore(text,width,dmy,pvarUnk,0,SS_NOTIFY,0,"STATIC");
110+ CreateControlCore(text,width,dmy,pvarUnk,0,SS_NOTIFY,0, _TEXT("STATIC"));
97111 return S_OK;
98112 }
99113
100114 STDMETHODIMP CForm::Button(VARIANT text, VARIANT width, VARIANT *pvarUnk)
101115 {
102116 CComVariant dmy;
103- CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_PUSHBUTTON,0,"BUTTON");
117+ CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_PUSHBUTTON,0, _TEXT("BUTTON"));
104118 return S_OK;
105119 }
106120
107121 STDMETHODIMP CForm::CheckBox(VARIANT text, VARIANT width, VARIANT *pvarUnk)
108122 {
109123 CComVariant dmy;
110- CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTOCHECKBOX,0,"BUTTON");
124+ CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTOCHECKBOX,0, _TEXT("BUTTON"));
111125 return S_OK;
112126 }
113127
114128 STDMETHODIMP CForm::RadioButton(VARIANT text, VARIANT width, VARIANT *pvarUnk)
115129 {
116130 CComVariant dmy;
117- CreateControlCore(text,width,dmy,pvarUnk,0,BS_AUTORADIOBUTTON|(m_bControlNextIsGroupHead?WS_TABSTOP:0),0,"BUTTON");
131+ CreateControlCore(text,width,dmy,pvarUnk,0,BS_AUTORADIOBUTTON|(m_bControlNextIsGroupHead?WS_TABSTOP:0),0, _TEXT("BUTTON"));
118132 return S_OK;
119133 }
120134
121135 STDMETHODIMP CForm::CheckBox3state(VARIANT text, VARIANT width, VARIANT *pvarUnk)
122136 {
123137 CComVariant dmy;
124- CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTO3STATE,0,"BUTTON");
138+ CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTO3STATE,0, _TEXT("BUTTON"));
125139 return S_OK;
126140 }
127141
128142 STDMETHODIMP CForm::PushCheckButton(VARIANT text, VARIANT width, VARIANT *pvarUnk)
129143 {
130144 CComVariant dmy;
131- CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTOCHECKBOX|BS_PUSHLIKE,0,"BUTTON");
145+ CreateControlCore(text,width,dmy,pvarUnk,0,WS_TABSTOP|BS_AUTOCHECKBOX|BS_PUSHLIKE,0, _TEXT("BUTTON"));
132146 return S_OK;
133147 }
134148
135149 STDMETHODIMP CForm::PushRadioButton(VARIANT text, VARIANT width, VARIANT *pvarUnk)
136150 {
137151 CComVariant dmy;
138- CreateControlCore(text,width,dmy,pvarUnk,0,BS_AUTORADIOBUTTON|BS_PUSHLIKE|(m_bControlNextIsGroupHead?WS_TABSTOP:0),0,"BUTTON");
152+ CreateControlCore(text,width,dmy,pvarUnk,0,BS_AUTORADIOBUTTON|BS_PUSHLIKE|(m_bControlNextIsGroupHead?WS_TABSTOP:0),0, _TEXT("BUTTON"));
139153 return S_OK;
140154 }
141155
@@ -150,7 +164,7 @@ STDMETHODIMP CForm::ReadonlyEdit(VARIANT text, VARIANT width, VARIANT height, VA
150164 // 単一行
151165 style |= ES_AUTOHSCROLL;
152166 }
153- CreateControlCore(text,width,height,punkVal,m_bControlUseStaticEdge?WS_EX_STATICEDGE:WS_EX_CLIENTEDGE,style,0,"EDIT");
167+ CreateControlCore(text,width,height,punkVal,m_bControlUseStaticEdge?WS_EX_STATICEDGE:WS_EX_CLIENTEDGE,style,0, _TEXT("EDIT"));
154168 return S_OK;
155169 }
156170
@@ -165,41 +179,41 @@ STDMETHODIMP CForm::Edit(VARIANT text, VARIANT width, VARIANT height, VARIANT *p
165179 // 単一行
166180 style |= ES_AUTOHSCROLL;
167181 }
168- CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,style,0,"EDIT");
182+ CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,style,0, _TEXT("EDIT"));
169183 return S_OK;
170184 }
171185
172186 STDMETHODIMP CForm::PasswordEdit(VARIANT text, VARIANT width, VARIANT *pvarUnk)
173187 {
174188 CComVariant dmy;
175- CreateControlCore(text,width,dmy,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|ES_PASSWORD,0,"EDIT");
189+ CreateControlCore(text,width,dmy,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|ES_PASSWORD,0, _TEXT("EDIT"));
176190 return S_OK;
177191 }
178192
179193 STDMETHODIMP CForm::ListBox(VARIANT width, VARIANT height,VARIANT* pvarUnk)
180194 {
181195 CComVariant text;
182- CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LBS_NOTIFY|LBS_USETABSTOPS|LBS_NOINTEGRALHEIGHT|LBS_DISABLENOSCROLL,0,"LISTBOX");
196+ CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|LBS_NOTIFY|LBS_USETABSTOPS|LBS_NOINTEGRALHEIGHT|LBS_DISABLENOSCROLL,0, _TEXT("LISTBOX"));
183197 return S_OK;
184198 }
185199
186200 STDMETHODIMP CForm::MultiListBox(VARIANT width, VARIANT height, VARIANT *pvarUnk)
187201 {
188202 CComVariant text;
189- 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,"LISTBOX");
203+ 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"));
190204 return S_OK;
191205 }
192206
193207 STDMETHODIMP CForm::DropdownList(VARIANT width, VARIANT height, VARIANT *pvarUnk)
194208 {
195209 CComVariant dmy;
196- CreateControlCore(dmy,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|CBS_DROPDOWNLIST|CBS_SORT,0,"COMBOBOX");
210+ CreateControlCore(dmy,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|CBS_DROPDOWNLIST|CBS_SORT,0,_TEXT("COMBOBOX"));
197211 return S_OK;
198212 }
199213
200214 STDMETHODIMP CForm::DropdownEdit(VARIANT text,VARIANT width, VARIANT height, VARIANT *pvarUnk)
201215 {
202- CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|CBS_DROPDOWN|CBS_AUTOHSCROLL|CBS_SORT,0,"COMBOBOX");
216+ CreateControlCore(text,width,height,pvarUnk,WS_EX_CLIENTEDGE,WS_TABSTOP|CBS_DROPDOWN|CBS_AUTOHSCROLL|CBS_SORT,0,_TEXT("COMBOBOX"));
203217 return S_OK;
204218 }
205219
@@ -258,12 +272,12 @@ STDMETHODIMP CForm::ClearControls()
258272 return S_OK;
259273 }
260274
261-CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &height,VARIANT *pvarUnk, DWORD extstyle, DWORD style, DWORD afterstyle,LPCSTR classname)
275+CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &height,VARIANT *pvarUnk, DWORD extstyle, DWORD style, DWORD afterstyle,LPCTSTR classname)
262276 {
263277 CComVariant varText;
264- TCHAR szCaption[MAX_PATH] = {0};
265- if(varText.ChangeType(VT_BSTR,&text) == S_OK){
266- WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,szCaption,MAX_PATH,NULL,NULL);
278+ ATL::CString szCaption;
279+ if (varText.ChangeType(VT_BSTR,&text) == S_OK) {
280+ szCaption = varText.bstrVal;
267281 }
268282
269283 // 配置サイズの取得
@@ -321,7 +335,7 @@ CControl* CForm::CreateControlCore(VARIANT &text, VARIANT &width, VARIANT &heigh
321335 pvarUnk->punkVal = pUnk;
322336
323337 // 次に改行したときに移動する量
324- if(!lstrcmp(classname,"COMBOBOX")){
338+ if (!lstrcmp(classname, _TEXT("COMBOBOX"))) {
325339 // コンボボックスは表示されているのは1行分だけ。
326340 nHeight = m_nControlFontSize;
327341 }
@@ -381,7 +395,7 @@ STDMETHODIMP CForm::ControlPad(VARIANT width, VARIANT height)
381395
382396 STDMETHODIMP CForm::StatusLabel(VARIANT text, VARIANT width, VARIANT height, VARIANT *pvarUnk)
383397 {
384- CreateControlCore(text,width,height,pvarUnk,m_bControlUseStaticEdge?WS_EX_STATICEDGE:WS_EX_CLIENTEDGE,SS_NOTIFY,0,"STATIC");
398+ CreateControlCore(text,width,height,pvarUnk,m_bControlUseStaticEdge?WS_EX_STATICEDGE:WS_EX_CLIENTEDGE,SS_NOTIFY,0,_TEXT("STATIC"));
385399 return S_OK;
386400 }
387401
--- a/Form.h
+++ b/Form.h
@@ -91,8 +91,10 @@ public:
9191 STDMETHOD(Button)(/*[in]*/VARIANT text,/*[in]*/VARIANT width,/*[out,retval]*/ VARIANT *pvarUnk);
9292 STDMETHOD(Label)(/*[in]*/VARIANT text,/*[in,optional]*/VARIANT width,/*[out,retval]*/VARIANT* pvarUnk);
9393 protected:
94- CControl* CreateControlCore(VARIANT& text,VARIANT& width,VARIANT& height,VARIANT* pvarUnk,DWORD extstyle,DWORD style,DWORD afterstyle,LPCSTR classname);
95- list<CComObject<CControl>*> m_lstControl;
94+ CControl* CreateControlCore(VARIANT& text, VARIANT& width, VARIANT& height, VARIANT* pvarUnk,
95+ DWORD extstyle, DWORD style, DWORD afterstyle, LPCTSTR classname);
96+
97+ std::list<CComObject<CControl>*> m_lstControl;
9698 BOOL m_bControlUseStaticEdge;
9799 BOOL m_bControlNextIsGroupHead;
98100 int m_nCommandID;
--- a/Layer.cpp
+++ b/Layer.cpp
@@ -42,7 +42,8 @@ void CLayer::Draw(CDC dc)
4242 fntsiz = MulDiv(fntsiz,height_mm,height_px);
4343 ReleaseDC(hWnd,hdc);
4444 }
45- 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);
45+ HFONT hFont = CreateFont(fntsiz, 0, 0, 0, 0, false, false, false,
46+ SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, m_szFontName);
4647 HFONT hOldFont = NULL;
4748 if(hFont){
4849 hOldFont = (HFONT)SelectObject(dc.m_hDC,hFont);
@@ -80,40 +81,43 @@ void CLayer::FinalRelease()
8081 STDMETHODIMP CLayer::Text(VARIANT x,VARIANT y,VARIANT text)
8182 {
8283 CComVariant str;
83- if(str.ChangeType(VT_BSTR,&text) != S_OK){
84- return DISP_E_TYPEMISMATCH;
84+ HRESULT hr = str.ChangeType(VT_BSTR, &text);
85+ if(FAILED(hr)) {
86+ return hr;
8587 }
88+
8689 long lx = GetMappedValue(x);
8790 long ly = GetMappedValue(y);
8891 int len = SysStringByteLen(str.bstrVal);
89- LPSTR pBuf = new CHAR[len+1];
90- WideCharToMultiByte(GetACP(),0,str.bstrVal,len,pBuf,len,0,0);
91- pBuf[len] = 0;
92- AddDrawData(new textdata(lx,ly,pBuf,m_bTextMappingMode));
93- delete[]pBuf;
92+
93+ ATL::CString buf(str.bstrVal);
94+
95+ AddDrawData(new textdata(lx, ly, buf, m_bTextMappingMode));
9496 return S_OK;
9597 }
9698
9799 STDMETHODIMP CLayer::TextBox(VARIANT sx, VARIANT sy, VARIANT ex, VARIANT ey, VARIANT text, VARIANT fmt)
98100 {
99- CComVariant str,cfmt;
100101 long lsx = GetMappedValue(sx);
101102 long lsy = GetMappedValue(sy);
102103 long lex = GetMappedValue(ex);
103104 long ley = GetMappedValue(ey);
105+
104106 UINT ufmt = 0;
105- if(cfmt.ChangeType(VT_I4,&fmt) == S_OK){
107+ CComVariant cfmt;
108+ if (cfmt.ChangeType(VT_I4, &fmt) == S_OK){
106109 ufmt = cfmt.lVal;
107110 }
108- if(str.ChangeType(VT_BSTR,&text) != S_OK){
109- return DISP_E_TYPEMISMATCH;
111+
112+ CComVariant str;
113+ HRESULT hr = str.ChangeType(VT_BSTR, &text);
114+ if (FAILED(hr)) {
115+ return hr;
110116 }
111- int len = SysStringByteLen(str.bstrVal);
112- LPSTR pBuf = new CHAR[len+1];
113- int cnt = WideCharToMultiByte(GetACP(),0,str.bstrVal,-1,pBuf,len,0,0);
114- pBuf[cnt-1] = 0;
115- AddDrawData(new textboxdata(lsx,lsy,lex,ley,pBuf,ufmt,m_bTextMappingMode));
116- delete[]pBuf;
117+
118+ ATL::CString buf(str.bstrVal);
119+
120+ AddDrawData(new textboxdata(lsx, lsy, lex, ley, buf, ufmt, m_bTextMappingMode));
117121 return S_OK;
118122 }
119123
@@ -333,15 +337,14 @@ STDMETHODIMP CLayer::put_Visible(BOOL newVal)
333337
334338 STDMETHODIMP CLayer::get_FontName(BSTR *pVal)
335339 {
336- WCHAR wmes[MAX_PATH];
337- MultiByteToWideChar(GetACP(),0,m_szFontName,-1,wmes,MAX_PATH);
338- *pVal = SysAllocString(wmes);
340+ CComBSTR ret(m_szFontName);
341+ *pVal = ret.Detach();
339342 return S_OK;
340343 }
341344
342345 STDMETHODIMP CLayer::put_FontName(BSTR newVal)
343346 {
344- WideCharToMultiByte(GetACP(),0,newVal,-1,m_szFontName,MAX_PATH,NULL,NULL);
347+ m_szFontName = newVal;
345348 return S_OK;
346349 }
347350
--- a/Layer.h
+++ b/Layer.h
@@ -61,7 +61,7 @@ protected:
6161 class textdata : public drawdata
6262 {
6363 public:
64- textdata(long x,long y,LPCSTR text,BOOL mapmode)
64+ textdata(long x, long y, LPCTSTR text, BOOL mapmode)
6565 {
6666 pBuf = new TCHAR[lstrlen(text)+1];
6767 lstrcpy(pBuf,text);
@@ -69,11 +69,13 @@ public:
6969 m_y = y;
7070 m_bTextMappingMode = mapmode;
7171 }
72+
7273 virtual void Destroy()
7374 {
7475 delete pBuf;
7576 delete this;
7677 }
78+
7779 virtual void Draw(CDC dc)
7880 {
7981 POINT pt = {m_x,m_y};
@@ -95,7 +97,7 @@ protected:
9597 class textboxdata : public drawdata
9698 {
9799 public:
98- textboxdata(long sx,long sy,long ex,long ey,LPCSTR text,UINT fmt,BOOL mapmode)
100+ textboxdata(long sx, long sy, long ex, long ey, LPCTSTR text, UINT fmt, BOOL mapmode)
99101 {
100102 pBuf = new TCHAR[lstrlen(text)+1];
101103 lstrcpy(pBuf,text);
@@ -509,7 +511,7 @@ public:
509511 m_nFontSize = 0;
510512 m_dwFillColor = 0x808080;
511513 m_dwFontColor = ::GetSysColor(COLOR_WINDOWTEXT);
512- ZeroMemory(m_szFontName,MAX_PATH);
514+ m_szFontName.Empty();
513515 // マッピングモード
514516 m_bTextMappingMode = 0;
515517 m_bFontTextMappingMode = 0;
@@ -572,7 +574,7 @@ protected:
572574 DWORD m_dwColor;
573575 int m_nFontSize;
574576 BOOL m_bVisible;
575- CHAR m_szFontName[MAX_PATH];
577+ ATL::CString m_szFontName;
576578 int m_bTextMappingMode;
577579 int m_bFontTextMappingMode;
578580 };
--- a/ObjectMap.cpp
+++ b/ObjectMap.cpp
@@ -232,24 +232,21 @@ STDMETHODIMP CObjectMap::ExpandVariables(VARIANT text, VARIANT env, VARIANT *pVa
232232 }
233233 }
234234 }
235- else if(bEnv){
235+ else if (bEnv){
236236 // 連想配列には存在せず、環境変数展開が指示されている
237- CHAR szName [MAX_PATH] = { 0 };
238- CHAR szBuf [MAX_PATH] = { 0 };
239- WCHAR wbuf[MAX_PATH] = { 0 };
240- WideCharToMultiByte(GetACP(),0,name,-1,szName,MAX_PATH,NULL,NULL);
241- DWORD ret = GetEnvironmentVariable(szName,szBuf,MAX_PATH);
242- if(ret && ret < MAX_PATH){
237+ ATL::CString szName(name);
238+ TCHAR szBuf[MAX_PATH] = {0};
239+ DWORD ret = GetEnvironmentVariable(szName, szBuf, MAX_PATH);
240+ if (ret && ret < MAX_PATH) {
243241 // 環境変数が発見された
244- if(phase == 0){
242+ if (phase == 0) {
245243 // フエーズ1はカウントするだけ
246244 expandsize += ret;
247245 }
248246 else{
249247 // フェーズ2は実際に書き込む
250- MultiByteToWideChar(GetACP(),0,szBuf,ret,wbuf,MAX_PATH);
251- UINT i;
252- for(i=0;i<ret;i++){
248+ ATL::CStringW wbuf(szBuf);
249+ for (UINT i=0; i < ret; i++) {
253250 pExpandBuffer[writeidx++] = wbuf[i];
254251 }
255252 }
--- a/OverlappedWindow.cpp
+++ b/OverlappedWindow.cpp
@@ -205,11 +205,11 @@ HWND COverlappedWindow::SafeCreateWnd()
205205
206206 if(windowParam.noclose){
207207 // 閉じるボタンなしタイプ
208- windowParam.SetWindowClassName("SeraphyScriptToolsOverlappedWindowNC");
208+ windowParam.SetWindowClassName(_TEXT("SeraphyScriptToolsOverlappedWindowNC"));
209209 windowParam.wndstyle = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_NOCLOSE;
210210 }
211211 else{
212- windowParam.SetWindowClassName("SeraphyScriptToolsOverlappedWindow");
212+ windowParam.SetWindowClassName(_TEXT("SeraphyScriptToolsOverlappedWindow"));
213213 windowParam.wndstyle = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
214214 }
215215
@@ -231,7 +231,7 @@ HWND COverlappedWindow::SafeCreateWnd()
231231 HWND hWnd = CreateWindowEx(
232232 WS_EX_CONTROLPARENT,
233233 windowParam.szClassName,
234- "", // ダミー
234+ _TEXT(""), // ダミー
235235 windowParam.GetStyle(),
236236 CW_USEDEFAULT,
237237 CW_USEDEFAULT,
@@ -239,7 +239,7 @@ HWND COverlappedWindow::SafeCreateWnd()
239239 windowParam.height,
240240 m_hParentWnd,
241241 NULL, _Module.m_hInst, this);
242- ::SetWindowLong(hWnd,GWL_USERDATA,(LONG)this); // クラスと関連付ける
242+ ::SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) this); // クラスと関連付ける
243243 m_hPopupWnd = hWnd;
244244 // ウィンドウスタイルの再設定
245245 ::SetWindowLong(m_hPopupWnd,GWL_STYLE,windowParam.GetStyle());
@@ -253,7 +253,7 @@ HWND COverlappedWindow::SafeCreateWnd()
253253 minfo.fMask = MIIM_TYPE|MIIM_ID;
254254 minfo.fType = MFT_STRING;
255255 minfo.wID = WM_MOVENEXT_OVERLAPPED;
256- minfo.dwTypeData = "次のウィンドウに移動\tF6";
256+ minfo.dwTypeData = _TEXT("次のウィンドウに移動\tF6"); //FIXME: リソースに移動する
257257 ::InsertMenuItem(hMenu,cnt,true,&minfo);
258258
259259 // フォームのメインウィンドウ用としてアタッチする
@@ -271,7 +271,7 @@ HWND COverlappedWindow::SafeCreateWnd()
271271
272272 LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
273273 {
274- COverlappedWindow* me = (COverlappedWindow*)::GetWindowLong(hWnd,GWL_USERDATA);
274+ COverlappedWindow* me = (COverlappedWindow*)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
275275
276276 // 緊急停止の判定
277277 if(GetAsyncKeyState(VK_PAUSE) & 0x8000){
@@ -453,7 +453,7 @@ LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
453453 {
454454 #ifdef _DEBUG
455455 TCHAR mes[MAX_PATH];
456- wsprintf(mes,"command=%d:%d\n",HIWORD(wParam),LOWORD(wParam));
456+ wsprintf(mes, _TEXT("command=%d:%d\n"), HIWORD(wParam), LOWORD(wParam));
457457 OutputDebugString(mes);
458458 #endif
459459 HWND hControl = (HWND)lParam;
@@ -515,8 +515,8 @@ LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
515515 {
516516 // ListViewでカラムがクリックされたことを通知する
517517 LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
518- DWORD addr = ::GetWindowLong(pnmv->hdr.hwndFrom,GWL_USERDATA);
519- if(addr){
518+ LONG_PTR addr = ::GetWindowLongPtr(pnmv->hdr.hwndFrom, GWLP_USERDATA);
519+ if (addr) {
520520 // カラムクリックによるソーティングを行う
521521 CComObject<CControl>* pCtrl = (CComObject<CControl>*)addr;
522522 pCtrl->ListSort(pnmv->iSubItem);
@@ -564,8 +564,8 @@ LRESULT CALLBACK COverlappedWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
564564 {
565565 // ListView - TreeView で右クリックされたことを通知する
566566 LPNMHDR lpnmh = (LPNMHDR) lParam;
567- DWORD addr = ::GetWindowLong(lpnmh->hwndFrom,GWL_USERDATA);
568- if(addr){
567+ LONG_PTR addr = ::GetWindowLong(lpnmh->hwndFrom, GWLP_USERDATA);
568+ if (addr) {
569569 CComObject<CControl>* pCtrl = (CComObject<CControl>*)addr;
570570 pCtrl->OnRClick(); // コントロールに右クリックを通知し前処理を行わせる
571571 }
@@ -790,10 +790,9 @@ STDMETHODIMP COverlappedWindow::DoEvent(VARIANT *varResult)
790790 }
791791 }
792792 // メニューの検索
793- if(m_hMenu && nID >= 100){
794- map<int,_bstr_t>::iterator p;
795- p = m_cMenuMap.find(nID);
796- if(p != m_cMenuMap.end()){
793+ if (m_hMenu && nID >= 100) {
794+ map<int, CComBSTR>::iterator p = m_cMenuMap.find(nID);
795+ if (p != m_cMenuMap.end()) {
797796 // 発見された
798797 ClassObjectInvoke(p->second);
799798 }
@@ -1251,33 +1250,32 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
12511250 HRESULT hRet = S_OK;
12521251 CComVariant tmp;
12531252 if(tmp.ChangeType(VT_BSTR,&fmt) == S_OK){
1254- UINT len = SysStringByteLen(tmp.bstrVal)+1;
1255- LPSTR pBuf = new CHAR[len];
1256- int cnt = WideCharToMultiByte(GetACP(),0,tmp.bstrVal,-1,pBuf,len,NULL,NULL);
1257- pBuf[cnt - 1] = 0;
1253+ ATL::CString buf(tmp.bstrVal);
1254+
12581255 // 古いメニューを破棄する
1259- if(m_hMenu){
1256+ if (m_hMenu) {
12601257 m_cMenuMap.clear();
12611258 ::SetMenu(m_hPopupWnd,NULL);
12621259 DestroyMenu(m_hMenu);
12631260 m_hMenu = NULL;
12641261 }
1265- if(cnt > 1){
1262+
1263+ if (buf.GetLength() > 0) {
12661264 // 項目があればメニュー名をパースする
12671265 m_hMenu = CreateMenu();
12681266 TCHAR menuname[MAX_PATH];
12691267 TCHAR szSubmenu[MAX_PATH];
1270- LPSTR p = pBuf;
1268+ LPTSTR p = buf.GetBuffer();
12711269 HMENU hPopupMenu = NULL;
12721270 int lv1 = 0;
12731271 int lv2 = 0;
12741272 int cmd = 0;
1275- while(*p){
1276- while(*p == ' ' || *p == '\t')p++; // ブランクスキップ
1277- if(*p == '/'){
1273+ while (*p) {
1274+ while (*p == ' ' || *p == '\t') p++; // ブランクスキップ
1275+ if (*p == '/') {
12781276 p++;
12791277 // ポップアップメニューの作成
1280- if(hPopupMenu){
1278+ if (hPopupMenu) {
12811279 // 既存のポップアップを埋め込む
12821280 MENUITEMINFO inf = {0};
12831281 inf.cbSize = sizeof(MENUITEMINFO);
@@ -1291,38 +1289,38 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
12911289 lv2 = 0;
12921290 cmd = 0;
12931291 hPopupMenu = CreatePopupMenu();
1294- LPSTR d = p;
1295- while(*p && *p != ',' && *p != '/' && *p != ':'){
1292+ LPTSTR d = p;
1293+ while (*p && *p != ',' && *p != '/' && *p != ':') {
12961294 p = CharNext(p);
12971295 }
1298- ZeroMemory(szSubmenu,MAX_PATH);
1299- CopyMemory(szSubmenu,d,p-d);
1300- if(*p == ',' || *p == ':'){
1296+ ZeroMemory(szSubmenu, MAX_PATH);
1297+ CopyMemory(szSubmenu, d, p-d);
1298+ if (*p == ',' || *p == ':') {
13011299 p++;
13021300 }
13031301 }
13041302 else{
13051303 // メニューの作成
1306- if(hPopupMenu){
1307- LPSTR d = p;
1308- while(*p && *p != ',' && *p != '/' && *p != ':'){
1304+ if (hPopupMenu) {
1305+ LPTSTR d = p;
1306+ while (*p && *p != ',' && *p != '/' && *p != ':') {
13091307 p = CharNext(p);
13101308 }
1311- ZeroMemory(menuname,MAX_PATH);
1312- CopyMemory(menuname,d,p-d);
1309+ ZeroMemory(menuname, MAX_PATH);
1310+ CopyMemory(menuname, d, p-d);
13131311 // コマンドセパレーターを検査する
1314- _bstr_t eventname;
1315- LPSTR findcmd = strchr(menuname,'@');
1312+ CComBSTR eventname;
1313+ LPTSTR findcmd = _tcschr(menuname, _TEXT('@'));
13161314 if(findcmd){
13171315 *findcmd = 0;
13181316 eventname = (LPCSTR)(findcmd + 1);
13191317 }
13201318 else{
1321- CHAR tmp[64];
1322- wsprintf(tmp,"OnMenu%d",lv1*100+cmd);
1319+ TCHAR tmp[64];
1320+ wsprintf(tmp, _TEXT("OnMenu%d"), lv1 * 100 + cmd);
13231321 eventname = tmp;
13241322 }
1325- m_cMenuMap.insert(pair<int,_bstr_t>(lv1*100+cmd,eventname));
1323+ m_cMenuMap.insert(std::pair<int, CComBSTR>(lv1 * 100 + cmd, eventname));
13261324 // メニューの作成
13271325 MENUITEMINFO inf = {0};
13281326 inf.cbSize = sizeof(MENUITEMINFO);
@@ -1362,7 +1360,6 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
13621360 }
13631361 ::SetMenu(m_hPopupWnd,m_hMenu);
13641362 }
1365- delete[]pBuf;
13661363 }
13671364 return hRet;
13681365 }
@@ -1370,70 +1367,75 @@ STDMETHODIMP COverlappedWindow::SetMenu(VARIANT fmt)
13701367 STDMETHODIMP COverlappedWindow::TrackPopupMenu(VARIANT text, VARIANT cmd,VARIANT* pRet)
13711368 {
13721369 SafeCreateWnd();
1373- CComVariant varCmd;
1374- CComVariant varText;
1370+
13751371 CComVariant varRet;
13761372 varRet = 0;
13771373
13781374 int nCommand = 0;
1379- if(varCmd.ChangeType(VT_I2,&cmd) == S_OK){
1375+ CComVariant varCmd;
1376+ if (varCmd.ChangeType(VT_I2, &cmd) == S_OK){
13801377 nCommand = varCmd.iVal;
13811378 }
1382- if(varText.ChangeType(VT_BSTR,&text) == S_OK){
1379+
1380+ CComVariant varText;
1381+ if (varText.ChangeType(VT_BSTR, &text) == S_OK) {
13831382 TCHAR menuname[MAX_PATH];
1384- UINT len = SysStringByteLen(varText.bstrVal)+1;
1385- LPSTR pBuf = new CHAR[len];
1386- int cnt = WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,pBuf,len,NULL,NULL);
1387- pBuf[cnt - 1] = 0;
1388- LPSTR p = pBuf;
1383+
1384+ ATL::CString buf(varText.bstrVal);
1385+ UINT len = buf.GetLength() + 1;
1386+ LPTSTR p = buf.GetBuffer();
1387+
13891388 int lv = 0;
13901389 int cmd = 0;
13911390 HMENU hPopupMenu = CreatePopupMenu();
1392- while(*p){
1393- LPSTR d = p;
1394- while(*p == ' ' || *p == '\t'){
1391+ while (*p) {
1392+ LPTSTR d = p;
1393+ while (*p == ' ' || *p == '\t') {
13951394 p++;
13961395 }
1397- while(*p && *p != ',' && *p != '/' && *p != ':'){
1396+ while (*p && *p != ',' && *p != '/' && *p != ':') {
13981397 p = CharNext(p);
13991398 }
1400- ZeroMemory(menuname,MAX_PATH);
1401- CopyMemory(menuname,d,p-d);
1399+ ZeroMemory(menuname, MAX_PATH);
1400+ CopyMemory(menuname, d, p-d);
14021401 MENUITEMINFO inf = {0};
14031402 inf.cbSize = sizeof(MENUITEMINFO);
14041403 inf.fMask = MIIM_TYPE|MIIM_ID;
14051404 inf.fType = MFT_STRING;
1406- if(nCommand != 0){
1407- inf.wID = nCommand + cmd;
1405+ if (nCommand != 0) {
1406+ inf.wID = nCommand + cmd;
14081407 }
1409- else{
1408+ else {
14101409 // コマンドベースが0ならばコマンドイベントは発生させない。
14111410 // TrackPopupMenuはコマンドを選択しなかった場合は0を返すため、0よりも大きな値にする必要がある。
14121411 inf.wID = nCommand + cmd + 1;
14131412 }
14141413 inf.dwTypeData = menuname;
1415- InsertMenuItem(hPopupMenu,lv,true,&inf);
1414+ InsertMenuItem(hPopupMenu, lv, true, &inf);
14161415 lv++;
14171416 cmd++;
1418- if(*p == ',' || *p == '/'){
1417+ if (*p == ',' || *p == '/') {
14191418 p++;
14201419 }
1421- else if(*p == ':'){
1420+ else if (*p == ':') {
14221421 inf.fMask = MIIM_TYPE;
14231422 inf.fType = MFT_SEPARATOR;
1424- InsertMenuItem(hPopupMenu,lv,true,&inf);
1423+ InsertMenuItem(hPopupMenu, lv, true, &inf);
14251424 p++;
14261425 lv++;
14271426 }
14281427 }
1429- delete[]pBuf;
1428+
14301429 // TrackPopupMene
14311430 DWORD pos = GetMessagePos();
14321431 ::SetFocus(m_hPopupWnd);
1433- varRet = (SHORT)::TrackPopupMenuEx(hPopupMenu
1434- ,TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON |
1435- (nCommand==0?(TPM_NONOTIFY|TPM_RETURNCMD):0) // コマンドベースが0であれば、コマンドイベントを通知させない。
1436- ,LOWORD(pos),HIWORD(pos),m_hPopupWnd,NULL);
1432+ varRet = (SHORT) ::TrackPopupMenuEx(hPopupMenu,
1433+ TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON |
1434+ (nCommand == 0 ? (TPM_NONOTIFY | TPM_RETURNCMD) : 0), // コマンドベースが0であれば、コマンドイベントを通知させない。
1435+ LOWORD(pos),
1436+ HIWORD(pos),
1437+ m_hPopupWnd,
1438+ NULL);
14371439 DestroyMenu(hPopupMenu);
14381440 }
14391441 varRet.Detach(pRet);
@@ -1641,36 +1643,38 @@ STDMETHODIMP COverlappedWindow::get_Exstyle(long *pVal)
16411643 STDMETHODIMP COverlappedWindow::put_Exstyle(long newVal)
16421644 {
16431645 windowParam.exstyle = (DWORD)newVal;
1644- if(m_hPopupWnd){
1645- ::SetWindowLong(m_hPopupWnd,GWL_STYLE,windowParam.exstyle);
1646+ if (m_hPopupWnd) {
1647+ ::SetWindowLong(m_hPopupWnd, GWL_STYLE, windowParam.exstyle);
16461648 }
16471649 return S_OK;
16481650 }
16491651
16501652 STDMETHODIMP COverlappedWindow::get_WindowClassName(BSTR *pVal)
16511653 {
1652- WCHAR wmes[MAX_PATH];
1653- MultiByteToWideChar(GetACP(),0,windowParam.szClassName,-1,wmes,MAX_PATH);
1654- *pVal = SysAllocString(wmes);
1654+ CComBSTR tmp(windowParam.szClassName);
1655+ *pVal = tmp.Detach();
16551656 return S_OK;
16561657 }
16571658
16581659 STDMETHODIMP COverlappedWindow::Refresh()
16591660 {
1660- if(m_hPopupWnd){
1661- ::SetWindowPos(m_hPopupWnd,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOCOPYBITS);
1661+ if (m_hPopupWnd) {
1662+ ::SetWindowPos(
1663+ m_hPopupWnd,
1664+ NULL,
1665+ 0, 0, 0, 0,
1666+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
16621667 }
16631668 return S_OK;
16641669 }
16651670
16661671 void COverlappedWindow::SetTitle()
16671672 {
1668- if(!m_hPopupWnd){
1673+ if (!m_hPopupWnd) {
16691674 return;
16701675 }
1671- TCHAR szTitle[MAX_PATH] = {0};
1672- WideCharToMultiByte(GetACP(),0,m_bstrCaption,-1,szTitle,MAX_PATH,NULL,NULL);
1673- ::SetWindowText(m_hPopupWnd,szTitle);
1676+ ATL::CString tmp(m_bstrCaption);
1677+ ::SetWindowText(m_hPopupWnd, tmp);
16741678 }
16751679
16761680 STDMETHODIMP COverlappedWindow::SetPlacement(VARIANT x, VARIANT y, VARIANT w, VARIANT h, VARIANT *pvarUnk)
@@ -1929,8 +1933,8 @@ void COverlappedWindow::CreateWindowList(list<HWND>& lstWnd,BOOL bSearchRoot)
19291933 HWND* hWnds = NULL;
19301934 if(m_hParentWnd && bSearchRoot){
19311935 // 根元でなければ、さらに問い合わせる
1932- COverlappedWindow* pParent = (COverlappedWindow*)::GetWindowLong(m_hParentWnd,GWL_USERDATA);
1933- if(pParent){
1936+ COverlappedWindow* pParent = (COverlappedWindow*)::GetWindowLongPtr(m_hParentWnd, GWLP_USERDATA);
1937+ if (pParent) {
19341938 pParent->CreateWindowList(lstWnd,true);
19351939 }
19361940 }
@@ -2024,20 +2028,22 @@ STDMETHODIMP COverlappedWindow::put_WaitCursor(short newVal)
20242028
20252029 STDMETHODIMP COverlappedWindow::LoadIcon(VARIANT text)
20262030 {
2027- CHAR szPath[MAX_PATH];
20282031 CComVariant varText;
2029- if(varText.ChangeType(VT_BSTR,&text) != S_OK){
2032+ if (varText.ChangeType(VT_BSTR, &text) != S_OK) {
20302033 return DISP_E_TYPEMISMATCH;
20312034 }
2032- WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,szPath,MAX_PATH,NULL,NULL);
2033- if(m_hIcon){
2035+ ATL::CString szPath(varText.bstrVal);
2036+
2037+ if (m_hIcon) {
20342038 DestroyIcon(m_hIcon);
20352039 m_hIcon = NULL;
20362040 }
2037- m_hIcon = (HICON)LoadImage(NULL,szPath,IMAGE_ICON
2038- ,GetSystemMetrics(SM_CXSMICON)
2039- ,GetSystemMetrics(SM_CYSMICON),LR_LOADFROMFILE);
2040- if(m_hIcon && m_hPopupWnd){
2041+ m_hIcon = (HICON)LoadImage(NULL, szPath, IMAGE_ICON,
2042+ GetSystemMetrics(SM_CXSMICON),
2043+ GetSystemMetrics(SM_CYSMICON),
2044+ LR_LOADFROMFILE);
2045+
2046+ if (m_hIcon && m_hPopupWnd) {
20412047 ::SendMessage(m_hPopupWnd, WM_SETICON, false, (LPARAM)m_hIcon);
20422048 }
20432049 return S_OK;
--- a/OverlappedWindow.h
+++ b/OverlappedWindow.h
@@ -35,9 +35,9 @@ public:
3535 }
3636 void Clear()
3737 {
38- list<LPSTR>::iterator p = m_lstPath.begin();
38+ list<LPTSTR>::iterator p = m_lstPath.begin();
3939 while(p != m_lstPath.end()){
40- delete (*p);
40+ delete[] *p;
4141 p = m_lstPath.erase(p);
4242 }
4343 }
@@ -48,7 +48,7 @@ public:
4848 int i;
4949 for(i=0;i<count;i++){
5050 DWORD sz = ::DragQueryFile(hDrop,i,NULL,0);
51- LPSTR pBuf = new CHAR[sz+1];
51+ LPTSTR pBuf = new TCHAR[sz+1];
5252 ::DragQueryFile(hDrop,i,pBuf,MAX_PATH);
5353 m_lstPath.push_back(pBuf);
5454 }
@@ -64,13 +64,10 @@ public:
6464 VARIANT* pvars;
6565 if(SafeArrayAccessData(pArray,(void**)&pvars) == S_OK){
6666 int i = 0;
67- list<LPSTR>::iterator p = m_lstPath.begin();
67+ list<LPTSTR>::iterator p = m_lstPath.begin();
6868 while(p != m_lstPath.end()){
69- WCHAR wbuf[MAX_PATH];
70- MultiByteToWideChar(GetACP(),0,*p,-1,wbuf,MAX_PATH);
71- VariantInit(&pvars[i]);
72- pvars[i].vt = VT_BSTR;
73- pvars[i].bstrVal = SysAllocString(wbuf);
69+ CComVariant wbuf(*p);
70+ wbuf.Detach(&pvars[i]);
7471 p++;
7572 i++;
7673 }
@@ -81,7 +78,7 @@ public:
8178 pvarPathName->parray = pArray;
8279 }
8380 protected:
84- list<LPSTR> m_lstPath;
81+ list<LPTSTR> m_lstPath;
8582 };
8683
8784 /////////////////////////////////////////////////////////////////////////////
@@ -122,11 +119,11 @@ public:
122119 width = w;
123120 height = h;
124121 }
125- inline void SetWindowClassName(LPCSTR name)
122+ inline void SetWindowClassName(LPCTSTR name)
126123 {
127124 lstrcpy(szClassName,name);
128125 }
129- CHAR szClassName[MAX_PATH];
126+ TCHAR szClassName[MAX_PATH];
130127 DWORD wndstyle;
131128 DWORD style;
132129 DWORD exstyle;
@@ -390,7 +387,7 @@ protected:
390387 HWND m_hPopupWnd;
391388 HWND m_hParentWnd;
392389 HICON m_hIcon;
393- map<int,_bstr_t> m_cMenuMap;
390+ map<int, CComBSTR> m_cMenuMap;
394391 };
395392
396393 #endif //__OverlappedWindow_H_
--- a/PrivateProfile.cpp
+++ b/PrivateProfile.cpp
@@ -24,8 +24,7 @@ STDMETHODIMP CPrivateProfile::InterfaceSupportsErrorInfo(REFIID riid)
2424
2525 STDMETHODIMP CPrivateProfile::get_ProfilePath(BSTR *pVal)
2626 {
27- *pVal = m_bstr_profilepath.copy();
28- return S_OK;
27+ return m_bstr_profilepath.CopyTo(pVal);
2928 }
3029
3130 STDMETHODIMP CPrivateProfile::put_ProfilePath(BSTR newVal)
@@ -41,15 +40,17 @@ STDMETHODIMP CPrivateProfile::OpenSection(VARIANT text,VARIANT* pVal)
4140 if(varText.ChangeType(VT_BSTR,&text) != S_OK){
4241 return DISP_E_TYPEMISMATCH;
4342 }
44- if(m_bstr_profilepath.length() <= 0){
43+ if (m_bstr_profilepath.Length() <= 0) {
4544 ErrorInfo(IDS_ERR_PROFILEPATH);
4645 return DISP_E_EXCEPTION;
4746 }
4847 CComObject<CProfileSection>* pSection = NULL;
4948 pSection->CreateInstance(&pSection);
5049 ATLASSERT(pSection);
51- WideCharToMultiByte(GetACP(),0,m_bstr_profilepath,-1,pSection->m_szProfilePath,MAX_PATH,NULL,NULL);
52- WideCharToMultiByte(GetACP(),0,varText.bstrVal ,-1,pSection->m_szSectionName,MAX_PATH,NULL,NULL);
50+
51+ pSection->m_szProfilePath = m_bstr_profilepath;
52+ pSection->m_szSectionName = varText.bstrVal;
53+
5354 IUnknown* pUnk = NULL;
5455 pSection->QueryInterface(IID_IUnknown,(void**)&pUnk);
5556 ATLASSERT(pUnk);
--- a/PrivateProfile.h
+++ b/PrivateProfile.h
@@ -37,7 +37,7 @@ public:
3737 STDMETHOD(get_ProfilePath)(/*[out, retval]*/ BSTR *pVal);
3838 STDMETHOD(put_ProfilePath)(/*[in]*/ BSTR newVal);
3939 protected:
40- _bstr_t m_bstr_profilepath;
40+ CComBSTR m_bstr_profilepath;
4141 };
4242
4343 #endif //__PRIVATEPROFILE_H_
--- a/ProfileSection.cpp
+++ b/ProfileSection.cpp
@@ -23,37 +23,40 @@ STDMETHODIMP CProfileSection::InterfaceSupportsErrorInfo(REFIID riid)
2323 STDMETHODIMP CProfileSection::get_Value(VARIANT idx, VARIANT *pVal)
2424 {
2525 ::VariantInit(pVal);
26+
27+ ATL::CString szKeyname;
2628 CComVariant varIdx;
27- CHAR szKeyname[MAX_PATH] = { 0 };
28- const int siz = 1024 * 8; // 8KBytes
29- LPSTR szReturn = new CHAR[siz];
30- if(varIdx.ChangeType(VT_BSTR,&idx) == S_OK){
31- WideCharToMultiByte(GetACP(),0,varIdx.bstrVal,-1,szKeyname,MAX_PATH,NULL,NULL);
29+ if (varIdx.ChangeType(VT_BSTR, &idx) == S_OK){
30+ szKeyname = varIdx.bstrVal;
3231 }
33- if(GetPrivateProfileString(m_szSectionName,szKeyname,"",szReturn,siz,m_szProfilePath)){
34- CComVariant ret((LPCSTR)szReturn);
32+
33+ const int siz = 1024 * 8; // 8KBytes
34+ ATL::CString buf;
35+ LPTSTR szReturn = buf.GetBufferSetLength(siz);
36+ if (GetPrivateProfileString(m_szSectionName, szKeyname, _TEXT(""), szReturn, siz, m_szProfilePath)) {
37+ CComVariant ret(szReturn);
3538 ret.Detach(pVal);
3639 }
37- delete[]szReturn;
3840 return S_OK;
3941 }
4042
4143 STDMETHODIMP CProfileSection::put_Value(VARIANT idx, VARIANT newVal)
4244 {
4345 // ディフォルトの値つき取得
44- CComVariant varIdx,varNew;
45- CHAR szKeyname[MAX_PATH] = { 0 };
46- const int siz = 1024 * 8; // 8KBytes
47- LPSTR szWrite = new CHAR[siz+1];
48- if(varIdx.ChangeType(VT_BSTR,&idx) == S_OK){
49- WideCharToMultiByte(GetACP(),0,varIdx.bstrVal,-1,szKeyname,MAX_PATH,NULL,NULL);
46+
47+ ATL::CString szKeyname;
48+ CComVariant varIdx;
49+ if (varIdx.ChangeType(VT_BSTR, &idx) == S_OK) {
50+ szKeyname = varIdx.bstrVal;
5051 }
51- if(varNew.ChangeType(VT_BSTR,&newVal) == S_OK){
52- int cnt = WideCharToMultiByte(GetACP(),0,varNew.bstrVal,-1,szWrite,siz,NULL,NULL);
53- szWrite[cnt] = 0;
52+
53+ ATL::CString szWrite;
54+ CComVariant varNew;
55+ if (varNew.ChangeType(VT_BSTR, &newVal) == S_OK){
56+ szWrite = varNew.bstrVal;
5457 }
55- WritePrivateProfileString(m_szSectionName,szKeyname,szWrite,m_szProfilePath);
56- delete[]szWrite;
58+
59+ WritePrivateProfileString(m_szSectionName, szKeyname, szWrite, m_szProfilePath);
5760 return S_OK;
5861 }
5962
@@ -61,22 +64,26 @@ STDMETHODIMP CProfileSection::GetValue(VARIANT idx, VARIANT def,VARIANT* pVal)
6164 {
6265 // ディフォルトの値つき取得
6366 ::VariantInit(pVal);
64- CComVariant varIdx,varDef;
65- CHAR szKeyname[MAX_PATH] = { 0 };
66- CHAR szDefault[MAX_PATH] = { 0 };
67- const int siz = 1024 * 8; // 8KBytes
68- LPSTR szReturn = new CHAR[siz];
69- if(varIdx.ChangeType(VT_BSTR,&idx) == S_OK){
70- WideCharToMultiByte(GetACP(),0,varIdx.bstrVal,-1,szKeyname,MAX_PATH,NULL,NULL);
67+
68+ ATL::CString szKeyname;
69+ CComVariant varIdx;
70+ if (varIdx.ChangeType(VT_BSTR, &idx) == S_OK) {
71+ szKeyname = varIdx.bstrVal;
7172 }
72- if(varDef.ChangeType(VT_BSTR,&def) == S_OK){
73- WideCharToMultiByte(GetACP(),0,varDef.bstrVal,-1,szDefault,MAX_PATH,NULL,NULL);
73+
74+ ATL::CString szDefault;
75+ CComVariant varDef;
76+ if (varDef.ChangeType(VT_BSTR, &def) == S_OK) {
77+ szDefault = varDef.bstrVal;
7478 }
75- if(GetPrivateProfileString(m_szSectionName,szKeyname,szDefault,szReturn,siz,m_szProfilePath)){
76- CComVariant ret((LPCSTR)szReturn);
79+
80+ const int siz = 1024 * 8; // 8KBytes
81+ ATL::CString buf;
82+ LPTSTR szReturn = buf.GetBufferSetLength(siz);
83+ if (GetPrivateProfileString(m_szSectionName, szKeyname, szDefault, szReturn, siz, m_szProfilePath)) {
84+ CComVariant ret(szReturn);
7785 ret.Detach(pVal);
7886 }
79- delete[]szReturn;
8087 return S_OK;
8188 }
8289
@@ -86,30 +93,30 @@ STDMETHODIMP CProfileSection::GetKeyNames(VARIANT *pVal)
8693 DWORD siz = 4096;
8794 DWORD oldsiz = 0;
8895 DWORD retsiz = 0;
89- LPSTR pBuf = new CHAR[siz];
90- while( (retsiz = GetPrivateProfileSection(m_szSectionName,pBuf,siz,m_szProfilePath)) &&
91- (retsiz == (siz - 2)) && ( oldsiz != retsiz ) ){
96+ LPTSTR pBuf = new TCHAR[siz];
97+ while ((retsiz = GetPrivateProfileSection(m_szSectionName, pBuf, siz, m_szProfilePath)) &&
98+ (retsiz == (siz - 2)) && (oldsiz != retsiz)) {
9299 oldsiz = siz;
93100 siz *= 2;
94101 delete []pBuf;
95- pBuf = new CHAR[siz];
102+ pBuf = new TCHAR[siz];
96103 }
97104 // カウントする
98- LPSTR p = pBuf;
105+ LPTSTR p = pBuf;
99106 long count = 0;
100- while(*p){
107+ while (*p) {
101108 count++;
102- while(*p++);
109+ while (*p++);
103110 }
104111 // 一次配列の生成
105- SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT,0,count);
112+ SAFEARRAY* pArray = SafeArrayCreateVector(VT_VARIANT, 0, count);
106113 long idx = 0;
107114 p = pBuf;
108- while(*p){
115+ while (*p) {
109116 CComVariant tmp;
110- LPCSTR pb = p;
111- while(*p){
112- if(*p == '='){
117+ LPCTSTR pb = p;
118+ while (*p) {
119+ if (*p == '=') {
113120 *p = 0;
114121 }
115122 p++;
--- a/ProfileSection.h
+++ b/ProfileSection.h
@@ -37,8 +37,8 @@ public:
3737 STDMETHOD(GetValue)(/*[in]*/VARIANT idx,/*[in,optional]*/VARIANT def,/*[out,retval]*/VARIANT* pVal);
3838 STDMETHOD(get_Value)(/*[in]*/VARIANT idx, /*[out, retval]*/ VARIANT *pVal);
3939 STDMETHOD(put_Value)(/*[in]*/VARIANT idx, /*[in]*/ VARIANT newVal);
40- CHAR m_szProfilePath[MAX_PATH];
41- CHAR m_szSectionName[MAX_PATH];
40+ ATL::CString m_szProfilePath;
41+ ATL::CString m_szSectionName;
4242 };
4343
4444 #endif //__PROFILESECTION_H_
--- a/SeraphyScriptTools.cpp
+++ b/SeraphyScriptTools.cpp
@@ -24,6 +24,9 @@
2424 #include "profilesection.h"
2525 #include "privateprofile.h"
2626
27+// Common Controls用libのロード
28+#pragma comment(lib, "comctl32.lib")
29+
2730 CComModule _Module;
2831
2932 BEGIN_OBJECT_MAP(ObjectMap)
--- a/SeraphyScriptTools.h
+++ b/SeraphyScriptTools.h
@@ -4,7 +4,7 @@
44
55
66 /* File created by MIDL compiler version 8.00.0603 */
7-/* at Sun Jul 19 17:53:12 2015
7+/* at Sat Jul 25 10:10:02 2015
88 */
99 /* Compiler settings for SeraphyScriptTools.idl:
1010 Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603
--- a/SeraphyScriptTools.sln
+++ b/SeraphyScriptTools.sln
@@ -6,26 +6,32 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SeraphyScriptTools", "Serap
66 EndProject
77 Global
88 GlobalSection(SolutionConfigurationPlatforms) = preSolution
9- Debug|Win32 = Debug|Win32
10- Release MinDependency|Win32 = Release MinDependency|Win32
11- Release MinSize|Win32 = Release MinSize|Win32
9+ MBCS Debug|Win32 = MBCS Debug|Win32
10+ MBCS Debug|x64 = MBCS Debug|x64
11+ MBCS Release|Win32 = MBCS Release|Win32
12+ MBCS Release|x64 = MBCS Release|x64
1213 Unicode Debug|Win32 = Unicode Debug|Win32
13- Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32
14- Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32
14+ Unicode Debug|x64 = Unicode Debug|x64
15+ Unicode Release|Win32 = Unicode Release|Win32
16+ Unicode Release|x64 = Unicode Release|x64
1517 EndGlobalSection
1618 GlobalSection(ProjectConfigurationPlatforms) = postSolution
17- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Debug|Win32.ActiveCfg = Debug|Win32
18- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Debug|Win32.Build.0 = Debug|Win32
19- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32
20- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32
21- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32
22- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Release MinSize|Win32.Build.0 = Release MinSize|Win32
23- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
24- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
25- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32
26- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32
27- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32
28- {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32
19+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|Win32.ActiveCfg = MBCS Debug|Win32
20+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|Win32.Build.0 = MBCS Debug|Win32
21+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|x64.ActiveCfg = MBCS Debug|x64
22+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Debug|x64.Build.0 = MBCS Debug|x64
23+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|Win32.ActiveCfg = MBCS Release|Win32
24+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|Win32.Build.0 = MBCS Release|Win32
25+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|x64.ActiveCfg = MBCS Release|x64
26+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.MBCS Release|x64.Build.0 = MBCS Release|x64
27+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|Win32.ActiveCfg = Unicode Release|Win32
28+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|Win32.Build.0 = Unicode Release|Win32
29+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|x64.ActiveCfg = Unicode Debug|x64
30+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Debug|x64.Build.0 = Unicode Debug|x64
31+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
32+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
33+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|x64.ActiveCfg = Unicode Release|x64
34+ {06035D5C-5F95-47F2-88B4-D614B0E06D2F}.Unicode Release|x64.Build.0 = Unicode Release|x64
2935 EndGlobalSection
3036 GlobalSection(SolutionProperties) = preSolution
3137 HideSolutionNode = FALSE
--- a/SeraphyScriptTools.vcproj
+++ /dev/null
@@ -1,704 +0,0 @@
1-<?xml version="1.0" encoding = "shift_jis"?>
2-<VisualStudioProject
3- ProjectType="Visual C++"
4- Version="7.00"
5- Name="SeraphyScriptTools"
6- SccProjectName=""
7- SccLocalPath=""
8- Keyword="AtlProj">
9- <Platforms>
10- <Platform
11- Name="Win32"/>
12- </Platforms>
13- <Configurations>
14- <Configuration
15- Name="Release MinDependency|Win32"
16- OutputDirectory=".\ReleaseMinDependency"
17- IntermediateDirectory=".\ReleaseMinDependency"
18- ConfigurationType="2"
19- UseOfMFC="0"
20- UseOfATL="1"
21- ATLMinimizesCRunTimeLibraryUsage="FALSE"
22- CharacterSet="2">
23- <Tool
24- Name="VCCLCompilerTool"
25- Optimization="1"
26- InlineFunctionExpansion="1"
27- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
28- StringPooling="TRUE"
29- RuntimeLibrary="0"
30- EnableFunctionLevelLinking="TRUE"
31- UsePrecompiledHeader="3"
32- PrecompiledHeaderThrough="stdafx.h"
33- PrecompiledHeaderFile=".\ReleaseMinDependency/SeraphyScriptTools.pch"
34- AssemblerListingLocation=".\ReleaseMinDependency/"
35- ObjectFile=".\ReleaseMinDependency/"
36- ProgramDataBaseFileName=".\ReleaseMinDependency/"
37- WarningLevel="3"
38- SuppressStartupBanner="TRUE"/>
39- <Tool
40- Name="VCCustomBuildTool"
41- Description="登録を行っています"
42- CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;
43-echo regsvr32 exec. time &gt; &quot;$(OutDir)\regsvr32.trg&quot;
44-"
45- Outputs="$(OutDir)\regsvr32.trg"/>
46- <Tool
47- Name="VCLinkerTool"
48- AdditionalOptions="/MACHINE:I386"
49- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib version.lib"
50- OutputFile=".\ReleaseMinDependency/SeraphyScriptTools.dll"
51- LinkIncremental="1"
52- SuppressStartupBanner="TRUE"
53- ModuleDefinitionFile=".\SeraphyScriptTools.def"
54- ProgramDatabaseFile=".\ReleaseMinDependency/SeraphyScriptTools.pdb"
55- SubSystem="2"
56- ImportLibrary=".\ReleaseMinDependency/SeraphyScriptTools.lib"/>
57- <Tool
58- Name="VCMIDLTool"
59- TypeLibraryName=".\ReleaseMinDependency/SeraphyScriptTools.tlb"/>
60- <Tool
61- Name="VCPostBuildEventTool"/>
62- <Tool
63- Name="VCPreBuildEventTool"/>
64- <Tool
65- Name="VCPreLinkEventTool"/>
66- <Tool
67- Name="VCResourceCompilerTool"
68- PreprocessorDefinitions="NDEBUG"
69- Culture="1041"/>
70- <Tool
71- Name="VCWebServiceProxyGeneratorTool"/>
72- <Tool
73- Name="VCWebDeploymentTool"/>
74- </Configuration>
75- <Configuration
76- Name="Unicode Release MinDependency|Win32"
77- OutputDirectory=".\ReleaseUMinDependency"
78- IntermediateDirectory=".\ReleaseUMinDependency"
79- ConfigurationType="2"
80- UseOfMFC="0"
81- UseOfATL="1"
82- ATLMinimizesCRunTimeLibraryUsage="TRUE"
83- CharacterSet="1">
84- <Tool
85- Name="VCCLCompilerTool"
86- InlineFunctionExpansion="1"
87- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
88- StringPooling="TRUE"
89- RuntimeLibrary="0"
90- EnableFunctionLevelLinking="TRUE"
91- UsePrecompiledHeader="3"
92- PrecompiledHeaderThrough="stdafx.h"
93- PrecompiledHeaderFile=".\ReleaseUMinDependency/SeraphyScriptTools.pch"
94- AssemblerListingLocation=".\ReleaseUMinDependency/"
95- ObjectFile=".\ReleaseUMinDependency/"
96- ProgramDataBaseFileName=".\ReleaseUMinDependency/"
97- WarningLevel="3"
98- SuppressStartupBanner="TRUE"/>
99- <Tool
100- Name="VCCustomBuildTool"
101- Description="登録を行っています"
102- CommandLine="if &quot;%OS%&quot;==&quot;&quot; goto NOTNT
103-if not &quot;%OS%&quot;==&quot;Windows_NT&quot; goto NOTNT
104-regsvr32 /s /c &quot;$(TargetPath)&quot;
105-echo regsvr32 exec. time &gt; &quot;$(OutDir)\regsvr32.trg&quot;
106-goto end
107-:NOTNT
108-echo 警告 : Windows 95 に Unicode DLL を登録することはできません
109-:end
110-"
111- Outputs="$(OutDir)\regsvr32.trg"/>
112- <Tool
113- Name="VCLinkerTool"
114- AdditionalOptions="/MACHINE:I386"
115- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib"
116- OutputFile=".\ReleaseUMinDependency/SeraphyScriptTools.dll"
117- LinkIncremental="1"
118- SuppressStartupBanner="TRUE"
119- ModuleDefinitionFile=".\SeraphyScriptTools.def"
120- ProgramDatabaseFile=".\ReleaseUMinDependency/SeraphyScriptTools.pdb"
121- SubSystem="2"
122- ImportLibrary=".\ReleaseUMinDependency/SeraphyScriptTools.lib"/>
123- <Tool
124- Name="VCMIDLTool"
125- TypeLibraryName=".\ReleaseUMinDependency/SeraphyScriptTools.tlb"/>
126- <Tool
127- Name="VCPostBuildEventTool"/>
128- <Tool
129- Name="VCPreBuildEventTool"/>
130- <Tool
131- Name="VCPreLinkEventTool"/>
132- <Tool
133- Name="VCResourceCompilerTool"
134- PreprocessorDefinitions="NDEBUG"
135- Culture="1041"/>
136- <Tool
137- Name="VCWebServiceProxyGeneratorTool"/>
138- <Tool
139- Name="VCWebDeploymentTool"/>
140- </Configuration>
141- <Configuration
142- Name="Debug|Win32"
143- OutputDirectory=".\Debug"
144- IntermediateDirectory=".\Debug"
145- ConfigurationType="2"
146- UseOfMFC="0"
147- ATLMinimizesCRunTimeLibraryUsage="FALSE"
148- CharacterSet="2">
149- <Tool
150- Name="VCCLCompilerTool"
151- Optimization="0"
152- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
153- BasicRuntimeChecks="3"
154- RuntimeLibrary="1"
155- UsePrecompiledHeader="3"
156- PrecompiledHeaderThrough="stdafx.h"
157- PrecompiledHeaderFile=".\Debug/SeraphyScriptTools.pch"
158- AssemblerListingLocation=".\Debug/"
159- ObjectFile=".\Debug/"
160- ProgramDataBaseFileName=".\Debug/"
161- WarningLevel="3"
162- SuppressStartupBanner="TRUE"
163- DebugInformationFormat="4"/>
164- <Tool
165- Name="VCCustomBuildTool"
166- Description="登録を行っています"
167- CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;
168-echo regsvr32 exec. time &gt; &quot;$(OutDir)\regsvr32.trg&quot;
169-"
170- Outputs="$(OutDir)\regsvr32.trg"/>
171- <Tool
172- Name="VCLinkerTool"
173- AdditionalOptions="/MACHINE:I386"
174- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib version.lib"
175- OutputFile=".\Debug/SeraphyScriptTools.dll"
176- LinkIncremental="2"
177- SuppressStartupBanner="TRUE"
178- ModuleDefinitionFile=".\SeraphyScriptTools.def"
179- GenerateDebugInformation="TRUE"
180- ProgramDatabaseFile=".\Debug/SeraphyScriptTools.pdb"
181- SubSystem="2"
182- ImportLibrary=".\Debug/SeraphyScriptTools.lib"/>
183- <Tool
184- Name="VCMIDLTool"
185- TypeLibraryName=".\Debug/SeraphyScriptTools.tlb"/>
186- <Tool
187- Name="VCPostBuildEventTool"/>
188- <Tool
189- Name="VCPreBuildEventTool"/>
190- <Tool
191- Name="VCPreLinkEventTool"/>
192- <Tool
193- Name="VCResourceCompilerTool"
194- PreprocessorDefinitions="_DEBUG"
195- Culture="1041"/>
196- <Tool
197- Name="VCWebServiceProxyGeneratorTool"/>
198- <Tool
199- Name="VCWebDeploymentTool"/>
200- </Configuration>
201- <Configuration
202- Name="Unicode Release MinSize|Win32"
203- OutputDirectory=".\ReleaseUMinSize"
204- IntermediateDirectory=".\ReleaseUMinSize"
205- ConfigurationType="2"
206- UseOfMFC="0"
207- UseOfATL="2"
208- ATLMinimizesCRunTimeLibraryUsage="TRUE"
209- CharacterSet="1">
210- <Tool
211- Name="VCCLCompilerTool"
212- InlineFunctionExpansion="1"
213- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
214- StringPooling="TRUE"
215- RuntimeLibrary="0"
216- EnableFunctionLevelLinking="TRUE"
217- UsePrecompiledHeader="3"
218- PrecompiledHeaderThrough="stdafx.h"
219- PrecompiledHeaderFile=".\ReleaseUMinSize/SeraphyScriptTools.pch"
220- AssemblerListingLocation=".\ReleaseUMinSize/"
221- ObjectFile=".\ReleaseUMinSize/"
222- ProgramDataBaseFileName=".\ReleaseUMinSize/"
223- WarningLevel="3"
224- SuppressStartupBanner="TRUE"/>
225- <Tool
226- Name="VCCustomBuildTool"
227- Description="登録を行っています"
228- CommandLine="if &quot;%OS%&quot;==&quot;&quot; goto NOTNT
229-if not &quot;%OS%&quot;==&quot;Windows_NT&quot; goto NOTNT
230-regsvr32 /s /c &quot;$(TargetPath)&quot;
231-echo regsvr32 exec. time &gt; &quot;$(OutDir)\regsvr32.trg&quot;
232-goto end
233-:NOTNT
234-echo 警告 : Windows 95 に Unicode DLL を登録することはできません
235-:end
236-"
237- Outputs="$(OutDir)\regsvr32.trg"/>
238- <Tool
239- Name="VCLinkerTool"
240- AdditionalOptions="/MACHINE:I386"
241- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib"
242- OutputFile=".\ReleaseUMinSize/SeraphyScriptTools.dll"
243- LinkIncremental="1"
244- SuppressStartupBanner="TRUE"
245- ModuleDefinitionFile=".\SeraphyScriptTools.def"
246- ProgramDatabaseFile=".\ReleaseUMinSize/SeraphyScriptTools.pdb"
247- SubSystem="2"
248- ImportLibrary=".\ReleaseUMinSize/SeraphyScriptTools.lib"/>
249- <Tool
250- Name="VCMIDLTool"
251- TypeLibraryName=".\ReleaseUMinSize/SeraphyScriptTools.tlb"/>
252- <Tool
253- Name="VCPostBuildEventTool"/>
254- <Tool
255- Name="VCPreBuildEventTool"/>
256- <Tool
257- Name="VCPreLinkEventTool"/>
258- <Tool
259- Name="VCResourceCompilerTool"
260- PreprocessorDefinitions="NDEBUG"
261- Culture="1041"/>
262- <Tool
263- Name="VCWebServiceProxyGeneratorTool"/>
264- <Tool
265- Name="VCWebDeploymentTool"/>
266- </Configuration>
267- <Configuration
268- Name="Release MinSize|Win32"
269- OutputDirectory=".\ReleaseMinSize"
270- IntermediateDirectory=".\ReleaseMinSize"
271- ConfigurationType="2"
272- UseOfMFC="0"
273- UseOfATL="2"
274- ATLMinimizesCRunTimeLibraryUsage="TRUE"
275- CharacterSet="2">
276- <Tool
277- Name="VCCLCompilerTool"
278- InlineFunctionExpansion="1"
279- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
280- StringPooling="TRUE"
281- RuntimeLibrary="0"
282- EnableFunctionLevelLinking="TRUE"
283- UsePrecompiledHeader="3"
284- PrecompiledHeaderThrough="stdafx.h"
285- PrecompiledHeaderFile=".\ReleaseMinSize/SeraphyScriptTools.pch"
286- AssemblerListingLocation=".\ReleaseMinSize/"
287- ObjectFile=".\ReleaseMinSize/"
288- ProgramDataBaseFileName=".\ReleaseMinSize/"
289- WarningLevel="3"
290- SuppressStartupBanner="TRUE"/>
291- <Tool
292- Name="VCCustomBuildTool"
293- Description="登録を行っています"
294- CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;
295-echo regsvr32 exec. time &gt; &quot;$(OutDir)\regsvr32.trg&quot;
296-"
297- Outputs="$(OutDir)\regsvr32.trg"/>
298- <Tool
299- Name="VCLinkerTool"
300- AdditionalOptions="/MACHINE:I386"
301- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib"
302- OutputFile=".\ReleaseMinSize/SeraphyScriptTools.dll"
303- LinkIncremental="1"
304- SuppressStartupBanner="TRUE"
305- ModuleDefinitionFile=".\SeraphyScriptTools.def"
306- ProgramDatabaseFile=".\ReleaseMinSize/SeraphyScriptTools.pdb"
307- SubSystem="2"
308- ImportLibrary=".\ReleaseMinSize/SeraphyScriptTools.lib"/>
309- <Tool
310- Name="VCMIDLTool"
311- TypeLibraryName=".\ReleaseMinSize/SeraphyScriptTools.tlb"/>
312- <Tool
313- Name="VCPostBuildEventTool"/>
314- <Tool
315- Name="VCPreBuildEventTool"/>
316- <Tool
317- Name="VCPreLinkEventTool"/>
318- <Tool
319- Name="VCResourceCompilerTool"
320- PreprocessorDefinitions="NDEBUG"
321- Culture="1041"/>
322- <Tool
323- Name="VCWebServiceProxyGeneratorTool"/>
324- <Tool
325- Name="VCWebDeploymentTool"/>
326- </Configuration>
327- <Configuration
328- Name="Unicode Debug|Win32"
329- OutputDirectory=".\DebugU"
330- IntermediateDirectory=".\DebugU"
331- ConfigurationType="2"
332- UseOfMFC="0"
333- ATLMinimizesCRunTimeLibraryUsage="FALSE"
334- CharacterSet="1">
335- <Tool
336- Name="VCCLCompilerTool"
337- Optimization="0"
338- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
339- BasicRuntimeChecks="3"
340- RuntimeLibrary="1"
341- UsePrecompiledHeader="3"
342- PrecompiledHeaderThrough="stdafx.h"
343- PrecompiledHeaderFile=".\DebugU/SeraphyScriptTools.pch"
344- AssemblerListingLocation=".\DebugU/"
345- ObjectFile=".\DebugU/"
346- ProgramDataBaseFileName=".\DebugU/"
347- WarningLevel="3"
348- SuppressStartupBanner="TRUE"
349- DebugInformationFormat="4"/>
350- <Tool
351- Name="VCCustomBuildTool"
352- Description="登録を行っています"
353- CommandLine="if &quot;%OS%&quot;==&quot;&quot; goto NOTNT
354-if not &quot;%OS%&quot;==&quot;Windows_NT&quot; goto NOTNT
355-regsvr32 /s /c &quot;$(TargetPath)&quot;
356-echo regsvr32 exec. time &gt; &quot;$(OutDir)\regsvr32.trg&quot;
357-goto end
358-:NOTNT
359-echo 警告 : Windows 95 に Unicode DLL を登録することはできません
360-:end
361-"
362- Outputs="$(OutDir)\regsvr32.trg"/>
363- <Tool
364- Name="VCLinkerTool"
365- AdditionalOptions="/MACHINE:I386"
366- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib"
367- OutputFile=".\DebugU/SeraphyScriptTools.dll"
368- LinkIncremental="2"
369- SuppressStartupBanner="TRUE"
370- ModuleDefinitionFile=".\SeraphyScriptTools.def"
371- GenerateDebugInformation="TRUE"
372- ProgramDatabaseFile=".\DebugU/SeraphyScriptTools.pdb"
373- SubSystem="2"
374- ImportLibrary=".\DebugU/SeraphyScriptTools.lib"/>
375- <Tool
376- Name="VCMIDLTool"
377- TypeLibraryName=".\DebugU/SeraphyScriptTools.tlb"/>
378- <Tool
379- Name="VCPostBuildEventTool"/>
380- <Tool
381- Name="VCPreBuildEventTool"/>
382- <Tool
383- Name="VCPreLinkEventTool"/>
384- <Tool
385- Name="VCResourceCompilerTool"
386- PreprocessorDefinitions="_DEBUG"
387- Culture="1041"/>
388- <Tool
389- Name="VCWebServiceProxyGeneratorTool"/>
390- <Tool
391- Name="VCWebDeploymentTool"/>
392- </Configuration>
393- </Configurations>
394- <Files>
395- <Filter
396- Name="Source Files"
397- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
398- <File
399- RelativePath=".\CommDialog.cpp">
400- </File>
401- <File
402- RelativePath=".\Control.cpp">
403- </File>
404- <File
405- RelativePath=".\Draw.cpp">
406- </File>
407- <File
408- RelativePath=".\Event.cpp">
409- </File>
410- <File
411- RelativePath=".\Form.cpp">
412- </File>
413- <File
414- RelativePath=".\Instance.cpp">
415- </File>
416- <File
417- RelativePath=".\Layer.cpp">
418- </File>
419- <File
420- RelativePath=".\ObjectMap.cpp">
421- </File>
422- <File
423- RelativePath=".\ObjectVector.cpp">
424- </File>
425- <File
426- RelativePath=".\OverlappedWindow.cpp">
427- </File>
428- <File
429- RelativePath=".\PrivateProfile.cpp">
430- </File>
431- <File
432- RelativePath=".\ProfileSection.cpp">
433- </File>
434- <File
435- RelativePath=".\SeraphyScriptTools.cpp">
436- </File>
437- <File
438- RelativePath=".\SeraphyScriptTools.def">
439- </File>
440- <File
441- RelativePath=".\SeraphyScriptTools.idl">
442- <FileConfiguration
443- Name="Release MinDependency|Win32">
444- <Tool
445- Name="VCMIDLTool"
446- GenerateStublessProxies="TRUE"
447- TypeLibraryName=".\SeraphyScriptTools.tlb"
448- HeaderFileName="SeraphyScriptTools.h"
449- InterfaceIdentifierFileName="SeraphyScriptTools_i.c"/>
450- </FileConfiguration>
451- <FileConfiguration
452- Name="Unicode Release MinDependency|Win32">
453- <Tool
454- Name="VCMIDLTool"
455- GenerateStublessProxies="TRUE"
456- TypeLibraryName=".\SeraphyScriptTools.tlb"
457- HeaderFileName="SeraphyScriptTools.h"
458- InterfaceIdentifierFileName="SeraphyScriptTools_i.c"/>
459- </FileConfiguration>
460- <FileConfiguration
461- Name="Debug|Win32">
462- <Tool
463- Name="VCMIDLTool"
464- GenerateStublessProxies="TRUE"
465- TypeLibraryName=".\SeraphyScriptTools.tlb"
466- HeaderFileName="SeraphyScriptTools.h"
467- InterfaceIdentifierFileName="SeraphyScriptTools_i.c"/>
468- </FileConfiguration>
469- <FileConfiguration
470- Name="Unicode Release MinSize|Win32">
471- <Tool
472- Name="VCMIDLTool"
473- GenerateStublessProxies="TRUE"
474- TypeLibraryName=".\SeraphyScriptTools.tlb"
475- HeaderFileName="SeraphyScriptTools.h"
476- InterfaceIdentifierFileName="SeraphyScriptTools_i.c"/>
477- </FileConfiguration>
478- <FileConfiguration
479- Name="Release MinSize|Win32">
480- <Tool
481- Name="VCMIDLTool"
482- GenerateStublessProxies="TRUE"
483- TypeLibraryName=".\SeraphyScriptTools.tlb"
484- HeaderFileName="SeraphyScriptTools.h"
485- InterfaceIdentifierFileName="SeraphyScriptTools_i.c"/>
486- </FileConfiguration>
487- <FileConfiguration
488- Name="Unicode Debug|Win32">
489- <Tool
490- Name="VCMIDLTool"
491- GenerateStublessProxies="TRUE"
492- TypeLibraryName=".\SeraphyScriptTools.tlb"
493- HeaderFileName="SeraphyScriptTools.h"
494- InterfaceIdentifierFileName="SeraphyScriptTools_i.c"/>
495- </FileConfiguration>
496- </File>
497- <File
498- RelativePath=".\SeraphyScriptTools.rc">
499- <FileConfiguration
500- Name="Release MinDependency|Win32">
501- <Tool
502- Name="VCResourceCompilerTool"
503- AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"/>
504- </FileConfiguration>
505- <FileConfiguration
506- Name="Unicode Release MinDependency|Win32">
507- <Tool
508- Name="VCResourceCompilerTool"
509- AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"/>
510- </FileConfiguration>
511- <FileConfiguration
512- Name="Debug|Win32">
513- <Tool
514- Name="VCResourceCompilerTool"
515- AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"/>
516- </FileConfiguration>
517- <FileConfiguration
518- Name="Unicode Release MinSize|Win32">
519- <Tool
520- Name="VCResourceCompilerTool"
521- AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"/>
522- </FileConfiguration>
523- <FileConfiguration
524- Name="Release MinSize|Win32">
525- <Tool
526- Name="VCResourceCompilerTool"
527- AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"/>
528- </FileConfiguration>
529- <FileConfiguration
530- Name="Unicode Debug|Win32">
531- <Tool
532- Name="VCResourceCompilerTool"
533- AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"/>
534- </FileConfiguration>
535- </File>
536- <File
537- RelativePath=".\Shell.cpp">
538- </File>
539- <File
540- RelativePath=".\StdAfx.cpp">
541- <FileConfiguration
542- Name="Release MinDependency|Win32">
543- <Tool
544- Name="VCCLCompilerTool"
545- UsePrecompiledHeader="1"/>
546- </FileConfiguration>
547- <FileConfiguration
548- Name="Unicode Release MinDependency|Win32">
549- <Tool
550- Name="VCCLCompilerTool"
551- UsePrecompiledHeader="1"/>
552- </FileConfiguration>
553- <FileConfiguration
554- Name="Debug|Win32">
555- <Tool
556- Name="VCCLCompilerTool"
557- UsePrecompiledHeader="1"/>
558- </FileConfiguration>
559- <FileConfiguration
560- Name="Unicode Release MinSize|Win32">
561- <Tool
562- Name="VCCLCompilerTool"
563- UsePrecompiledHeader="1"/>
564- </FileConfiguration>
565- <FileConfiguration
566- Name="Release MinSize|Win32">
567- <Tool
568- Name="VCCLCompilerTool"
569- UsePrecompiledHeader="1"/>
570- </FileConfiguration>
571- <FileConfiguration
572- Name="Unicode Debug|Win32">
573- <Tool
574- Name="VCCLCompilerTool"
575- UsePrecompiledHeader="1"/>
576- </FileConfiguration>
577- </File>
578- <File
579- RelativePath=".\TreeItem.cpp">
580- </File>
581- <File
582- RelativePath=".\generic.cpp">
583- </File>
584- </Filter>
585- <Filter
586- Name="Header Files"
587- Filter="h;hpp;hxx;hm;inl">
588- <File
589- RelativePath=".\CommDialog.h">
590- </File>
591- <File
592- RelativePath=".\Control.h">
593- </File>
594- <File
595- RelativePath=".\Draw.h">
596- </File>
597- <File
598- RelativePath=".\Event.h">
599- </File>
600- <File
601- RelativePath=".\Form.h">
602- </File>
603- <File
604- RelativePath=".\Instance.h">
605- </File>
606- <File
607- RelativePath=".\Layer.h">
608- </File>
609- <File
610- RelativePath=".\ObjectMap.h">
611- </File>
612- <File
613- RelativePath=".\ObjectVector.h">
614- </File>
615- <File
616- RelativePath=".\OverlappedWindow.h">
617- </File>
618- <File
619- RelativePath=".\PrivateProfile.h">
620- </File>
621- <File
622- RelativePath=".\ProfileSection.h">
623- </File>
624- <File
625- RelativePath=".\Resource.h">
626- </File>
627- <File
628- RelativePath=".\SeraphyScriptToolsCP.h">
629- </File>
630- <File
631- RelativePath=".\Shell.h">
632- </File>
633- <File
634- RelativePath=".\StdAfx.h">
635- </File>
636- <File
637- RelativePath=".\TreeItem.h">
638- </File>
639- <File
640- RelativePath=".\generic.h">
641- </File>
642- </Filter>
643- <Filter
644- Name="Resource Files"
645- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
646- <File
647- RelativePath=".\CommDialog.rgs">
648- </File>
649- <File
650- RelativePath=".\Control.rgs">
651- </File>
652- <File
653- RelativePath=".\Draw.rgs">
654- </File>
655- <File
656- RelativePath=".\EnumSelect.rgs">
657- </File>
658- <File
659- RelativePath=".\Event.rgs">
660- </File>
661- <File
662- RelativePath=".\Form.rgs">
663- </File>
664- <File
665- RelativePath=".\Instance.rgs">
666- </File>
667- <File
668- RelativePath=".\Layer.rgs">
669- </File>
670- <File
671- RelativePath=".\ObjectMap.rgs">
672- </File>
673- <File
674- RelativePath=".\ObjectVector.rgs">
675- </File>
676- <File
677- RelativePath=".\OverlappedWindow.rgs">
678- </File>
679- <File
680- RelativePath=".\ParseName.rgs">
681- </File>
682- <File
683- RelativePath=".\PrivateProfile.rgs">
684- </File>
685- <File
686- RelativePath=".\ProfileSection.rgs">
687- </File>
688- <File
689- RelativePath=".\Shell.rgs">
690- </File>
691- <File
692- RelativePath=".\ShellExecObj.rgs">
693- </File>
694- <File
695- RelativePath=".\TreeItem.rgs">
696- </File>
697- </Filter>
698- <File
699- RelativePath=".\old.txt">
700- </File>
701- </Files>
702- <Globals>
703- </Globals>
704-</VisualStudioProject>
--- a/SeraphyScriptTools.vcxproj
+++ b/SeraphyScriptTools.vcxproj
@@ -1,30 +1,38 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33 <ItemGroup Label="ProjectConfigurations">
4- <ProjectConfiguration Include="Debug|Win32">
5- <Configuration>Debug</Configuration>
4+ <ProjectConfiguration Include="MBCS Debug|Win32">
5+ <Configuration>MBCS Debug</Configuration>
66 <Platform>Win32</Platform>
77 </ProjectConfiguration>
8- <ProjectConfiguration Include="Release MinDependency|Win32">
9- <Configuration>Release MinDependency</Configuration>
10- <Platform>Win32</Platform>
8+ <ProjectConfiguration Include="MBCS Debug|x64">
9+ <Configuration>MBCS Debug</Configuration>
10+ <Platform>x64</Platform>
1111 </ProjectConfiguration>
12- <ProjectConfiguration Include="Release MinSize|Win32">
13- <Configuration>Release MinSize</Configuration>
12+ <ProjectConfiguration Include="MBCS Release|Win32">
13+ <Configuration>MBCS Release</Configuration>
1414 <Platform>Win32</Platform>
1515 </ProjectConfiguration>
16+ <ProjectConfiguration Include="MBCS Release|x64">
17+ <Configuration>MBCS Release</Configuration>
18+ <Platform>x64</Platform>
19+ </ProjectConfiguration>
1620 <ProjectConfiguration Include="Unicode Debug|Win32">
1721 <Configuration>Unicode Debug</Configuration>
1822 <Platform>Win32</Platform>
1923 </ProjectConfiguration>
20- <ProjectConfiguration Include="Unicode Release MinDependency|Win32">
21- <Configuration>Unicode Release MinDependency</Configuration>
22- <Platform>Win32</Platform>
24+ <ProjectConfiguration Include="Unicode Debug|x64">
25+ <Configuration>Unicode Debug</Configuration>
26+ <Platform>x64</Platform>
2327 </ProjectConfiguration>
24- <ProjectConfiguration Include="Unicode Release MinSize|Win32">
25- <Configuration>Unicode Release MinSize</Configuration>
28+ <ProjectConfiguration Include="Unicode Release|Win32">
29+ <Configuration>Unicode Release</Configuration>
2630 <Platform>Win32</Platform>
2731 </ProjectConfiguration>
32+ <ProjectConfiguration Include="Unicode Release|x64">
33+ <Configuration>Unicode Release</Configuration>
34+ <Platform>x64</Platform>
35+ </ProjectConfiguration>
2836 </ItemGroup>
2937 <PropertyGroup Label="Globals">
3038 <SccProjectName />
@@ -35,43 +43,51 @@
3543 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
3644 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="Configuration">
3745 <ConfigurationType>DynamicLibrary</ConfigurationType>
38- <PlatformToolset>v120</PlatformToolset>
3946 <UseOfMfc>false</UseOfMfc>
4047 <CharacterSet>Unicode</CharacterSet>
48+ <PlatformToolset>v120</PlatformToolset>
4149 </PropertyGroup>
42- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'" Label="Configuration">
50+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'" Label="Configuration">
4351 <ConfigurationType>DynamicLibrary</ConfigurationType>
44- <PlatformToolset>v120</PlatformToolset>
4552 <UseOfMfc>false</UseOfMfc>
46- <UseOfAtl>Dynamic</UseOfAtl>
4753 <CharacterSet>MultiByte</CharacterSet>
54+ <PlatformToolset>v120</PlatformToolset>
4855 </PropertyGroup>
49- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'" Label="Configuration">
56+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="Configuration">
5057 <ConfigurationType>DynamicLibrary</ConfigurationType>
58+ <UseOfMfc>false</UseOfMfc>
59+ <CharacterSet>Unicode</CharacterSet>
5160 <PlatformToolset>v120</PlatformToolset>
61+ </PropertyGroup>
62+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'" Label="Configuration">
63+ <ConfigurationType>DynamicLibrary</ConfigurationType>
5264 <UseOfMfc>false</UseOfMfc>
53- <UseOfAtl>Dynamic</UseOfAtl>
5465 <CharacterSet>Unicode</CharacterSet>
66+ <PlatformToolset>v120</PlatformToolset>
5567 </PropertyGroup>
56- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
68+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="Configuration">
69+ <UseOfAtl>Static</UseOfAtl>
70+ <CharacterSet>Unicode</CharacterSet>
5771 <ConfigurationType>DynamicLibrary</ConfigurationType>
5872 <PlatformToolset>v120</PlatformToolset>
59- <UseOfMfc>false</UseOfMfc>
60- <CharacterSet>MultiByte</CharacterSet>
6173 </PropertyGroup>
62- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'" Label="Configuration">
74+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'" Label="Configuration">
75+ <UseOfAtl>Static</UseOfAtl>
76+ <CharacterSet>MultiByte</CharacterSet>
6377 <ConfigurationType>DynamicLibrary</ConfigurationType>
6478 <PlatformToolset>v120</PlatformToolset>
65- <UseOfMfc>false</UseOfMfc>
79+ </PropertyGroup>
80+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="Configuration">
6681 <UseOfAtl>Static</UseOfAtl>
6782 <CharacterSet>Unicode</CharacterSet>
68- </PropertyGroup>
69- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'" Label="Configuration">
7083 <ConfigurationType>DynamicLibrary</ConfigurationType>
7184 <PlatformToolset>v120</PlatformToolset>
72- <UseOfMfc>false</UseOfMfc>
85+ </PropertyGroup>
86+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'" Label="Configuration">
7387 <UseOfAtl>Static</UseOfAtl>
74- <CharacterSet>MultiByte</CharacterSet>
88+ <CharacterSet>Unicode</CharacterSet>
89+ <ConfigurationType>DynamicLibrary</ConfigurationType>
90+ <PlatformToolset>v120</PlatformToolset>
7591 </PropertyGroup>
7692 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
7793 <ImportGroup Label="ExtensionSettings">
@@ -79,319 +95,224 @@
7995 <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="PropertySheets">
8096 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
8197 </ImportGroup>
82- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'" Label="PropertySheets">
98+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'" Label="PropertySheets">
99+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
100+ </ImportGroup>
101+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="PropertySheets">
83102 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
84103 </ImportGroup>
85- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'" Label="PropertySheets">
104+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'" Label="PropertySheets">
86105 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
87106 </ImportGroup>
88- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
107+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="PropertySheets">
89108 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
90109 </ImportGroup>
91- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'" Label="PropertySheets">
110+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'" Label="PropertySheets">
92111 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
93112 </ImportGroup>
94- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'" Label="PropertySheets">
113+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="PropertySheets">
114+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
115+ </ImportGroup>
116+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'" Label="PropertySheets">
95117 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
96118 </ImportGroup>
97119 <PropertyGroup Label="UserMacros" />
98120 <PropertyGroup>
99121 <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
100122 </PropertyGroup>
101- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">
102- <OutDir>.\ReleaseMinDependency\</OutDir>
103- <IntDir>.\ReleaseMinDependency\</IntDir>
123+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
104124 <LinkIncremental>false</LinkIncremental>
105125 </PropertyGroup>
106- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">
107- <OutDir>.\ReleaseUMinDependency\</OutDir>
108- <IntDir>.\ReleaseUMinDependency\</IntDir>
126+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">
109127 <LinkIncremental>false</LinkIncremental>
110128 </PropertyGroup>
111- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
112- <OutDir>.\Debug\</OutDir>
113- <IntDir>.\Debug\</IntDir>
114- <LinkIncremental>true</LinkIncremental>
115- </PropertyGroup>
116- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">
117- <OutDir>.\ReleaseUMinSize\</OutDir>
118- <IntDir>.\ReleaseUMinSize\</IntDir>
129+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">
119130 <LinkIncremental>false</LinkIncremental>
120131 </PropertyGroup>
121- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">
122- <OutDir>.\ReleaseMinSize\</OutDir>
123- <IntDir>.\ReleaseMinSize\</IntDir>
132+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">
124133 <LinkIncremental>false</LinkIncremental>
125134 </PropertyGroup>
126135 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
127- <OutDir>.\DebugU\</OutDir>
128- <IntDir>.\DebugU\</IntDir>
129136 <LinkIncremental>true</LinkIncremental>
130137 </PropertyGroup>
131- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">
138+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">
139+ <LinkIncremental>true</LinkIncremental>
140+ </PropertyGroup>
141+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">
142+ <LinkIncremental>true</LinkIncremental>
143+ </PropertyGroup>
144+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">
145+ <LinkIncremental>true</LinkIncremental>
146+ </PropertyGroup>
147+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
148+ <ClCompile>
149+ <StringPooling>true</StringPooling>
150+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
151+ <FunctionLevelLinking>true</FunctionLevelLinking>
152+ <PrecompiledHeader>Create</PrecompiledHeader>
153+ <Optimization>MinSpace</Optimization>
154+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
155+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
156+ </ClCompile>
157+ <CustomBuildStep />
158+ <Link>
159+ <SubSystem>Windows</SubSystem>
160+ <GenerateDebugInformation>false</GenerateDebugInformation>
161+ <ImageHasSafeExceptionHandlers>true</ImageHasSafeExceptionHandlers>
162+ </Link>
163+ <Midl>
164+ <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
165+ </Midl>
166+ <ResourceCompile />
167+ <ResourceCompile>
168+ <Culture>0x0411</Culture>
169+ </ResourceCompile>
170+ </ItemDefinitionGroup>
171+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">
132172 <ClCompile>
173+ <StringPooling>true</StringPooling>
174+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
175+ <FunctionLevelLinking>true</FunctionLevelLinking>
176+ <PrecompiledHeader>Create</PrecompiledHeader>
133177 <Optimization>MinSpace</Optimization>
134178 <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
135- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
179+ </ClCompile>
180+ <CustomBuildStep />
181+ <Link>
182+ <SubSystem>Windows</SubSystem>
183+ <GenerateDebugInformation>false</GenerateDebugInformation>
184+ </Link>
185+ <Midl>
186+ <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
187+ </Midl>
188+ <ResourceCompile />
189+ <ResourceCompile>
190+ <Culture>0x0411</Culture>
191+ </ResourceCompile>
192+ </ItemDefinitionGroup>
193+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">
194+ <ClCompile>
136195 <StringPooling>true</StringPooling>
137196 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
138197 <FunctionLevelLinking>true</FunctionLevelLinking>
139- <PrecompiledHeader>Use</PrecompiledHeader>
140- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
141- <PrecompiledHeaderOutputFile>.\ReleaseMinDependency/SeraphyScriptTools.pch</PrecompiledHeaderOutputFile>
142- <AssemblerListingLocation>.\ReleaseMinDependency/</AssemblerListingLocation>
143- <ObjectFileName>.\ReleaseMinDependency/</ObjectFileName>
144- <ProgramDataBaseFileName>.\ReleaseMinDependency/</ProgramDataBaseFileName>
145- <WarningLevel>Level3</WarningLevel>
146- <SuppressStartupBanner>true</SuppressStartupBanner>
198+ <PrecompiledHeader>Create</PrecompiledHeader>
147199 </ClCompile>
148- <CustomBuildStep>
149- <Message>登録を行っています</Message>
150- <Command>regsvr32 /s /c "$(TargetPath)"
151-echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
152-</Command>
153- <Outputs>$(OutDir)regsvr32.trg;%(Outputs)</Outputs>
154- </CustomBuildStep>
200+ <CustomBuildStep />
155201 <Link>
156- <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
157- <AdditionalDependencies>comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
158- <OutputFile>.\ReleaseMinDependency/SeraphyScriptTools.dll</OutputFile>
159- <SuppressStartupBanner>true</SuppressStartupBanner>
160- <ModuleDefinitionFile>.\SeraphyScriptTools.def</ModuleDefinitionFile>
161- <ProgramDatabaseFile>.\ReleaseMinDependency/SeraphyScriptTools.pdb</ProgramDatabaseFile>
162202 <SubSystem>Windows</SubSystem>
163- <ImportLibrary>.\ReleaseMinDependency/SeraphyScriptTools.lib</ImportLibrary>
203+ <GenerateDebugInformation>false</GenerateDebugInformation>
164204 </Link>
165205 <Midl>
166- <TypeLibraryName>.\ReleaseMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
206+ <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
167207 </Midl>
208+ <ResourceCompile />
168209 <ResourceCompile>
169- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
170210 <Culture>0x0411</Culture>
171211 </ResourceCompile>
172212 </ItemDefinitionGroup>
173- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">
213+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">
174214 <ClCompile>
175- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
176- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
177215 <StringPooling>true</StringPooling>
178216 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
179217 <FunctionLevelLinking>true</FunctionLevelLinking>
180- <PrecompiledHeader>Use</PrecompiledHeader>
181- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
182- <PrecompiledHeaderOutputFile>.\ReleaseUMinDependency/SeraphyScriptTools.pch</PrecompiledHeaderOutputFile>
183- <AssemblerListingLocation>.\ReleaseUMinDependency/</AssemblerListingLocation>
184- <ObjectFileName>.\ReleaseUMinDependency/</ObjectFileName>
185- <ProgramDataBaseFileName>.\ReleaseUMinDependency/</ProgramDataBaseFileName>
186- <WarningLevel>Level3</WarningLevel>
187- <SuppressStartupBanner>true</SuppressStartupBanner>
218+ <PrecompiledHeader>Create</PrecompiledHeader>
188219 </ClCompile>
189- <CustomBuildStep>
190- <Message>登録を行っています</Message>
191- <Command>if "%25OS%25"=="" goto NOTNT
192-if not "%25OS%25"=="Windows_NT" goto NOTNT
193-regsvr32 /s /c "$(TargetPath)"
194-echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
195-goto end
196-:NOTNT
197-echo 警告 : Windows 95 に Unicode DLL を登録することはできません
198-:end
199-</Command>
200- <Outputs>$(OutDir)regsvr32.trg;%(Outputs)</Outputs>
201- </CustomBuildStep>
220+ <CustomBuildStep />
202221 <Link>
203- <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
204- <AdditionalDependencies>comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
205- <OutputFile>.\ReleaseUMinDependency/SeraphyScriptTools.dll</OutputFile>
206- <SuppressStartupBanner>true</SuppressStartupBanner>
207- <ModuleDefinitionFile>.\SeraphyScriptTools.def</ModuleDefinitionFile>
208- <ProgramDatabaseFile>.\ReleaseUMinDependency/SeraphyScriptTools.pdb</ProgramDatabaseFile>
209222 <SubSystem>Windows</SubSystem>
210- <ImportLibrary>.\ReleaseUMinDependency/SeraphyScriptTools.lib</ImportLibrary>
223+ <GenerateDebugInformation>false</GenerateDebugInformation>
211224 </Link>
212225 <Midl>
213226 <TypeLibraryName>.\ReleaseUMinDependency/SeraphyScriptTools.tlb</TypeLibraryName>
214227 </Midl>
228+ <ResourceCompile />
215229 <ResourceCompile>
216- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
217230 <Culture>0x0411</Culture>
218231 </ResourceCompile>
219232 </ItemDefinitionGroup>
220- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
233+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
221234 <ClCompile>
222235 <Optimization>Disabled</Optimization>
223- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
224236 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
225237 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
226- <PrecompiledHeader>Use</PrecompiledHeader>
227- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
228- <PrecompiledHeaderOutputFile>.\Debug/SeraphyScriptTools.pch</PrecompiledHeaderOutputFile>
229- <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
230- <ObjectFileName>.\Debug/</ObjectFileName>
231- <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
232- <WarningLevel>Level3</WarningLevel>
233- <SuppressStartupBanner>true</SuppressStartupBanner>
238+ <PrecompiledHeader>Create</PrecompiledHeader>
234239 <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
235240 </ClCompile>
236- <CustomBuildStep>
237- <Message>登録を行っています</Message>
238- <Command>regsvr32 /s /c "$(TargetPath)"
239-echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
240-</Command>
241- <Outputs>$(OutDir)regsvr32.trg;%(Outputs)</Outputs>
242- </CustomBuildStep>
241+ <CustomBuildStep />
243242 <Link>
244- <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
245- <AdditionalDependencies>comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
246- <OutputFile>.\Debug/SeraphyScriptTools.dll</OutputFile>
247- <SuppressStartupBanner>true</SuppressStartupBanner>
248- <ModuleDefinitionFile>.\SeraphyScriptTools.def</ModuleDefinitionFile>
249243 <GenerateDebugInformation>true</GenerateDebugInformation>
250- <ProgramDatabaseFile>.\Debug/SeraphyScriptTools.pdb</ProgramDatabaseFile>
251244 <SubSystem>Windows</SubSystem>
252- <ImportLibrary>.\Debug/SeraphyScriptTools.lib</ImportLibrary>
245+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
253246 </Link>
254247 <Midl>
255- <TypeLibraryName>.\Debug/SeraphyScriptTools.tlb</TypeLibraryName>
248+ <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
256249 </Midl>
250+ <ResourceCompile />
257251 <ResourceCompile>
258- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
259252 <Culture>0x0411</Culture>
260253 </ResourceCompile>
261254 </ItemDefinitionGroup>
262- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">
255+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">
263256 <ClCompile>
264- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
265- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
266- <StringPooling>true</StringPooling>
267- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
268- <FunctionLevelLinking>true</FunctionLevelLinking>
269- <PrecompiledHeader>Use</PrecompiledHeader>
270- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
271- <PrecompiledHeaderOutputFile>.\ReleaseUMinSize/SeraphyScriptTools.pch</PrecompiledHeaderOutputFile>
272- <AssemblerListingLocation>.\ReleaseUMinSize/</AssemblerListingLocation>
273- <ObjectFileName>.\ReleaseUMinSize/</ObjectFileName>
274- <ProgramDataBaseFileName>.\ReleaseUMinSize/</ProgramDataBaseFileName>
275- <WarningLevel>Level3</WarningLevel>
276- <SuppressStartupBanner>true</SuppressStartupBanner>
257+ <Optimization>Disabled</Optimization>
258+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
259+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
260+ <PrecompiledHeader>Create</PrecompiledHeader>
261+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
277262 </ClCompile>
278- <CustomBuildStep>
279- <Message>登録を行っています</Message>
280- <Command>if "%25OS%25"=="" goto NOTNT
281-if not "%25OS%25"=="Windows_NT" goto NOTNT
282-regsvr32 /s /c "$(TargetPath)"
283-echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
284-goto end
285-:NOTNT
286-echo 警告 : Windows 95 に Unicode DLL を登録することはできません
287-:end
288-</Command>
289- <Outputs>$(OutDir)regsvr32.trg;%(Outputs)</Outputs>
290- </CustomBuildStep>
263+ <CustomBuildStep />
291264 <Link>
292- <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
293- <AdditionalDependencies>comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
294- <OutputFile>.\ReleaseUMinSize/SeraphyScriptTools.dll</OutputFile>
295- <SuppressStartupBanner>true</SuppressStartupBanner>
296- <ModuleDefinitionFile>.\SeraphyScriptTools.def</ModuleDefinitionFile>
297- <ProgramDatabaseFile>.\ReleaseUMinSize/SeraphyScriptTools.pdb</ProgramDatabaseFile>
265+ <GenerateDebugInformation>true</GenerateDebugInformation>
298266 <SubSystem>Windows</SubSystem>
299- <ImportLibrary>.\ReleaseUMinSize/SeraphyScriptTools.lib</ImportLibrary>
267+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
300268 </Link>
301269 <Midl>
302- <TypeLibraryName>.\ReleaseUMinSize/SeraphyScriptTools.tlb</TypeLibraryName>
270+ <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
303271 </Midl>
272+ <ResourceCompile />
304273 <ResourceCompile>
305- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
306274 <Culture>0x0411</Culture>
307275 </ResourceCompile>
308276 </ItemDefinitionGroup>
309- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">
277+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">
310278 <ClCompile>
311- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
312- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
313- <StringPooling>true</StringPooling>
314- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
315- <FunctionLevelLinking>true</FunctionLevelLinking>
316- <PrecompiledHeader>Use</PrecompiledHeader>
317- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
318- <PrecompiledHeaderOutputFile>.\ReleaseMinSize/SeraphyScriptTools.pch</PrecompiledHeaderOutputFile>
319- <AssemblerListingLocation>.\ReleaseMinSize/</AssemblerListingLocation>
320- <ObjectFileName>.\ReleaseMinSize/</ObjectFileName>
321- <ProgramDataBaseFileName>.\ReleaseMinSize/</ProgramDataBaseFileName>
322- <WarningLevel>Level3</WarningLevel>
323- <SuppressStartupBanner>true</SuppressStartupBanner>
279+ <Optimization>Disabled</Optimization>
280+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
281+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
282+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
283+ <PrecompiledHeader>Create</PrecompiledHeader>
324284 </ClCompile>
325- <CustomBuildStep>
326- <Message>登録を行っています</Message>
327- <Command>regsvr32 /s /c "$(TargetPath)"
328-echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
329-</Command>
330- <Outputs>$(OutDir)regsvr32.trg;%(Outputs)</Outputs>
331- </CustomBuildStep>
285+ <CustomBuildStep />
332286 <Link>
333- <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
334- <AdditionalDependencies>comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
335- <OutputFile>.\ReleaseMinSize/SeraphyScriptTools.dll</OutputFile>
336- <SuppressStartupBanner>true</SuppressStartupBanner>
337- <ModuleDefinitionFile>.\SeraphyScriptTools.def</ModuleDefinitionFile>
338- <ProgramDatabaseFile>.\ReleaseMinSize/SeraphyScriptTools.pdb</ProgramDatabaseFile>
287+ <GenerateDebugInformation>true</GenerateDebugInformation>
339288 <SubSystem>Windows</SubSystem>
340- <ImportLibrary>.\ReleaseMinSize/SeraphyScriptTools.lib</ImportLibrary>
341289 </Link>
342290 <Midl>
343- <TypeLibraryName>.\ReleaseMinSize/SeraphyScriptTools.tlb</TypeLibraryName>
291+ <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
344292 </Midl>
293+ <ResourceCompile />
345294 <ResourceCompile>
346- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
347295 <Culture>0x0411</Culture>
348296 </ResourceCompile>
349297 </ItemDefinitionGroup>
350- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
298+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">
351299 <ClCompile>
352300 <Optimization>Disabled</Optimization>
353- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
354301 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
355302 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
356- <PrecompiledHeader>Use</PrecompiledHeader>
357- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
358- <PrecompiledHeaderOutputFile>.\DebugU/SeraphyScriptTools.pch</PrecompiledHeaderOutputFile>
359- <AssemblerListingLocation>.\DebugU/</AssemblerListingLocation>
360- <ObjectFileName>.\DebugU/</ObjectFileName>
361- <ProgramDataBaseFileName>.\DebugU/</ProgramDataBaseFileName>
362- <WarningLevel>Level3</WarningLevel>
363- <SuppressStartupBanner>true</SuppressStartupBanner>
364- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
303+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
304+ <PrecompiledHeader>Create</PrecompiledHeader>
365305 </ClCompile>
366- <CustomBuildStep>
367- <Message>登録を行っています</Message>
368- <Command>if "%25OS%25"=="" goto NOTNT
369-if not "%25OS%25"=="Windows_NT" goto NOTNT
370-regsvr32 /s /c "$(TargetPath)"
371-echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
372-goto end
373-:NOTNT
374-echo 警告 : Windows 95 に Unicode DLL を登録することはできません
375-:end
376-</Command>
377- <Outputs>$(OutDir)regsvr32.trg;%(Outputs)</Outputs>
378- </CustomBuildStep>
306+ <CustomBuildStep />
379307 <Link>
380- <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
381- <AdditionalDependencies>comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
382- <OutputFile>.\DebugU/SeraphyScriptTools.dll</OutputFile>
383- <SuppressStartupBanner>true</SuppressStartupBanner>
384- <ModuleDefinitionFile>.\SeraphyScriptTools.def</ModuleDefinitionFile>
385308 <GenerateDebugInformation>true</GenerateDebugInformation>
386- <ProgramDatabaseFile>.\DebugU/SeraphyScriptTools.pdb</ProgramDatabaseFile>
387309 <SubSystem>Windows</SubSystem>
388- <ImportLibrary>.\DebugU/SeraphyScriptTools.lib</ImportLibrary>
389310 </Link>
390311 <Midl>
391312 <TypeLibraryName>.\DebugU/SeraphyScriptTools.tlb</TypeLibraryName>
392313 </Midl>
314+ <ResourceCompile />
393315 <ResourceCompile>
394- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
395316 <Culture>0x0411</Culture>
396317 </ResourceCompile>
397318 </ItemDefinitionGroup>
@@ -412,12 +333,14 @@ echo 警告 : Windows 95 に Unicode DLL を登録することはできません
412333 <ClCompile Include="SeraphyScriptTools.cpp" />
413334 <ClCompile Include="Shell.cpp" />
414335 <ClCompile Include="StdAfx.cpp">
415- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
416- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">Create</PrecompiledHeader>
417- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">Create</PrecompiledHeader>
418336 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">Create</PrecompiledHeader>
419- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">Create</PrecompiledHeader>
420- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">Create</PrecompiledHeader>
337+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">Create</PrecompiledHeader>
338+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">Create</PrecompiledHeader>
339+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">Create</PrecompiledHeader>
340+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">Create</PrecompiledHeader>
341+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">Create</PrecompiledHeader>
342+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">Create</PrecompiledHeader>
343+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">Create</PrecompiledHeader>
421344 </ClCompile>
422345 <ClCompile Include="TreeItem.cpp" />
423346 </ItemGroup>
@@ -443,40 +366,50 @@ echo 警告 : Windows 95 に Unicode DLL を登録することはできません
443366 </ItemGroup>
444367 <ItemGroup>
445368 <Midl Include="SeraphyScriptTools.idl">
446- <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateStublessProxies>
447- <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
448- <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">SeraphyScriptTools.h</HeaderFileName>
449- <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
450- <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">true</GenerateStublessProxies>
451- <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
452- <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">SeraphyScriptTools.h</HeaderFileName>
453- <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
454- <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">true</GenerateStublessProxies>
455- <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
456- <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">SeraphyScriptTools.h</HeaderFileName>
457- <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
458369 <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">true</GenerateStublessProxies>
370+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">true</GenerateStublessProxies>
371+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">true</GenerateStublessProxies>
372+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">true</GenerateStublessProxies>
459373 <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
374+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
375+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
376+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
460377 <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">SeraphyScriptTools.h</HeaderFileName>
378+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">SeraphyScriptTools.h</HeaderFileName>
379+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">SeraphyScriptTools.h</HeaderFileName>
380+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">SeraphyScriptTools.h</HeaderFileName>
461381 <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
462- <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">true</GenerateStublessProxies>
463- <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
464- <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">SeraphyScriptTools.h</HeaderFileName>
465- <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
466- <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">true</GenerateStublessProxies>
467- <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
468- <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">SeraphyScriptTools.h</HeaderFileName>
469- <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
382+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
383+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
384+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
385+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">true</GenerateStublessProxies>
386+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">true</GenerateStublessProxies>
387+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">true</GenerateStublessProxies>
388+ <GenerateStublessProxies Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">true</GenerateStublessProxies>
389+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
390+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">.\SeraphyScriptTools.tlb</TypeLibraryName>
391+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
392+ <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">.\SeraphyScriptTools.tlb</TypeLibraryName>
393+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">SeraphyScriptTools.h</HeaderFileName>
394+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">SeraphyScriptTools.h</HeaderFileName>
395+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">SeraphyScriptTools.h</HeaderFileName>
396+ <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">SeraphyScriptTools.h</HeaderFileName>
397+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
398+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
399+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
400+ <InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">SeraphyScriptTools_i.c</InterfaceIdentifierFileName>
470401 </Midl>
471402 </ItemGroup>
472403 <ItemGroup>
473404 <ResourceCompile Include="SeraphyScriptTools.rc">
474- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
475- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release MinDependency|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
476- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release MinSize|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
477405 <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
478- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinDependency|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
479- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release MinSize|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
406+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
407+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
408+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Debug|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
409+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
410+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Release|Win32'">$(OUTDIR)</AdditionalIncludeDirectories>
411+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
412+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='MBCS Release|x64'">$(OUTDIR)</AdditionalIncludeDirectories>
480413 </ResourceCompile>
481414 </ItemGroup>
482415 <ItemGroup>
--- a/Shell.cpp
+++ b/Shell.cpp
@@ -4,8 +4,11 @@
44 #include "Shell.h"
55 #include "generic.h"
66 #include <list>
7+#include <vector>
78 using namespace std;
89
10+#pragma comment(lib, "Version.lib")
11+
912 /////////////////////////////////////////////////////////////////////////////
1013 // CShell
1114
@@ -25,67 +28,73 @@ STDMETHODIMP CShell::InterfaceSupportsErrorInfo(REFIID riid)
2528
2629 STDMETHODIMP CShell::ShellExecute(VARIANT path, VARIANT param, VARIANT initdir, VARIANT show, VARIANT *punkVal)
2730 {
28- CComVariant varPath,varParam,varInitDir,varMode;
29- CHAR szPath[MAX_PATH] = { 0 };
30- CHAR szInitDir[MAX_PATH] = { 0 };
31- int nShow = SW_SHOWNORMAL;
32- LPSTR pBuf = NULL;
33- if(varPath.ChangeType(VT_BSTR,&path) == S_OK){
34- WideCharToMultiByte(GetACP(),0,varPath.bstrVal,-1,szPath,MAX_PATH,NULL,NULL);
31+ ATL::CString szPath;
32+ CComVariant varPath;
33+ if (varPath.ChangeType(VT_BSTR, &path) == S_OK) {
34+ szPath = varPath.bstrVal;
3535 }
36- if(varParam.ChangeType(VT_BSTR,&param) == S_OK){
37- int needsize = WideCharToMultiByte(GetACP(),0,varParam.bstrVal,-1,NULL,0,NULL,NULL);
38- pBuf = new CHAR[needsize+1];
39- WideCharToMultiByte(GetACP(),0,varParam.bstrVal,-1,pBuf,needsize,NULL,NULL);
36+
37+ ATL::CString szParam;
38+ CComVariant varParam;
39+ if (varParam.ChangeType(VT_BSTR, &param) == S_OK) {
40+ szParam = varParam.bstrVal;
4041 }
41- if(varInitDir.ChangeType(VT_BSTR,&initdir) == S_OK){
42- WideCharToMultiByte(GetACP(),0,varInitDir.bstrVal,-1,szInitDir,MAX_PATH,NULL,NULL);
42+
43+ ATL::CString szInitDir;
44+ CComVariant varInitDir;
45+ if (varInitDir.ChangeType(VT_BSTR, &initdir) == S_OK) {
46+ szInitDir = varInitDir.bstrVal;
4347 }
44- if(varMode.ChangeType(VT_I2,&show) == S_OK){
45- switch(varMode.iVal)
48+
49+ int nShow = SW_SHOWNORMAL;
50+ CComVariant varMode;
51+ if (varMode.ChangeType(VT_I2, &show) == S_OK) {
52+ switch (varMode.iVal)
4653 {
4754 case 0:
4855 nShow = SW_HIDE;
4956 break;
57+
5058 case 1:
5159 default:
5260 nShow = SW_SHOWNORMAL;
5361 break;
62+
5463 case 2:
5564 nShow = SW_SHOWMAXIMIZED;
5665 break;
66+
5767 case 3:
5868 nShow = SW_SHOWMINIMIZED;
5969 break;
70+
6071 case 4:
6172 nShow = SW_SHOWMINNOACTIVE;
6273 break;
6374 }
6475 }
76+
6577 //
6678 SHELLEXECUTEINFO info = {0};
6779 info.cbSize = sizeof(SHELLEXECUTEINFO);
6880 info.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_NOCLOSEPROCESS;
6981 info.hwnd = GetMainWindow();
70- info.lpVerb = "OPEN";
82+ info.lpVerb = _TEXT("OPEN");
7183 info.lpFile = szPath;
72- info.lpParameters = pBuf;
84+ info.lpParameters = szParam;
7385 info.lpDirectory = szInitDir;
7486 info.nShow = nShow;
75- if(ShellExecuteEx(&info)){
87+ if (ShellExecuteEx(&info)) {
7688 // ShellExecObjの生成
7789 CComObject<CShellExecObj>* pExec = NULL;
78- if(pExec->CreateInstance(&pExec) == S_OK){
90+ if (pExec->CreateInstance(&pExec) == S_OK) {
7991 pExec->m_hProcess = info.hProcess;
8092 IUnknown* pUnk = NULL;
81- pExec->QueryInterface(IID_IUnknown,(void**)&pUnk);
93+ pExec->QueryInterface(IID_IUnknown, (void**)&pUnk);
8294 punkVal->vt = VT_UNKNOWN;
8395 punkVal->punkVal = pUnk;
8496 }
8597 }
86- if(pBuf){
87- delete[]pBuf;
88- }
8998 return S_OK;
9099 }
91100
@@ -97,33 +106,33 @@ STDMETHODIMP CShellExecObj::Wait(VARIANT tim, VARIANT *pVal)
97106 {
98107 ::VariantInit(pVal);
99108 BOOL bExit = true;
100- if(m_hProcess){
109+ if (m_hProcess) {
101110 CComVariant varTim;
102111 DWORD dwWaitTime = 0;
103- if(varTim.ChangeType(VT_I4,&tim) == S_OK){
104- if(varTim.lVal < 0){
112+ if (varTim.ChangeType(VT_I4, &tim) == S_OK) {
113+ if (varTim.lVal < 0) {
105114 // 無限まち
106115 dwWaitTime = INFINITE;
107116 }
108- else{
117+ else {
109118 dwWaitTime = (DWORD)varTim.lVal;
110119 }
111120 }
112- DWORD ret = WaitForSingleObject(m_hProcess,dwWaitTime);
113- if(ret == WAIT_TIMEOUT){
121+ DWORD ret = WaitForSingleObject(m_hProcess, dwWaitTime);
122+ if (ret == WAIT_TIMEOUT) {
114123 // プロセスは終了していない
115124 bExit = false;
116125 }
117126 }
118127 pVal->vt = VT_BOOL;
119- pVal->boolVal = bExit?VB_TRUE:VB_FALSE;
128+ pVal->boolVal = bExit ? VB_TRUE : VB_FALSE;
120129 return S_OK;
121130 }
122131
123132 STDMETHODIMP CShellExecObj::get_ExitCode(long *pVal)
124133 {
125- if(m_hProcess){
126- GetExitCodeProcess(m_hProcess,(DWORD*)pVal);
134+ if (m_hProcess) {
135+ GetExitCodeProcess(m_hProcess, (DWORD*)pVal);
127136 }
128137 return S_OK;
129138 }
@@ -131,113 +140,116 @@ STDMETHODIMP CShellExecObj::get_ExitCode(long *pVal)
131140 class SPECIALFOLDERPAIR
132141 {
133142 public:
134- SPECIALFOLDERPAIR(LPCSTR arg_name,int arg_id){
143+ SPECIALFOLDERPAIR(LPCTSTR arg_name, int arg_id) {
135144 name = arg_name;
136145 id = arg_id;
137146 }
138- LPCSTR name;
147+ LPCTSTR name;
139148 int id;
140149 };
141150
142151 STDMETHODIMP CShell::GetSpecialFolderLocations(IUnknown *punkVal)
143152 {
144- if(!punkVal){
153+ if (!punkVal) {
145154 return E_FAIL;
146155 }
156+
147157 IObjectMap* pMap = NULL;
148- if(punkVal->QueryInterface(IID_IObjectMap,(void**)&pMap) != S_OK){
158+ if (punkVal->QueryInterface(IID_IObjectMap, (void**)&pMap) != S_OK) {
149159 return DISP_E_TYPEMISMATCH;
150160 }
161+
151162 // システムバージョンチェック
152163 BOOL bWinNT;
153164 get_IsWindowNT(&bWinNT);
154165 // NT系の場合と9x系の場合とは取得できるフォルダの種類がちがうので分けておく
155- list<SPECIALFOLDERPAIR> lst;
156- if(bWinNT){
166+ std::list<SPECIALFOLDERPAIR> lst;
167+ if (bWinNT) {
157168 // WINNT
158- lst.push_back(SPECIALFOLDERPAIR("ADMINTOOLS",CSIDL_ADMINTOOLS));
159- lst.push_back(SPECIALFOLDERPAIR("ALTSTARTUP",CSIDL_ALTSTARTUP));
160- lst.push_back(SPECIALFOLDERPAIR("APPDATA",CSIDL_APPDATA));
161- lst.push_back(SPECIALFOLDERPAIR("COMMON_ADMINTOOLS",CSIDL_COMMON_ADMINTOOLS));
162- lst.push_back(SPECIALFOLDERPAIR("COMMON_ALTSTARTUP",CSIDL_COMMON_ALTSTARTUP));
163- lst.push_back(SPECIALFOLDERPAIR("COMMON_APPDATA",CSIDL_COMMON_APPDATA));
164- lst.push_back(SPECIALFOLDERPAIR("COMMON_DESKTOPDIRECTORY",CSIDL_COMMON_DESKTOPDIRECTORY));
165- lst.push_back(SPECIALFOLDERPAIR("COMMON_DOCUMENTS",CSIDL_COMMON_DOCUMENTS));
166- lst.push_back(SPECIALFOLDERPAIR("COMMON_FAVORITES",CSIDL_COMMON_FAVORITES));
167- lst.push_back(SPECIALFOLDERPAIR("COMMON_PROGRAMS",CSIDL_COMMON_PROGRAMS));
168- lst.push_back(SPECIALFOLDERPAIR("COMMON_STARTMENU",CSIDL_COMMON_STARTMENU));
169- lst.push_back(SPECIALFOLDERPAIR("COMMON_STARTUP",CSIDL_COMMON_STARTUP));
170- lst.push_back(SPECIALFOLDERPAIR("COMMON_TEMPLATES",CSIDL_COMMON_TEMPLATES));
171- lst.push_back(SPECIALFOLDERPAIR("COOKIES",CSIDL_COOKIES));
172- lst.push_back(SPECIALFOLDERPAIR("DESKTOPDIRECTORY",CSIDL_DESKTOPDIRECTORY));
173- lst.push_back(SPECIALFOLDERPAIR("FAVORITES",CSIDL_FAVORITES));
174- lst.push_back(SPECIALFOLDERPAIR("FONTS",CSIDL_FONTS ));
175- lst.push_back(SPECIALFOLDERPAIR("HISTORY",CSIDL_HISTORY));
176- lst.push_back(SPECIALFOLDERPAIR("INTERNET_CACHE ",CSIDL_INTERNET_CACHE ));
177- lst.push_back(SPECIALFOLDERPAIR("LOCAL_APPDATA ",CSIDL_LOCAL_APPDATA ));
178- lst.push_back(SPECIALFOLDERPAIR("MYPICTURES",CSIDL_MYPICTURES));
179- lst.push_back(SPECIALFOLDERPAIR("NETHOOD",CSIDL_NETHOOD));
180- lst.push_back(SPECIALFOLDERPAIR("PERSONAL",CSIDL_PERSONAL));
181- lst.push_back(SPECIALFOLDERPAIR("PRINTHOOD",CSIDL_PRINTHOOD));
182- lst.push_back(SPECIALFOLDERPAIR("PROFILE ",CSIDL_PROFILE ));
183- lst.push_back(SPECIALFOLDERPAIR("PROGRAM_FILES",CSIDL_PROGRAM_FILES));
184- lst.push_back(SPECIALFOLDERPAIR("PROGRAM_FILES_COMMON",CSIDL_PROGRAM_FILES_COMMON));
185- lst.push_back(SPECIALFOLDERPAIR("PROGRAMS",CSIDL_PROGRAMS));
186- lst.push_back(SPECIALFOLDERPAIR("RECENT",CSIDL_RECENT ));
187- lst.push_back(SPECIALFOLDERPAIR("SENDTO",CSIDL_SENDTO ));
188- lst.push_back(SPECIALFOLDERPAIR("STARTMENU",CSIDL_STARTMENU));
189- lst.push_back(SPECIALFOLDERPAIR("STARTUP",CSIDL_STARTUP));
190- lst.push_back(SPECIALFOLDERPAIR("SYSTEM",CSIDL_SYSTEM));
191- lst.push_back(SPECIALFOLDERPAIR("TEMPLATES",CSIDL_TEMPLATES));
192- lst.push_back(SPECIALFOLDERPAIR("WINDOWS",CSIDL_WINDOWS));
169+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("ADMINTOOLS"), CSIDL_ADMINTOOLS));
170+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("ALTSTARTUP"), CSIDL_ALTSTARTUP));
171+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("APPDATA"), CSIDL_APPDATA));
172+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_ADMINTOOLS"), CSIDL_COMMON_ADMINTOOLS));
173+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_ALTSTARTUP"), CSIDL_COMMON_ALTSTARTUP));
174+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_APPDATA"), CSIDL_COMMON_APPDATA));
175+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_DESKTOPDIRECTORY"), CSIDL_COMMON_DESKTOPDIRECTORY));
176+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_DOCUMENTS"), CSIDL_COMMON_DOCUMENTS));
177+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_FAVORITES"), CSIDL_COMMON_FAVORITES));
178+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_PROGRAMS"), CSIDL_COMMON_PROGRAMS));
179+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_STARTMENU"), CSIDL_COMMON_STARTMENU));
180+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_STARTUP"), CSIDL_COMMON_STARTUP));
181+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_TEMPLATES"), CSIDL_COMMON_TEMPLATES));
182+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COOKIES"), CSIDL_COOKIES));
183+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("DESKTOPDIRECTORY"), CSIDL_DESKTOPDIRECTORY));
184+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("FAVORITES"), CSIDL_FAVORITES));
185+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("FONTS"), CSIDL_FONTS));
186+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("HISTORY"), CSIDL_HISTORY));
187+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("INTERNET_CACHE"), CSIDL_INTERNET_CACHE));
188+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("LOCAL_APPDATA"), CSIDL_LOCAL_APPDATA));
189+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("MYPICTURES"), CSIDL_MYPICTURES));
190+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("NETHOOD"), CSIDL_NETHOOD));
191+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PERSONAL"), CSIDL_PERSONAL));
192+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PRINTHOOD"), CSIDL_PRINTHOOD));
193+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROFILE"), CSIDL_PROFILE));
194+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROGRAM_FILES"), CSIDL_PROGRAM_FILES));
195+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROGRAM_FILES_COMMON"), CSIDL_PROGRAM_FILES_COMMON));
196+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROGRAMS"), CSIDL_PROGRAMS));
197+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("RECENT"), CSIDL_RECENT));
198+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("SENDTO"), CSIDL_SENDTO));
199+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("STARTMENU"), CSIDL_STARTMENU));
200+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("STARTUP"), CSIDL_STARTUP));
201+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("SYSTEM"), CSIDL_SYSTEM));
202+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("TEMPLATES"), CSIDL_TEMPLATES));
203+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("WINDOWS"), CSIDL_WINDOWS));
193204 }
194205 else{
195206 // Win9x
196- lst.push_back(SPECIALFOLDERPAIR("ADMINTOOLS",CSIDL_ADMINTOOLS));
197- lst.push_back(SPECIALFOLDERPAIR("ALTSTARTUP",CSIDL_ALTSTARTUP));
198- lst.push_back(SPECIALFOLDERPAIR("APPDATA",CSIDL_APPDATA));
199- lst.push_back(SPECIALFOLDERPAIR("COMMON_ADMINTOOLS",CSIDL_ADMINTOOLS));
200- lst.push_back(SPECIALFOLDERPAIR("COMMON_ALTSTARTUP",CSIDL_ALTSTARTUP));
201- lst.push_back(SPECIALFOLDERPAIR("COMMON_APPDATA",CSIDL_APPDATA));
202- lst.push_back(SPECIALFOLDERPAIR("COMMON_DESKTOPDIRECTORY",CSIDL_DESKTOPDIRECTORY));
203- lst.push_back(SPECIALFOLDERPAIR("COMMON_DOCUMENTS",CSIDL_COMMON_DOCUMENTS));
204- lst.push_back(SPECIALFOLDERPAIR("COMMON_FAVORITES",CSIDL_FAVORITES));
205- lst.push_back(SPECIALFOLDERPAIR("COMMON_PROGRAMS",CSIDL_PROGRAMS));
206- lst.push_back(SPECIALFOLDERPAIR("COMMON_STARTMENU",CSIDL_STARTMENU));
207- lst.push_back(SPECIALFOLDERPAIR("COMMON_STARTUP",CSIDL_STARTUP));
208- lst.push_back(SPECIALFOLDERPAIR("COMMON_TEMPLATES",CSIDL_TEMPLATES));
209- lst.push_back(SPECIALFOLDERPAIR("COOKIES",CSIDL_COOKIES));
210- lst.push_back(SPECIALFOLDERPAIR("DESKTOPDIRECTORY",CSIDL_DESKTOPDIRECTORY));
211- lst.push_back(SPECIALFOLDERPAIR("FAVORITES",CSIDL_FAVORITES));
212- lst.push_back(SPECIALFOLDERPAIR("FONTS",CSIDL_FONTS ));
213- lst.push_back(SPECIALFOLDERPAIR("HISTORY",CSIDL_HISTORY));
214- lst.push_back(SPECIALFOLDERPAIR("INTERNET_CACHE ",CSIDL_INTERNET_CACHE ));
215- lst.push_back(SPECIALFOLDERPAIR("LOCAL_APPDATA ",CSIDL_LOCAL_APPDATA ));
216- lst.push_back(SPECIALFOLDERPAIR("MYPICTURES",CSIDL_MYPICTURES));
217- lst.push_back(SPECIALFOLDERPAIR("NETHOOD",CSIDL_NETHOOD));
218- lst.push_back(SPECIALFOLDERPAIR("PERSONAL",CSIDL_PERSONAL));
219- lst.push_back(SPECIALFOLDERPAIR("PRINTHOOD",CSIDL_PRINTHOOD));
220- lst.push_back(SPECIALFOLDERPAIR("PROFILE ",CSIDL_PROFILE ));
221- lst.push_back(SPECIALFOLDERPAIR("PROGRAM_FILES",CSIDL_PROGRAM_FILES));
222- lst.push_back(SPECIALFOLDERPAIR("PROGRAM_FILES_COMMON",CSIDL_PROGRAM_FILES));
223- lst.push_back(SPECIALFOLDERPAIR("PROGRAMS",CSIDL_PROGRAMS));
224- lst.push_back(SPECIALFOLDERPAIR("RECENT",CSIDL_RECENT ));
225- lst.push_back(SPECIALFOLDERPAIR("SENDTO",CSIDL_SENDTO ));
226- lst.push_back(SPECIALFOLDERPAIR("STARTMENU",CSIDL_STARTMENU));
227- lst.push_back(SPECIALFOLDERPAIR("STARTUP",CSIDL_STARTUP));
228- lst.push_back(SPECIALFOLDERPAIR("SYSTEM",CSIDL_SYSTEM));
229- lst.push_back(SPECIALFOLDERPAIR("TEMPLATES",CSIDL_TEMPLATES));
230- lst.push_back(SPECIALFOLDERPAIR("WINDOWS",CSIDL_WINDOWS));
231- }
232- list<SPECIALFOLDERPAIR>::iterator p = lst.begin();
233- while(p != lst.end()){
207+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("ADMINTOOLS"), CSIDL_ADMINTOOLS));
208+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("ALTSTARTUP"), CSIDL_ALTSTARTUP));
209+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("APPDATA"), CSIDL_APPDATA));
210+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_ADMINTOOLS"), CSIDL_ADMINTOOLS));
211+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_ALTSTARTUP"), CSIDL_ALTSTARTUP));
212+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_APPDATA"), CSIDL_APPDATA));
213+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_DESKTOPDIRECTORY"), CSIDL_DESKTOPDIRECTORY));
214+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_DOCUMENTS"), CSIDL_COMMON_DOCUMENTS));
215+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_FAVORITES"), CSIDL_FAVORITES));
216+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_PROGRAMS"), CSIDL_PROGRAMS));
217+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_STARTMENU"), CSIDL_STARTMENU));
218+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_STARTUP"), CSIDL_STARTUP));
219+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COMMON_TEMPLATES"), CSIDL_TEMPLATES));
220+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("COOKIES"), CSIDL_COOKIES));
221+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("DESKTOPDIRECTORY"), CSIDL_DESKTOPDIRECTORY));
222+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("FAVORITES"), CSIDL_FAVORITES));
223+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("FONTS"), CSIDL_FONTS));
224+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("HISTORY"), CSIDL_HISTORY));
225+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("INTERNET_CACHE"), CSIDL_INTERNET_CACHE));
226+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("LOCAL_APPDATA"), CSIDL_LOCAL_APPDATA));
227+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("MYPICTURES"), CSIDL_MYPICTURES));
228+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("NETHOOD"), CSIDL_NETHOOD));
229+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PERSONAL"), CSIDL_PERSONAL));
230+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PRINTHOOD"), CSIDL_PRINTHOOD));
231+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROFILE"), CSIDL_PROFILE));
232+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROGRAM_FILES"), CSIDL_PROGRAM_FILES));
233+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROGRAM_FILES_COMMON"), CSIDL_PROGRAM_FILES));
234+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("PROGRAMS"), CSIDL_PROGRAMS));
235+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("RECENT"), CSIDL_RECENT));
236+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("SENDTO"), CSIDL_SENDTO));
237+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("STARTMENU"), CSIDL_STARTMENU));
238+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("STARTUP"), CSIDL_STARTUP));
239+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("SYSTEM"), CSIDL_SYSTEM));
240+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("TEMPLATES"), CSIDL_TEMPLATES));
241+ lst.push_back(SPECIALFOLDERPAIR(_TEXT("WINDOWS"), CSIDL_WINDOWS));
242+ }
243+
244+ std::list<SPECIALFOLDERPAIR>::iterator p = lst.begin();
245+ while (p != lst.end()) {
234246 LPITEMIDLIST pid = NULL;
235- if(SHGetSpecialFolderLocation(NULL,(*p).id,&pid) == NOERROR){
236- CHAR buf[MAX_PATH] = {0};
237- if(SHGetPathFromIDList(pid,buf)){
238- CComVariant key((LPCSTR)(*p).name);
239- CComVariant value((LPCSTR)buf);
240- pMap->put_Value(key,value);
247+ if (SHGetSpecialFolderLocation(NULL, (*p).id, &pid) == NOERROR) {
248+ TCHAR buf[MAX_PATH] = {0};
249+ if (SHGetPathFromIDList(pid, buf)) {
250+ CComVariant key((*p).name);
251+ CComVariant value(buf);
252+ pMap->put_Value(key, value);
241253 }
242254 m_pMalloc->Free(pid);
243255 }
@@ -264,7 +276,7 @@ STDMETHODIMP CShell::get_WindowsVersion(long *pVal)
264276 OSVERSIONINFO vinfo = {0};
265277 vinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
266278 GetVersionEx(&vinfo);
267- if(vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT){
279+ if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
268280 *pVal = (long)vinfo.dwMajorVersion;
269281 }
270282 return S_OK;
@@ -272,41 +284,49 @@ STDMETHODIMP CShell::get_WindowsVersion(long *pVal)
272284
273285 STDMETHODIMP CShell::GetDLLVersion(VARIANT text,VARIANT min, VARIANT *pVal)
274286 {
275- CComVariant varText,varMin;
276- CHAR lpszDllName[MAX_PATH] = { 0 };
277- if(varText.ChangeType(VT_BSTR,&text) == S_OK){
278- WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,lpszDllName,MAX_PATH,NULL,NULL);
287+ ATL::CString lpszDllName;
288+ CComVariant varText;
289+ if (varText.ChangeType(VT_BSTR,&text) == S_OK) {
290+ lpszDllName = varText.bstrVal;
279291 }
292+
280293 BOOL bMin = false;
294+ CComVariant varMin;
281295 if(varMin.ChangeType(VT_I2,&min) == S_OK){
282296 bMin = varMin.iVal;
283297 }
298+
284299 CComVariant ret;
285300 DWORD siz = GetFileVersionInfoSize(lpszDllName,0);
286- if(siz){
287- LPBYTE pBuf = new BYTE[siz+1];
288- if(GetFileVersionInfo(lpszDllName,0,siz,pBuf)){
301+ if (siz) {
302+ std::vector<BYTE> buf(siz + 1);
303+ LPBYTE pBuf = &buf[0];
304+ if (GetFileVersionInfo(lpszDllName, 0, siz,pBuf)) {
289305 // バージョン情報を取得する
290306 VS_FIXEDFILEINFO* pverInfo;
291307 UINT sz = 0;
292- if(VerQueryValue(pBuf,"\\",(void**)&pverInfo,&sz)){
308+ if (VerQueryValue(pBuf,_TEXT("\\"), (void**) &pverInfo, &sz)) {
293309 // バージョンを確認可能である
294- CHAR mes[256];
295- if(bMin){
310+ TCHAR mes[256];
311+ if (bMin) {
296312 // 詳細
297- wsprintf(mes,"%d.%d.%d.%d"
298- ,HIWORD(pverInfo->dwFileVersionMS),LOWORD(pverInfo->dwFileVersionMS)
299- ,HIWORD(pverInfo->dwFileVersionLS),LOWORD(pverInfo->dwFileVersionLS));
313+ wsprintf(mes, _TEXT("%d.%d.%d.%d"),
314+ HIWORD(pverInfo->dwFileVersionMS),
315+ LOWORD(pverInfo->dwFileVersionMS),
316+ HIWORD(pverInfo->dwFileVersionLS),
317+ LOWORD(pverInfo->dwFileVersionLS)
318+ );
300319 }
301- else{
320+ else {
302321 // 通常
303- wsprintf(mes,"%d.%d"
304- ,HIWORD(pverInfo->dwFileVersionMS),LOWORD(pverInfo->dwFileVersionMS));
322+ wsprintf(mes, _TEXT("%d.%d"),
323+ HIWORD(pverInfo->dwFileVersionMS),
324+ LOWORD(pverInfo->dwFileVersionMS)
325+ );
305326 }
306- ret = (LPCSTR)mes;
327+ ret = mes;
307328 }
308329 }
309- delete[]pBuf;
310330 }
311331 ret.Detach(pVal);
312332 return S_OK;
@@ -315,13 +335,14 @@ STDMETHODIMP CShell::GetDLLVersion(VARIANT text,VARIANT min, VARIANT *pVal)
315335 STDMETHODIMP CShell::ParseName(VARIANT text, VARIANT *pVal)
316336 {
317337 ::VariantInit(pVal);
338+
318339 CComVariant varText;
319- if(varText.ChangeType(VT_BSTR,&text) == S_OK){
340+ if (varText.ChangeType(VT_BSTR,&text) == S_OK) {
320341 CComObject<CParseName>* pParse = NULL;
321- if(pParse->CreateInstance(&pParse) == S_OK){
342+ if (pParse->CreateInstance(&pParse) == S_OK) {
322343 pParse->m_bstr_path = (LPCWSTR)varText.bstrVal;
323344 IUnknown* pUnk = NULL;
324- if(pParse->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK){
345+ if (pParse->QueryInterface(IID_IUnknown,(void**)&pUnk) == S_OK) {
325346 pVal->vt = VT_UNKNOWN;
326347 pVal->punkVal = pUnk;
327348 }
@@ -335,22 +356,21 @@ STDMETHODIMP CShell::ParseName(VARIANT text, VARIANT *pVal)
335356
336357 STDMETHODIMP CParseName::InterfaceSupportsErrorInfo(REFIID riid)
337358 {
338- static const IID* arr[] =
339- {
359+ static const IID* arr[] = {
340360 &IID_ISeraphyScriptTool_ParseName
341361 };
342- for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
343- {
344- if (IsEqualGUID(*arr[i],riid))
362+
363+ for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) {
364+ if (IsEqualGUID(*arr[i], riid)) {
345365 return S_OK;
366+ }
346367 }
347368 return S_FALSE;
348369 }
349370
350371 STDMETHODIMP CParseName::get_PathName(BSTR *pVal)
351372 {
352- *pVal = m_bstr_path.copy();
353- return S_OK;
373+ return m_bstr_path.CopyTo(pVal);
354374 }
355375
356376 STDMETHODIMP CParseName::put_PathName(BSTR newVal)
@@ -361,10 +381,11 @@ STDMETHODIMP CParseName::put_PathName(BSTR newVal)
361381
362382 STDMETHODIMP CParseName::get_FileName(BSTR *pVal)
363383 {
364- LPWSTR p = m_bstr_path;
365- while(*p)p++;
366- while(p > (LPCWSTR)m_bstr_path){
367- if(*p == '\\' || *p == '/'){
384+ LPWSTR st = m_bstr_path;
385+ LPWSTR p = st;
386+ while (*p) p++;
387+ while (p > st) {
388+ if (*p == '\\' || *p == '/') {
368389 // 末尾から最初に発見されたフォルダプレースで止まる
369390 p++;
370391 break;
@@ -378,7 +399,7 @@ STDMETHODIMP CParseName::get_FileName(BSTR *pVal)
378399 STDMETHODIMP CParseName::put_FileName(BSTR newVal)
379400 {
380401 WCHAR buf[MAX_PATH];
381- lstrcpyW(buf,m_bstr_path);
402+ lstrcpyW(buf, m_bstr_path);
382403 LPWSTR p = buf;
383404 while(*p)p++;
384405 while(p > buf){
@@ -389,7 +410,7 @@ STDMETHODIMP CParseName::put_FileName(BSTR newVal)
389410 }
390411 p--;
391412 }
392- lstrcpyW(p,newVal);
413+ lstrcpyW(p, newVal);
393414 m_bstr_path = buf;
394415 return S_OK;
395416 }
@@ -399,20 +420,20 @@ STDMETHODIMP CParseName::get_Extention(BSTR *pVal)
399420 BOOL bFind = false;
400421 LPWSTR p = m_bstr_path;
401422 while(*p)p++;
402- while(p > (LPCWSTR)m_bstr_path){
403- if(*p == '.'){
423+ while (p > (LPCWSTR)m_bstr_path) {
424+ if (*p == '.') {
404425 bFind = true;
405426 p++;
406427 break;
407428 }
408- if(*p == '\\' || *p == '/'){
429+ if (*p == '\\' || *p == '/') {
409430 // フォルダプレースで中止する
410431 break;
411432 }
412433 p--;
413434 }
414- if(!bFind){
415- while(*p)p++;
435+ if (!bFind) {
436+ while (*p) p++;
416437 }
417438 *pVal = SysAllocString(p);
418439 return S_OK;
@@ -424,25 +445,25 @@ STDMETHODIMP CParseName::put_Extention(BSTR newVal)
424445 lstrcpyW(buf,m_bstr_path);
425446 BOOL bFind = false;
426447 LPWSTR p = buf;
427- while(*p)p++;
428- while(p > buf){
429- if(*p == '.'){
448+ while (*p) p++;
449+ while (p > buf) {
450+ if (*p == '.') {
430451 bFind = true;
431452 p++;
432453 break;
433454 }
434- if(*p == '\\' || *p == '/'){
455+ if (*p == '\\' || *p == '/') {
435456 // フォルダプレースで中止する
436457 break;
437458 }
438459 p--;
439460 }
440- if(!bFind){
461+ if (!bFind) {
441462 // 何もなければ末尾に追加する
442- while(*p)p++;
443- lstrcpyW(p,L".");
463+ while (*p) p++;
464+ lstrcpyW(p, L".");
444465 }
445- lstrcpyW(p,newVal);
466+ lstrcpyW(p, newVal);
446467 m_bstr_path = buf;
447468 return S_OK;
448469 }
@@ -633,52 +654,61 @@ HRESULT CShell::FileOperationCore(UINT wFunc, FILEOP_FLAGS flag, VARIANT *from,
633654 {
634655 ::VariantInit(pResult);
635656 CComVariant result;
636- CHAR szDest[MAX_PATH+2] = { 0 }; // double null
637- if(to){
657+
658+ ATL::CString szTo;
659+ if (to) {
638660 CComVariant varTo;
639661 if(to->vt != VT_NULL && to->vt != VT_ERROR || to->vt == VT_EMPTY
640- || varTo.ChangeType(VT_BSTR,to) != S_OK){
662+ || varTo.ChangeType(VT_BSTR, to) != S_OK) {
641663 return DISP_E_TYPEMISMATCH;
642664 }
643- WideCharToMultiByte(GetACP(),0,varTo.bstrVal,-1,szDest,MAX_PATH,NULL,NULL);
665+ szTo = varTo.bstrVal;
644666 }
645- LPSTR pFrom = CreateDNStringFromVariant(*from);
646- if(!pFrom){
667+ int len = szTo.GetLength();
668+ LPTSTR pTo = szTo.GetBufferSetLength(len + 2); // ダブルヌル終端
669+ pTo[len] = 0;
670+ pTo[len + 1] = 0;
671+
672+ std::vector<TCHAR> buf;
673+ if (!CreateDNStringFromVariant(*from, buf)) {
647674 return DISP_E_TYPEMISMATCH;
648675 }
676+
649677 SHFILEOPSTRUCT info = {0};
650678 info.fFlags = flag | FOF_ALLOWUNDO | (m_bSilent?FOF_SILENT:0) | (m_bConfirm?0:(FOF_NOCONFIRMMKDIR|FOF_NOCONFIRMATION));
651679 info.hwnd = GetMainWindow();
652- info.pFrom = pFrom;
653- info.pTo = szDest;
680+ info.pFrom = &buf[0];
681+ info.pTo = pTo;
654682 info.wFunc = wFunc;
655683 int ret = SHFileOperation(&info);
656- delete[]pFrom;
684+
657685 result = (bool)(!ret && !info.fAnyOperationsAborted);
658686 result.Detach(pResult);
659687 return S_OK;
660688 }
661689
662-LPSTR CShell::CreateDNStringFromVariant(VARIANT &from)
690+bool CShell::CreateDNStringFromVariant(VARIANT &from, std::vector<TCHAR> &buf)
663691 {
664- LPSTR pBuf = NULL;
665692 CComVariant varFrom;
666- if(varFrom.ChangeType(VT_BSTR,&from) == S_OK){
667- // BSTRに変換可能か?
668- int needsize = WideCharToMultiByte(GetACP(),0,varFrom.bstrVal,-1,NULL,0,NULL,NULL);
669- pBuf = new CHAR[needsize+2];
670- WideCharToMultiByte(GetACP(),0,varFrom.bstrVal,-1,pBuf,needsize,NULL,NULL);
671- pBuf[needsize ] = 0;
672- pBuf[needsize+1] = 0; // double null
673- return pBuf;
674- }
675- else if(varFrom.ChangeType(VT_UNKNOWN,&from) == S_OK){
676- // Unknownに変換可能か?
693+
694+ // 文字列に変換可能か?
695+ if (varFrom.ChangeType(VT_BSTR, &from) == S_OK) {
696+ ATL::CString tmp(varFrom.bstrVal);
697+ int bufsiz = tmp.GetLength() + 2; // ダブルヌル終端分
698+ buf.resize(bufsiz, 0);
699+ LPTSTR pBuf = &buf[0];
700+ StringCbCopy(pBuf, bufsiz, tmp);
701+ return true;
702+ }
703+
704+ // Unknown -> IObjectVector に変換可能か?
705+ if (varFrom.ChangeType(VT_UNKNOWN, &from) == S_OK) {
677706 IObjectVector* pVector = NULL;
678- if(varFrom.punkVal->QueryInterface(IID_IObjectVector,(void**)&pVector) != S_OK){
707+ if (varFrom.punkVal->QueryInterface(IID_IObjectVector,(void**)&pVector) != S_OK) {
679708 // IObjectVectorではないならエラー
680- return NULL;
709+ return false;
681710 }
711+
682712 // 配列を取得する
683713 long mx = 0;
684714 pVector->get_Count(&mx);
@@ -691,121 +721,146 @@ LPSTR CShell::CreateDNStringFromVariant(VARIANT &from)
691721 pVector->get_Value(idx,&tmp);
692722 if(tmp.ChangeType(VT_BSTR) != S_OK){
693723 // 文字列に変換不可能
694- return NULL;
724+ return false;
695725 }
696- needsize += WideCharToMultiByte(GetACP(),0,tmp.bstrVal,-1,NULL,0,NULL,NULL) + 1;
726+ ATL::CString czTmp(tmp.bstrVal);
727+ needsize += czTmp.GetLength() + 1; // +1はヌル終端分
697728 }
698- needsize += 1; // dobulenull
729+ needsize += 1; // ダブルヌル終端分
730+
699731 // 配列をダブルヌルに展開する
700- pBuf = new CHAR[needsize];
701- LPSTR p = pBuf;
702- for(cnt = 0 ; cnt < mx ; cnt++){
732+ buf.resize(needsize, 0);
733+ LPTSTR pBuf = &buf[0];
734+ LPTSTR p = pBuf;
735+ for (cnt = 0 ; cnt < mx ; cnt++) {
703736 CComVariant tmp;
704737 CComVariant idx((long)cnt);
705- pVector->get_Value(idx,&tmp);
706- if(tmp.ChangeType(VT_BSTR) == S_OK){
707- int sz = WideCharToMultiByte(GetACP(),0,tmp.bstrVal,-1,p,MAX_PATH,NULL,NULL);
708- *(p + sz) = 0;
709- p += sz;
738+ if (SUCCEEDED(pVector->get_Value(idx, &tmp))) {
739+ if (tmp.ChangeType(VT_BSTR) == S_OK) {
740+ ATL::CString szTmp(tmp.bstrVal);
741+ StringCbCopy(p, needsize, szTmp);
742+ int len = szTmp.GetLength() + 1;
743+ p += len;
744+ needsize -= len;
745+ }
710746 }
711747 }
712748 *p = 0; // dobule null
713749 pVector->Release();
714- return pBuf;
715- }
716- else{
717- // SafeArrayか?
718- VARTYPE vt = VT_EMPTY;
719- SAFEARRAY* pArray = GetArrayFromVariant(from,&vt);
720- if(!pArray || vt != VT_VARIANT){
721- // SafeArrayでないか、型がちがう
750+ return true;
751+ }
752+
753+ // SafeArrayか?
754+ VARTYPE vt = VT_EMPTY;
755+ SAFEARRAY* pArray = GetArrayFromVariant(from, &vt);
756+ if (!pArray || vt != VT_VARIANT) {
757+ // SafeArrayでないか、型がちがう
758+ return false;
759+ }
760+
761+ long lb = 0;
762+ long ub = 0;
763+ int dm = SafeArrayGetDim(pArray);
764+ SafeArrayGetLBound(pArray, 1, &lb); // 左側の添え字
765+ SafeArrayGetUBound(pArray, 1, &ub);
766+ if (dm != 1 || lb != 0) {
767+ // 1次元配列でないか、0ベースでない
768+ return false;
769+ }
770+
771+ DWORD needsize = 0;
772+ long dim[1];
773+ // バッファに必要なサイズを求める
774+ for (long cnt = 0 ; cnt <= ub ; cnt++) {
775+ CComVariant tmp;
776+ dim[0] = cnt;
777+ SafeArrayGetElement(pArray, dim, &tmp);
778+ if (tmp.ChangeType(VT_BSTR) != S_OK) {
779+ // 文字列に変換不可能
722780 return NULL;
723781 }
724- long lb = 0;
725- long ub = 0;
726- int dm = SafeArrayGetDim(pArray);
727- SafeArrayGetLBound(pArray,1,&lb); // 左側の添え字
728- SafeArrayGetUBound(pArray,1,&ub);
729- if(dm != 1 || lb != 0){
730- // 1次元配列でないか、0ベースでない
782+ ATL::CString szTmp(tmp.bstrVal);
783+ needsize += szTmp.GetLength() + 1;
784+ }
785+ needsize += 1; // ダブルヌル終端分
786+
787+ // バッファを確保し展開する
788+ buf.resize(needsize);
789+ LPTSTR pBuf = &buf[0];
790+ LPTSTR p = pBuf;
791+ for (long cnt = 0 ; cnt <= ub ; cnt++) {
792+ CComVariant tmp;
793+ dim[0] = cnt;
794+ SafeArrayGetElement(pArray, dim, &tmp);
795+ if (tmp.ChangeType(VT_BSTR) != S_OK) {
796+ // 文字列に変換不可能
731797 return NULL;
732798 }
733- DWORD needsize = 0;
734- long dim[1];
735- long cnt;
736- // バッファに必要なサイズを求める
737- for(cnt = 0 ; cnt <= ub ; cnt++){
738- CComVariant tmp;
739- dim[0] = cnt;
740- SafeArrayGetElement(pArray,dim,&tmp);
741- if(tmp.ChangeType(VT_BSTR) != S_OK){
742- // 文字列に変換不可能
743- return NULL;
744- }
745- needsize += WideCharToMultiByte(GetACP(),0,tmp.bstrVal,-1,NULL,0,NULL,NULL) + 1;
746- }
747- // バッファを確保し展開する
748- pBuf = new CHAR[needsize];
749- LPSTR p = pBuf;
750- for(cnt = 0 ; cnt <= ub ; cnt++){
751- CComVariant tmp;
752- dim[0] = cnt;
753- SafeArrayGetElement(pArray,dim,&tmp);
754- if(tmp.ChangeType(VT_BSTR) != S_OK){
755- // 文字列に変換不可能
756- return NULL;
757- }
758- int sz = WideCharToMultiByte(GetACP(),0,tmp.bstrVal,-1,p,MAX_PATH,NULL,NULL);
759- *(p + sz) = 0;
760- p += sz;
761- }
762- *p = 0;
763- return pBuf;
799+
800+ ATL::CString szTmp(tmp.bstrVal);
801+ StringCbCopy(p, needsize, szTmp);
802+ int len = szTmp.GetLength() + 1;
803+ p += len;
804+ needsize -= len;
764805 }
765- return NULL;
806+ *p = 0; // ダブルヌル終端
807+ return true;
766808 }
767809
768810 STDMETHODIMP CShell::EmptyRecycleBin(VARIANT dir)
769811 {
770- CComVariant varDir;
771- LPCSTR pTarget = NULL;
772- CHAR szPath[MAX_PATH];
773- if(dir.vt == VT_NULL || dir.vt == VT_ERROR || dir.vt == VT_EMPTY){
812+ LPCTSTR pTarget = NULL;
813+
814+ if (dir.vt == VT_NULL || dir.vt == VT_ERROR || dir.vt == VT_EMPTY) {
774815 // すべて対象とする
775816 pTarget = NULL;
776817 }
777- if(varDir.ChangeType(VT_BSTR,&dir) == S_OK){
778- // 特定のドライブをターゲットする
779- WideCharToMultiByte(GetACP(),0,varDir.bstrVal,-1,szPath,MAX_PATH,NULL,NULL);
780- pTarget = szPath;
781- }
782- else{
783- // 変換不可
784- return DISP_E_TYPEMISMATCH;
818+ else {
819+ ATL::CString szPath;
820+ CComVariant varDir;
821+ if (varDir.ChangeType(VT_BSTR, &dir) == S_OK) {
822+ // 特定のドライブをターゲットする
823+ szPath = varDir.bstrVal;
824+ if (!szPath.IsEmpty()) {
825+ // 空文字でなければ
826+ pTarget = szPath;
827+ }
828+ }
829+ else {
830+ // 変換不可
831+ return DISP_E_TYPEMISMATCH;
832+ }
785833 }
786- SHEmptyRecycleBin(NULL,pTarget,(m_bConfirm?0:SHERB_NOCONFIRMATION) | (m_bSilent?(SHERB_NOPROGRESSUI|SHERB_NOSOUND ):0));
834+
835+ SHEmptyRecycleBin(NULL, pTarget, (m_bConfirm?0:SHERB_NOCONFIRMATION) | (m_bSilent?(SHERB_NOPROGRESSUI|SHERB_NOSOUND) : 0));
787836 return S_OK;
788837 }
789838
790839 STDMETHODIMP CShell::RecentDocs(VARIANT text)
791840 {
792- CComVariant varText;
793- LPCSTR pTarget = NULL;
794- CHAR szPath[MAX_PATH];
841+ LPCTSTR pTarget = NULL;
842+
795843 if(text.vt == VT_NULL || text.vt == VT_ERROR || text.vt == VT_EMPTY){
796844 // 履歴をクリアする
797845 pTarget = NULL;
798846 }
799- if(varText.ChangeType(VT_BSTR,&text) == S_OK){
800- // 特定のファイルを追加する
801- WideCharToMultiByte(GetACP(),0,varText.bstrVal,-1,szPath,MAX_PATH,NULL,NULL);
802- pTarget = szPath;
803- }
804- else{
805- // 変換不可
806- return DISP_E_TYPEMISMATCH;
847+ else {
848+ ATL::CString szPath;
849+ CComVariant varText;
850+ if (varText.ChangeType(VT_BSTR, &text) == S_OK){
851+ // 特定のファイルを追加する
852+ szPath = text.bstrVal;
853+ if (!szPath.IsEmpty()) {
854+ // 空文字でなければ
855+ pTarget = szPath;
856+ }
857+ }
858+ else{
859+ // 変換不可
860+ return DISP_E_TYPEMISMATCH;
861+ }
807862 }
808- SHAddToRecentDocs(SHARD_PATH,pTarget);
863+ SHAddToRecentDocs(SHARD_PATH, pTarget);
809864 return S_OK;
810865 }
811866
@@ -818,8 +873,8 @@ STDMETHODIMP CShell::SetMainWindow(VARIANT varUnk)
818873 }
819874 // インターフェイスの取得
820875 CComVariant tmp;
821- if(tmp.ChangeType(VT_UNKNOWN,&varUnk) == S_OK){
822- if(tmp.punkVal->QueryInterface(IID_IOverlappedWindow,(void**)&m_pMainWindow) == S_OK){
876+ if (tmp.ChangeType(VT_UNKNOWN, &varUnk) == S_OK) {
877+ if (tmp.punkVal->QueryInterface(IID_IOverlappedWindow, (void**)&m_pMainWindow) == S_OK) {
823878 return S_OK;
824879 }
825880 }
@@ -828,18 +883,23 @@ STDMETHODIMP CShell::SetMainWindow(VARIANT varUnk)
828883
829884 STDMETHODIMP CShell::IsExist(VARIANT name, VARIANT *pVal)
830885 {
831- CComVariant varName,varRet;
832- if(varName.ChangeType(VT_BSTR,&name) != S_OK){
886+ CComVariant varRet;
887+
888+ CComVariant varName;
889+ if (varName.ChangeType(VT_BSTR, &name) != S_OK){
833890 return DISP_E_TYPEMISMATCH;
834891 }
835- CHAR szPath[MAX_PATH];
836- WideCharToMultiByte(GetACP(),0,varName.bstrVal,-1,szPath,MAX_PATH,NULL,NULL);
892+
893+ ATL::CString szPath(varName.bstrVal);
894+
837895 DWORD attr = GetFileAttributes(szPath);
838- if(attr != (DWORD)-1){
839- if(attr & FILE_ATTRIBUTE_DIRECTORY)
896+ if (attr != (DWORD) -1) {
897+ if (attr & FILE_ATTRIBUTE_DIRECTORY) {
840898 varRet = 2;
841- else
899+ }
900+ else {
842901 varRet = 1;
902+ }
843903 }
844904 varRet.Detach(pVal);
845905 return S_OK;
--- a/Shell.h
+++ b/Shell.h
@@ -5,6 +5,8 @@
55
66 #include "resource.h" // メイン シンボル
77
8+#include <vector>
9+
810 /////////////////////////////////////////////////////////////////////////////
911 // CShell
1012 class ATL_NO_VTABLE CShell :
@@ -62,7 +64,7 @@ public:
6264 BOOL m_bSilent;
6365 BOOL m_bConfirm;
6466 HRESULT FileOperationCore(UINT wFunc,FILEOP_FLAGS flag,VARIANT* from,VARIANT* to,VARIANT* pResult);
65- LPSTR CreateDNStringFromVariant(VARIANT& from);
67+ bool CreateDNStringFromVariant(VARIANT& from, std::vector<TCHAR> &buf);
6668 STDMETHOD(get_Silent)(/*[out, retval]*/ BOOL *pVal);
6769 STDMETHOD(put_Silent)(/*[in]*/ BOOL newVal);
6870 STDMETHOD(get_Confirm)(/*[out, retval]*/ BOOL *pVal);
@@ -162,7 +164,7 @@ public:
162164 STDMETHOD(put_FileName)(/*[in]*/ BSTR newVal);
163165 STDMETHOD(get_PathName)(/*[out, retval]*/ BSTR *pVal);
164166 STDMETHOD(put_PathName)(/*[in]*/ BSTR newVal);
165- _bstr_t m_bstr_path;
167+ CComBSTR m_bstr_path;
166168 };
167169
168170 #endif //__SHELL_H_
--- a/StdAfx.h
+++ b/StdAfx.h
@@ -21,13 +21,16 @@
2121 extern CComModule _Module;
2222 #include <atlcom.h>
2323 #include <atlctl.h>
24+#include <atlstr.h>
2425 #include <comdef.h>
2526
2627 #include <shlobj.h>
2728 #include <winspool.h>
2829
29-#define WM_MOVENEXT_OVERLAPPED (WM_USER+100)
30-#define WM_KEYDOWN_EX (WM_USER+101)
30+#include <Strsafe.h>
31+
32+#define WM_MOVENEXT_OVERLAPPED (WM_USER + 100)
33+#define WM_KEYDOWN_EX (WM_USER + 101)
3134
3235 //{{AFX_INSERT_LOCATION}}
3336 // Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
--- a/TreeItem.cpp
+++ b/TreeItem.cpp
@@ -62,36 +62,37 @@ BOOL CTreeItem::DeleteTreeItemWithData(HWND hWnd,HTREEITEM hItem)
6262 return true;
6363 }
6464
65-void CTreeItem::CreateTreeItem(HWND hWnd, HTREEITEM hParent, LPCSTR text, IUnknown **punkVal)
65+void CTreeItem::CreateTreeItem(HWND hWnd, HTREEITEM hParent, LPCTSTR text, IUnknown **punkVal)
6666 {
6767 // アイテムが保有する連想配列を生成する
6868 IUnknown* pUnk = NULL;
6969 CComObject<CObjectMap>* pMap = NULL;
70- if(pMap->CreateInstance(&pMap) == S_OK){
71- pMap->QueryInterface(IID_IUnknown,(void**)&pUnk);
70+ if (pMap->CreateInstance(&pMap) == S_OK) {
71+ pMap->QueryInterface(IID_IUnknown, (void**)&pUnk);
7272 }
7373 // 挿入するアイテムの定義
74+ ATL::CString tmp(text);
7475 TVINSERTSTRUCT is = { 0 };
7576 is.hParent = hParent;
7677 is.hInsertAfter = TVI_LAST;
7778 is.item.mask = TVIF_TEXT | TVIF_PARAM;
78- is.item.pszText = (LPSTR)text;
79- is.item.cchTextMax = lstrlen(text);
79+ is.item.pszText = tmp.GetBuffer();
80+ is.item.cchTextMax = tmp.GetLength();
8081 is.item.lParam = (LPARAM)pUnk;
8182
82- HTREEITEM hNewItem = TreeView_InsertItem(hWnd,&is);
83- if(hNewItem){
83+ HTREEITEM hNewItem = TreeView_InsertItem(hWnd, &is);
84+ if (hNewItem) {
8485 // アイテムへのオブジェクトを作成する
8586 CComObject<CTreeItem>* pItem = NULL;
86- if(pItem->CreateInstance(&pItem) == S_OK){
87- pItem->SetParam(hWnd,hNewItem);
88- pItem->QueryInterface(IID_IUnknown,(void**)punkVal);
87+ if (pItem->CreateInstance(&pItem) == S_OK) {
88+ pItem->SetParam(hWnd, hNewItem);
89+ pItem->QueryInterface(IID_IUnknown, (void**)punkVal);
8990 }
9091 }
9192 }
9293
9394 STDMETHODIMP CTreeItem::IsValid(BOOL *pResult)
9495 {
95- *pResult = (m_hItem != NULL)?VB_TRUE:VB_FALSE;
96+ *pResult = (m_hItem != NULL) ? VB_TRUE : VB_FALSE;
9697 return S_OK;
9798 }
--- a/TreeItem.h
+++ b/TreeItem.h
@@ -37,7 +37,7 @@ END_COM_MAP()
3737 // ITreeItem
3838 public:
3939 STDMETHOD(IsValid)(/*[out,retval]*/BOOL* pResult);
40- static void CreateTreeItem(HWND hWnd,HTREEITEM hParent,LPCSTR text,IUnknown** punkVal);
40+ static void CreateTreeItem(HWND hWnd,HTREEITEM hParent, LPCTSTR text, IUnknown** punkVal);
4141 STDMETHOD(Sort)()
4242 {
4343 HRESULT ret = InitialCheck();
@@ -103,22 +103,23 @@ public:
103103 // アイテムの作成
104104 *punkVal = NULL;
105105 HRESULT ret = InitialCheck();
106- if(ret == S_OK){
107- if(m_hItem){
108- CHAR mes[MAX_PATH];
109- CComVariant str;
110- if(str.ChangeType(VT_BSTR,&text) == S_OK){
111- int cnt = WideCharToMultiByte(GetACP(),0,str.bstrVal,-1,mes,MAX_PATH,NULL,NULL);
112- CreateTreeItem(m_hWnd,m_hItem,mes,punkVal);
113- }
114- }
115- else{
116- // 不正なアイテムを参照している
117- ret = DISP_E_EXCEPTION;
106+ if (FAILED(ret)) {
107+ return ret;
108+ }
109+
110+ if (m_hItem) {
111+ CComVariant str;
112+ ATL::CString mes(_TEXT(""));
113+ if (str.ChangeType(VT_BSTR, &text) == S_OK) {
114+ mes = str.bstrVal;
118115 }
116+ CreateTreeItem(m_hWnd, m_hItem, mes, punkVal);
117+ return S_OK;
119118 }
120- return ret;
119+ // 不正なアイテムを参照している
120+ return DISP_E_EXCEPTION;
121121 }
122+
122123 STDMETHOD(get_Object)(/*[in,optional]*/VARIANT idx, /*[out, retval]*/ VARIANT *pVal)
123124 {
124125 // アイテムに関連付けられた連想配列オブジェクトを取得する
@@ -151,49 +152,51 @@ public:
151152 ErrorInfo(IDS_ERR_TREEERROR);
152153 return DISP_E_EXCEPTION;
153154 }
155+
154156 STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal)
155157 {
156158 // テキストの取得
157159 HRESULT ret = InitialCheck();
158- if(!m_hItem){
160+ if (!m_hItem) {
159161 // 不正なアイテムを参照している
160162 ret = DISP_E_EXCEPTION;
161163 }
162- if(ret == S_OK){
163- CHAR text[MAX_PATH];
164+
165+ if (ret == S_OK) {
166+ TCHAR text[MAX_PATH] = { 0 };
164167 TVITEM itm = {0};
165168 itm.mask = TVIF_TEXT;
166169 itm.hItem = m_hItem;
167170 itm.pszText = text;
168171 itm.cchTextMax = MAX_PATH;
169- if(TreeView_GetItem(m_hWnd,&itm)){
170- WCHAR wMes[MAX_PATH] = {0};
171- MultiByteToWideChar(GetACP(),0,text,-1,wMes,MAX_PATH);
172- *pVal = SysAllocString(wMes);
172+ if (TreeView_GetItem(m_hWnd,&itm)) {
173+ CComBSTR ret(text);
174+ *pVal = ret.Detach();
173175 }
174176 }
175177 return ret;
176178 }
179+
177180 STDMETHOD(put_Text)(/*[in]*/ BSTR newVal)
178181 {
179182 // テキストの書き換え
180183 HRESULT ret = InitialCheck();
181- if(!m_hItem){
184+ if (!m_hItem) {
182185 // 不正なアイテムを参照している
183186 ret = DISP_E_EXCEPTION;
184187 }
185- if(ret == S_OK){
186- CHAR text[MAX_PATH] = {0};
188+ if (ret == S_OK) {
189+ ATL::CString tmp(newVal);
187190 TVITEM itm = {0};
188191 itm.mask = TVIF_TEXT;
189192 itm.hItem = m_hItem;
190- itm.pszText = text;
191- itm.cchTextMax = MAX_PATH;
192- WideCharToMultiByte(GetACP(),0,newVal,-1,text,MAX_PATH,NULL,NULL);
193- TreeView_SetItem(m_hWnd,&itm);
193+ itm.pszText = tmp.GetBuffer();
194+ itm.cchTextMax = tmp.GetLength(); // Setの場合は無視される
195+ TreeView_SetItem(m_hWnd, &itm);
194196 }
195197 return ret;
196198 }
199+
197200 STDMETHOD(get_PrevItem)(/*[out, retval]*/ IUnknown* *pVal)
198201 {
199202 // 前のアイテム
--- a/generic.cpp
+++ b/generic.cpp
@@ -6,11 +6,10 @@ void ErrorInfo(int nMessageID)
66 {
77 ICreateErrorInfo *pCErrInfo;
88 if(CreateErrorInfo(&pCErrInfo) == S_OK){
9- WCHAR wmes[MAX_PATH];
10- CHAR mes[MAX_PATH];
11- if(LoadString(_Module.m_hInst,nMessageID,mes,MAX_PATH)){
12- MultiByteToWideChar(GetACP(),0,mes,-1,wmes,MAX_PATH);
13- pCErrInfo->SetDescription(wmes);
9+ TCHAR mes[MAX_PATH];
10+ if (LoadString(_Module.m_hInst, nMessageID, mes, MAX_PATH)) {
11+ CComBSTR tmp(mes);
12+ pCErrInfo->SetDescription((LPOLESTR) tmp);
1413 pCErrInfo->SetGUID(IID_IOverlappedWindow);
1514 pCErrInfo->SetSource(L"SeraphyScriptTools");
1615 IErrorInfo* perrinfo;
Show on old repository browser