source: dev/ProjectEditor/ExtensionLink.cpp@ 7

Last change on this file since 7 was 3, checked in by dai_9181, 18 years ago
File size: 18.0 KB
Line 
1#include "common.h"
2
3
4#ifndef ListView_SetCheckState
5 #define ListView_SetCheckState(hwndLV, i, fCheck) \
6 ListView_SetItemState(hwndLV, i, \
7 INDEXTOSTATEIMAGEMASK((fCheck)+1), LVIS_STATEIMAGEMASK)
8#endif
9
10
11
12COneExt::COneExt(BOOL bReg,char *lpszExtension,char *lpszNote,BOOL bWindowsSearch,COLORREF tab_color){
13 m_bReg=bReg;
14 lstrcpy(m_szExtension,lpszExtension);
15 lstrcpy(m_szNote,lpszNote);
16 m_bWindowsSearch=bWindowsSearch;
17 TabColor=tab_color;
18}
19COneExt::~COneExt(){
20}
21
22CExtLink::CExtLink(){
23 ppobj_ExtItems=(COneExt **)malloc(1);
24 iExtItemNum=0;
25}
26CExtLink::~CExtLink(){
27 int i;
28 for(i=0;i<iExtItemNum;i++){
29 delete ppobj_ExtItems[i];
30 }
31 free(ppobj_ExtItems);
32 ppobj_ExtItems=0;
33}
34
35void CExtLink::load(char *path){
36 char *buffer;
37 buffer=ReadBuffer_NonErrMsg(path);
38 if(buffer){
39 int i=0;
40 char temporary[64],temp2[255],temp3[64],temp4[64];
41 while(1){
42 //関連付けをおこなうかどうかのチェック
43 BOOL bReg;
44 i=GetOneParameter(buffer,i,temporary);
45 if(temporary[0]=='\0') break;
46 bReg=atoi(temporary);
47
48 //拡張子
49 i=GetOneParameter(buffer,i,temporary);
50 if(temporary[0]=='\0') break;
51
52 //説明
53 i=GetOneParameter(buffer,i,temp2);
54 if(temp2[0]=='\0') break;
55
56 //Windows検索
57 i=GetOneParameter(buffer,i,temp3);
58 if(temp3[0]=='\0') break;
59
60 //タブの色
61 i=GetOneParameter(buffer,i,temp4);
62 if(temp4[0]=='\0') break;
63
64 DWORD dwColor;
65 sscanf(temp4,"%x",&dwColor);
66
67 add(bReg,temporary,temp2,atoi(temp3),(COLORREF)dwColor);
68
69 if(buffer[i]=='\r'&&buffer[i+1]=='\n'){
70 i+=2;
71 }
72 else break;
73 }
74
75 HeapDefaultFree(buffer);
76 }
77 else{
78 //デフォルト値をセット
79 SetInitData();
80 }
81}
82void CExtLink::save(char *path){
83 int i;
84 char buffer[8192];
85 buffer[0]=0;
86 for(i=0;i<iExtItemNum;i++){
87 sprintf(buffer+lstrlen(buffer),"%d,%s,%s,%d,%x\r\n",
88 ppobj_ExtItems[i]->m_bReg,
89 ppobj_ExtItems[i]->m_szExtension,
90 ppobj_ExtItems[i]->m_szNote,
91 ppobj_ExtItems[i]->m_bWindowsSearch,
92 ppobj_ExtItems[i]->TabColor);
93 }
94
95 //保存
96 WriteBuffer(path,buffer,lstrlen(buffer));
97}
98
99BOOL CExtLink::add(BOOL bReg,char *lpszExtension,char *lpszNote,BOOL bWindowsSearch,COLORREF tab_color){
100 //重複チェック
101 int i;
102 for(i=0;i<iExtItemNum;i++){
103 if(lstrcmpi(ppobj_ExtItems[i]->m_szExtension,lpszExtension)==0){
104 return 0;
105 }
106 }
107
108 ppobj_ExtItems=(COneExt **)realloc(ppobj_ExtItems,(iExtItemNum+1)*sizeof(COneExt*));
109 ppobj_ExtItems[iExtItemNum]=new COneExt(bReg,lpszExtension,lpszNote,bWindowsSearch,tab_color);
110 iExtItemNum++;
111
112 return 1;
113}
114void CExtLink::del(char *lpszExtension){
115 int i;
116 for(i=0;i<iExtItemNum;i++){
117 if(lstrcmpi(lpszExtension,ppobj_ExtItems[i]->m_szExtension)==0)
118 break;
119 }
120 if(i==iExtItemNum) return;
121
122 delete ppobj_ExtItems[i];
123
124 iExtItemNum--;
125 for(;i<iExtItemNum;i++){
126 ppobj_ExtItems[i]=ppobj_ExtItems[i+1];
127 }
128}
129
130void CExtLink::SetInitData(void){
131 ///////////////////////////////////
132 // 初期立ち上げ時用の値をセット
133 ///////////////////////////////////
134
135#ifdef THETEXT
136 add(1,"txt","テキスト ドキュメント",1,TABCOLOR_GRAY);
137 add(0,"htm","HTML ドキュメント",1,TABCOLOR_BLUE);
138 add(0,"html","HTML ドキュメント",1,TABCOLOR_BLUE);
139 add(1,"cgi","CGI ドキュメント",1,TABCOLOR_GREEN);
140 add(1,"pl","Perl ドキュメント",1,TABCOLOR_GREEN);
141 add(1,"php","PHP ドキュメント",1,TABCOLOR_RED);
142 add(1,"tpl","テンプレート ドキュメント",1,TABCOLOR_YELLOW);
143#else
144 add(1,"ab","Basic ソースコード",1,TABCOLOR_BLUE);
145 add(1,"abp","Basic ソースコード",1,TABCOLOR_BLUE);
146 add(1,"bas","Basic ソースコード",1,TABCOLOR_BLUE);
147 add(1,"sbp","サブソースコード",1,TABCOLOR_GREEN);
148 add(1,"pj","ActiveBasic プロジェクト ドキュメント",0,TABCOLOR_GRAY);
149#endif
150}
151
152void CExtLink::ResetListView(HWND hListView){
153 ListView_DeleteAllItems(hListView);
154
155 int i;
156 for(i=0; i < pobj_nv->pobj_ExtLink->iExtItemNum; i++){
157 LV_ITEM item;
158
159 //拡張子
160 item.mask=LVIF_TEXT;
161 item.pszText=ppobj_ExtItems[i]->m_szExtension;
162 item.iItem=i;
163 item.iSubItem=0;
164 ListView_InsertItem(hListView,&item);
165
166 //説明
167 item.pszText=ppobj_ExtItems[i]->m_szNote;
168 item.iItem=i;
169 item.iSubItem++;
170 ListView_SetItem(hListView,&item);
171
172 //Windows検索
173 if(ppobj_ExtItems[i]->m_bWindowsSearch)
174 item.pszText="有効";
175 else item.pszText="無効";
176 item.iItem=i;
177 item.iSubItem++;
178 ListView_SetItem(hListView,&item);
179
180 if(bProfessional){
181 //タブの色
182 //※有料版のみ
183 if(ppobj_ExtItems[i]->TabColor==TABCOLOR_GRAY) item.pszText="灰色";
184 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_WHITE) item.pszText="白";
185 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_RED) item.pszText="赤";
186 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_GREEN) item.pszText="緑";
187 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_BLUE) item.pszText="青";
188 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_YELLOW) item.pszText="黄色";
189 else item.pszText="ユーザー設定";
190 item.iItem=i;
191 item.iSubItem++;
192 ListView_SetItem(hListView,&item);
193 }
194
195 //チェックマーク
196 ListView_SetCheckState(hListView,i,ppobj_ExtItems[i]->m_bReg);
197 }
198}
199
200COLORREF CExtLink::GetTabColorFromFilePath(char *path){
201 if(bProfessional){
202 //拡張子を識別し、タブの色を決定
203 //※有料版のみ
204 char szExt[255],*lpszTemp;
205 _splitpath(path,NULL,NULL,NULL,szExt);
206 if(szExt[0]=='.') lpszTemp=szExt+1;
207 else lpszTemp=szExt;
208 for(int i=0;i<iExtItemNum;i++){
209 if(lstrcmpi(lpszTemp,ppobj_ExtItems[i]->m_szExtension)==0){
210 return ppobj_ExtItems[i]->TabColor;
211 }
212 }
213 }
214 return TABCOLOR_GRAY;
215}
216
217
218BOOL CALLBACK DlgFileLinkAdd(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
219 static COneExt *pobj_OneExt;
220
221 static int TabColor;
222 switch(message){
223 case WM_INITDIALOG:
224 if(lParam){
225 pobj_OneExt=(COneExt *)lParam;
226
227 SetDlgItemText(hwnd,IDC_EXTENSION,pobj_OneExt->m_szExtension);
228 SetDlgItemText(hwnd,IDC_NOTE,pobj_OneExt->m_szNote);
229 TabColor=pobj_OneExt->TabColor;
230
231 if(pobj_OneExt->m_bWindowsSearch)
232 SendDlgItemMessage(hwnd,IDC_SEARCH_ON,BM_SETCHECK,BST_CHECKED,0);
233 else
234 SendDlgItemMessage(hwnd,IDC_SEARCH_OFF,BM_SETCHECK,BST_CHECKED,0);
235
236 EnableWindow(GetDlgItem(hwnd,IDC_EXTENSION),0);
237
238 SetFocus(GetDlgItem(hwnd,IDC_NOTE));
239 }
240 else{
241 pobj_OneExt=0;
242 TabColor=TABCOLOR_GRAY;
243
244 SendDlgItemMessage(hwnd,IDC_SEARCH_ON,BM_SETCHECK,BST_CHECKED,0);
245
246 SetFocus(GetDlgItem(hwnd,IDC_EXTENSION));
247 }
248
249 if(!bProfessional){
250 //フリー版の場合は、タブの色設定を排除する
251 ShowWindow(GetDlgItem(hwnd,IDC_STATIC_TABCOLOR),SW_HIDE);
252 ShowWindow(GetDlgItem(hwnd,IDC_STATIC_TABCOLOR2),SW_HIDE);
253 ShowWindow(GetDlgItem(hwnd,IDC_COLOR_BUTTON),SW_HIDE);
254 }
255
256 SendMessage(hwnd,WM_COMMAND,IDC_EXTENSION,0);
257
258 break;
259 case WM_DRAWITEM:
260 LPDRAWITEMSTRUCT pds;
261 pds=(LPDRAWITEMSTRUCT)lParam;
262
263 HBRUSH hBrush,hOldBrush;
264
265 if(wParam==IDC_COLOR_BUTTON){
266 //////////////
267 // 色を描画
268 //////////////
269
270 //ペンとブラシを生成
271 HPEN hPen,hOldPen;
272 hPen=(HPEN)GetStockObject(WHITE_PEN);
273 hBrush=CreateSolidBrush(TabColor);
274
275 //塗りつぶす
276 hOldPen=(HPEN)SelectObject(pds->hDC,hPen);
277 hOldBrush=(HBRUSH)SelectObject(pds->hDC,hBrush);
278 Rectangle(pds->hDC,0,0,pds->rcItem.right,pds->rcItem.bottom);
279 SelectObject(pds->hDC,hOldPen);
280 SelectObject(pds->hDC,hOldBrush);
281
282 //ブラシを破棄
283 DeleteObject(hBrush);
284 }
285 return 1;
286 case WM_COMMAND:
287 switch(LOWORD(wParam)){
288 case IDOK:
289 char szExtension[64];
290 GetDlgItemText(hwnd,IDC_EXTENSION,szExtension,64);
291
292 char szNote[255];
293 GetDlgItemText(hwnd,IDC_NOTE,szNote,255);
294
295 BOOL bWindowsSearch;
296 if(SendDlgItemMessage(hwnd,IDC_SEARCH_ON,BM_GETCHECK,0,0))
297 bWindowsSearch=1;
298 else bWindowsSearch=0;
299
300 if(pobj_OneExt){
301 //変更
302 lstrcpy(pobj_OneExt->m_szNote,szNote);
303 pobj_OneExt->m_bWindowsSearch=bWindowsSearch;
304 pobj_OneExt->TabColor=TabColor;
305 }
306 else{
307 //追加
308 if(!pobj_nv->pobj_ExtLink->add(1,szExtension,szNote,bWindowsSearch,TabColor)){
309 char temporary[255];
310 sprintf(temporary,"拡張子 %s は既にリストに存在します。",szExtension);
311 MessageBox(hwnd,temporary,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
312
313 return 1;
314 }
315 }
316
317 EndDialog(hwnd,1);
318 return 1;
319 case IDCANCEL:
320 EndDialog(hwnd,0);
321 return 1;
322 case IDC_COLOR_BUTTON:
323 POINT pos;
324 GetCursorPos(&pos);
325 extern HMENU hTabColorMenu;
326 TrackPopupMenu(hTabColorMenu,TPM_LEFTALIGN,pos.x,pos.y,0,hwnd,0);
327 return 1;
328
329 case IDC_EXTENSION:
330 if(GetWindowTextLength(GetDlgItem(hwnd,IDC_EXTENSION)))
331 EnableWindow(GetDlgItem(hwnd,IDOK),1);
332 else
333 EnableWindow(GetDlgItem(hwnd,IDOK),0);
334 return 1;
335
336 case IDM_USER_COLOR:
337 COLORREF colorUser;
338 colorUser=TabColor;
339 {
340 CHOOSECOLOR cc;
341 COLORREF CusColors[16]={
342 RGB(255,255,255),
343 RGB(0,0,0),
344 RGB(128,128,128),
345 RGB(192,192,192),
346 RGB(128,0,0),
347 RGB(255,0,0),
348 RGB(128,128,0),
349 RGB(255,255,0),
350 RGB(0,128,0),
351 RGB(0,255,0),
352 RGB(0,128,128),
353 RGB(0,255,255),
354 RGB(0,0,128),
355 RGB(0,0,255),
356 RGB(128,0,128),
357 RGB(255,0,255)};
358 cc.lStructSize=sizeof(CHOOSECOLOR);
359 cc.hwndOwner=hwnd;
360 cc.rgbResult=colorUser;
361 cc.lpCustColors=CusColors;
362 cc.Flags=CC_RGBINIT|CC_FULLOPEN;
363 if(!ChooseColor(&cc)){
364 return 0;
365 }
366 colorUser=cc.rgbResult;
367 }
368 case IDM_GRAY:
369 case IDM_WHITE:
370 case IDM_RED:
371 case IDM_GREEN:
372 case IDM_BLUE:
373 case IDM_YELLOW:
374 if(LOWORD(wParam)==IDM_GRAY) TabColor=TABCOLOR_GRAY;
375 if(LOWORD(wParam)==IDM_WHITE) TabColor=TABCOLOR_WHITE;
376 if(LOWORD(wParam)==IDM_RED) TabColor=TABCOLOR_RED;
377 if(LOWORD(wParam)==IDM_GREEN) TabColor=TABCOLOR_GREEN;
378 if(LOWORD(wParam)==IDM_BLUE) TabColor=TABCOLOR_BLUE;
379 if(LOWORD(wParam)==IDM_YELLOW) TabColor=TABCOLOR_YELLOW;
380 if(LOWORD(wParam)==IDM_USER_COLOR) TabColor=colorUser;
381 InvalidateRect(GetDlgItem(hwnd,IDC_COLOR_BUTTON),NULL,0);
382 return 1;
383 }
384 break;
385 }
386 return 0;
387}
388
389BOOL CALLBACK DlgLinkFile(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
390 int i;
391 HWND hListView;
392 char temporary[255];
393 switch(message){
394 case WM_INITDIALOG:
395 SetPosCenter(hwnd);
396
397
398
399 ///////////////////////////
400 // カラムの設定
401 ///////////////////////////
402
403 //拡張スタイル
404 DWORD dwStyle;
405 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
406 dwStyle=ListView_GetExtendedListViewStyle(hListView);
407 dwStyle|=LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES;
408 ListView_SetExtendedListViewStyle(hListView,dwStyle);
409
410 LV_COLUMN ListView_Column;
411 ListView_Column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
412 ListView_Column.fmt=LVCFMT_LEFT;
413
414 ListView_Column.cx=50;
415 ListView_Column.pszText="拡張子";
416 ListView_Column.iSubItem=0;
417 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
418
419 ListView_Column.cx=150;
420 ListView_Column.pszText="説明";
421 ListView_Column.iSubItem++;
422 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
423
424 ListView_Column.cx=90;
425 ListView_Column.pszText="Windows検索";
426 ListView_Column.iSubItem++;
427 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
428
429 if(bProfessional){
430 //Pro版のみタブの色を表示
431 ListView_Column.cx=80;
432 ListView_Column.pszText="タブの色";
433 ListView_Column.iSubItem++;
434 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
435 }
436
437
438 pobj_nv->pobj_ExtLink->ResetListView(hListView);
439 break;
440 case WM_COMMAND:
441 switch(LOWORD(wParam)){
442 case IDC_ADD_BUTTON:
443 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_EXTENSION_ADD),hwnd,DlgFileLinkAdd,0)) return 1;
444
445 pobj_nv->pobj_ExtLink->ResetListView(GetDlgItem(hwnd,IDC_EXTENSION_LIST));
446
447 return 1;
448 case IDC_EDIT_BUTTON:
449 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
450
451 for(i=0;i<ListView_GetItemCount(hListView);i++){
452 if(ListView_GetItemState(hListView,i,LVIS_SELECTED)){
453 break;
454 }
455 }
456 if(i==ListView_GetItemCount(hListView)) return 1;
457
458 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_EXTENSION_ADD),hwnd,DlgFileLinkAdd,(LPARAM)pobj_nv->pobj_ExtLink->ppobj_ExtItems[i])) return 1;
459
460 pobj_nv->pobj_ExtLink->ResetListView(GetDlgItem(hwnd,IDC_EXTENSION_LIST));
461
462 return 1;
463 case IDC_DELETE_BUTTON:
464 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
465
466 for(i=0;i<ListView_GetItemCount(hListView);i++){
467 if(ListView_GetItemState(hListView,i,LVIS_SELECTED)){
468 ListView_GetItemText(hListView,i,0,temporary,255);
469
470 char temp2[255];
471 sprintf(temp2,"%s をリストから削除します。",temporary);
472 if(MessageBox(hwnd,temp2,APPLICATION_NAME,MB_OKCANCEL)==IDCANCEL) return 1;
473
474 ListView_DeleteItem(hListView,i);
475
476 pobj_nv->pobj_ExtLink->del(temporary);
477 break;
478 }
479 }
480 return 1;
481 case IDOK:
482 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
483
484 for(i=0;i<ListView_GetItemCount(hListView);i++){
485 pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bReg=ListView_GetCheckState(hListView,i);
486 }
487
488 if(MessageBox(hwnd,"指定された内容で拡張子に関するレジストリキーを登録します。よろしいですか?",APPLICATION_NAME,MB_YESNO)==IDNO)
489 return 1;
490
491 EndDialog(hwnd,1);
492 return 1;
493 case IDCANCEL:
494 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
495
496 for(i=0;i<ListView_GetItemCount(hListView);i++){
497 pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bReg=ListView_GetCheckState(hListView,i);
498 }
499 EndDialog(hwnd,0);
500 return 1;
501 }
502 break;
503 case WM_NOTIFY:
504 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
505
506 NMHDR *hdr;
507 hdr=(NMHDR *)lParam;
508 if(hdr->hwndFrom==hListView&&hdr->code==NM_DBLCLK){
509 SendMessage(hwnd,WM_COMMAND,IDC_EDIT_BUTTON,0);
510 }
511 break;
512 }
513 return 0;
514}
515
516HKEY ClassRoot_CreateKey(char *path,char *lpszData){
517 HKEY hKey;
518 RegCreateKeyEx(HKEY_CLASSES_ROOT,path,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
519 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)lpszData,lstrlen(lpszData));
520 return hKey;
521}
522void ExtensionLink(HWND hwnd){
523 int i;
524 HKEY hKey;
525
526 //初期状態の重複起動で関連付けを作動しないようにする
527 pobj_nv->save();
528
529 if(DialogBox(hResInst,MAKEINTRESOURCE(IDD_EXTENSION_LINK),hwnd,DlgLinkFile)==0) return;
530
531 char szApplicationPath[MAX_PATH];
532 GetModuleFileName(hInst,szApplicationPath,MAX_PATH);
533
534 char temporary[MAX_PATH],temp2[255],temp3[255];
535 for(i=0;i<pobj_nv->pobj_ExtLink->iExtItemNum;i++){
536 if(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bReg==0) continue;
537
538 //「.拡張子」キー
539 sprintf(temp2,".%s",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
540 sprintf(temp3,"%sfile",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
541 hKey=ClassRoot_CreateKey(temp2,temp3);
542
543 sprintf(temp2,"%s file.",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
544 RegSetValueEx(hKey,"Content Type",0,REG_SZ,(const unsigned char *)temp2,lstrlen(temp2));
545
546 RegCloseKey(hKey);
547
548
549 if(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bWindowsSearch){
550 //検索対象に含める
551 sprintf(temporary,".%s\\PersistentHandler",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
552 hKey=ClassRoot_CreateKey(temporary,"{5e941d80-bf96-11cd-b579-08002b30bfeb}");
553 RegCloseKey(hKey);
554 }
555 else{
556 //検索対象に含めない
557 sprintf(temporary,".%s\\PersistentHandler",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
558 RegDeleteKey(HKEY_CLASSES_ROOT,temporary);
559 }
560
561
562 //説明
563 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp3,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
564 RegSetValueEx(hKey,NULL,0,REG_SZ,
565 (const unsigned char *)pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szNote,
566 lstrlen(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szNote));
567 RegCloseKey(hKey);
568
569
570 //アプリケーションパス
571 sprintf(temporary,"\"%s\" \"%%1\"",szApplicationPath);
572 sprintf(temp2,"%s\\shell\\open\\command",temp3);
573 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
574 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
575 RegCloseKey(hKey);
576
577
578#ifndef THETEXT
579 /////////////////////
580 // アイコン設定
581 // ※ProjectEditorのみ
582 /////////////////////
583
584 sprintf(temp2,"%s\\DefaultIcon",temp3);
585 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"bas")==0){
586 sprintf(temporary,"\"%s\",8",szApplicationPath);
587 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
588 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
589 RegCloseKey(hKey);
590 }
591 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"ab")==0||
592 lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"abp")==0){
593 sprintf(temporary,"\"%s\",8",szApplicationPath);
594 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
595 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
596 RegCloseKey(hKey);
597 }
598 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"sbp")==0){
599 sprintf(temporary,"\"%s\",9",szApplicationPath);
600 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
601 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
602 RegCloseKey(hKey);
603 }
604 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"pj")==0){
605 sprintf(temporary,"\"%s\",7",szApplicationPath);
606 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
607 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
608 RegCloseKey(hKey);
609 }
610#endif
611 }
612
613 //アイコンの関連付けを瞬時に反映させる
614 SHChangeNotify( SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL );
615}
Note: See TracBrowser for help on using the repository browser.