source: dev/ProjectEditor/ExtensionLink.cpp@ 55

Last change on this file since 55 was 22, checked in by dai_9181, 18 years ago

バックアップ用ディレクトリが消去されていたときは、自動生成する。
プロ版の概念を除去。機能制限を解除。

File size: 17.6 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 //タブの色
181 if(ppobj_ExtItems[i]->TabColor==TABCOLOR_GRAY) item.pszText="灰色";
182 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_WHITE) item.pszText="白";
183 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_RED) item.pszText="赤";
184 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_GREEN) item.pszText="緑";
185 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_BLUE) item.pszText="青";
186 else if(ppobj_ExtItems[i]->TabColor==TABCOLOR_YELLOW) item.pszText="黄色";
187 else item.pszText="ユーザー設定";
188 item.iItem=i;
189 item.iSubItem++;
190 ListView_SetItem(hListView,&item);
191
192 //チェックマーク
193 ListView_SetCheckState(hListView,i,ppobj_ExtItems[i]->m_bReg);
194 }
195}
196
197COLORREF CExtLink::GetTabColorFromFilePath(char *path){
198 //拡張子を識別し、タブの色を決定
199 char szExt[255],*lpszTemp;
200 _splitpath(path,NULL,NULL,NULL,szExt);
201 if(szExt[0]=='.') lpszTemp=szExt+1;
202 else lpszTemp=szExt;
203 for(int i=0;i<iExtItemNum;i++){
204 if(lstrcmpi(lpszTemp,ppobj_ExtItems[i]->m_szExtension)==0){
205 return ppobj_ExtItems[i]->TabColor;
206 }
207 }
208 return TABCOLOR_GRAY;
209}
210
211
212BOOL CALLBACK DlgFileLinkAdd(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
213 static COneExt *pobj_OneExt;
214
215 static int TabColor;
216 switch(message){
217 case WM_INITDIALOG:
218 if(lParam){
219 pobj_OneExt=(COneExt *)lParam;
220
221 SetDlgItemText(hwnd,IDC_EXTENSION,pobj_OneExt->m_szExtension);
222 SetDlgItemText(hwnd,IDC_NOTE,pobj_OneExt->m_szNote);
223 TabColor=pobj_OneExt->TabColor;
224
225 if(pobj_OneExt->m_bWindowsSearch)
226 SendDlgItemMessage(hwnd,IDC_SEARCH_ON,BM_SETCHECK,BST_CHECKED,0);
227 else
228 SendDlgItemMessage(hwnd,IDC_SEARCH_OFF,BM_SETCHECK,BST_CHECKED,0);
229
230 EnableWindow(GetDlgItem(hwnd,IDC_EXTENSION),0);
231
232 SetFocus(GetDlgItem(hwnd,IDC_NOTE));
233 }
234 else{
235 pobj_OneExt=0;
236 TabColor=TABCOLOR_GRAY;
237
238 SendDlgItemMessage(hwnd,IDC_SEARCH_ON,BM_SETCHECK,BST_CHECKED,0);
239
240 SetFocus(GetDlgItem(hwnd,IDC_EXTENSION));
241 }
242
243 SendMessage(hwnd,WM_COMMAND,IDC_EXTENSION,0);
244
245 break;
246 case WM_DRAWITEM:
247 LPDRAWITEMSTRUCT pds;
248 pds=(LPDRAWITEMSTRUCT)lParam;
249
250 HBRUSH hBrush,hOldBrush;
251
252 if(wParam==IDC_COLOR_BUTTON){
253 //////////////
254 // 色を描画
255 //////////////
256
257 //ペンとブラシを生成
258 HPEN hPen,hOldPen;
259 hPen=(HPEN)GetStockObject(WHITE_PEN);
260 hBrush=CreateSolidBrush(TabColor);
261
262 //塗りつぶす
263 hOldPen=(HPEN)SelectObject(pds->hDC,hPen);
264 hOldBrush=(HBRUSH)SelectObject(pds->hDC,hBrush);
265 Rectangle(pds->hDC,0,0,pds->rcItem.right,pds->rcItem.bottom);
266 SelectObject(pds->hDC,hOldPen);
267 SelectObject(pds->hDC,hOldBrush);
268
269 //ブラシを破棄
270 DeleteObject(hBrush);
271 }
272 return 1;
273 case WM_COMMAND:
274 switch(LOWORD(wParam)){
275 case IDOK:
276 char szExtension[64];
277 GetDlgItemText(hwnd,IDC_EXTENSION,szExtension,64);
278
279 char szNote[255];
280 GetDlgItemText(hwnd,IDC_NOTE,szNote,255);
281
282 BOOL bWindowsSearch;
283 if(SendDlgItemMessage(hwnd,IDC_SEARCH_ON,BM_GETCHECK,0,0))
284 bWindowsSearch=1;
285 else bWindowsSearch=0;
286
287 if(pobj_OneExt){
288 //変更
289 lstrcpy(pobj_OneExt->m_szNote,szNote);
290 pobj_OneExt->m_bWindowsSearch=bWindowsSearch;
291 pobj_OneExt->TabColor=TabColor;
292 }
293 else{
294 //追加
295 if(!pobj_nv->pobj_ExtLink->add(1,szExtension,szNote,bWindowsSearch,TabColor)){
296 char temporary[255];
297 sprintf(temporary,"拡張子 %s は既にリストに存在します。",szExtension);
298 MessageBox(hwnd,temporary,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
299
300 return 1;
301 }
302 }
303
304 EndDialog(hwnd,1);
305 return 1;
306 case IDCANCEL:
307 EndDialog(hwnd,0);
308 return 1;
309 case IDC_COLOR_BUTTON:
310 POINT pos;
311 GetCursorPos(&pos);
312 extern HMENU hTabColorMenu;
313 TrackPopupMenu(hTabColorMenu,TPM_LEFTALIGN,pos.x,pos.y,0,hwnd,0);
314 return 1;
315
316 case IDC_EXTENSION:
317 if(GetWindowTextLength(GetDlgItem(hwnd,IDC_EXTENSION)))
318 EnableWindow(GetDlgItem(hwnd,IDOK),1);
319 else
320 EnableWindow(GetDlgItem(hwnd,IDOK),0);
321 return 1;
322
323 case IDM_USER_COLOR:
324 COLORREF colorUser;
325 colorUser=TabColor;
326 {
327 CHOOSECOLOR cc;
328 COLORREF CusColors[16]={
329 RGB(255,255,255),
330 RGB(0,0,0),
331 RGB(128,128,128),
332 RGB(192,192,192),
333 RGB(128,0,0),
334 RGB(255,0,0),
335 RGB(128,128,0),
336 RGB(255,255,0),
337 RGB(0,128,0),
338 RGB(0,255,0),
339 RGB(0,128,128),
340 RGB(0,255,255),
341 RGB(0,0,128),
342 RGB(0,0,255),
343 RGB(128,0,128),
344 RGB(255,0,255)};
345 cc.lStructSize=sizeof(CHOOSECOLOR);
346 cc.hwndOwner=hwnd;
347 cc.rgbResult=colorUser;
348 cc.lpCustColors=CusColors;
349 cc.Flags=CC_RGBINIT|CC_FULLOPEN;
350 if(!ChooseColor(&cc)){
351 return 0;
352 }
353 colorUser=cc.rgbResult;
354 }
355 case IDM_GRAY:
356 case IDM_WHITE:
357 case IDM_RED:
358 case IDM_GREEN:
359 case IDM_BLUE:
360 case IDM_YELLOW:
361 if(LOWORD(wParam)==IDM_GRAY) TabColor=TABCOLOR_GRAY;
362 if(LOWORD(wParam)==IDM_WHITE) TabColor=TABCOLOR_WHITE;
363 if(LOWORD(wParam)==IDM_RED) TabColor=TABCOLOR_RED;
364 if(LOWORD(wParam)==IDM_GREEN) TabColor=TABCOLOR_GREEN;
365 if(LOWORD(wParam)==IDM_BLUE) TabColor=TABCOLOR_BLUE;
366 if(LOWORD(wParam)==IDM_YELLOW) TabColor=TABCOLOR_YELLOW;
367 if(LOWORD(wParam)==IDM_USER_COLOR) TabColor=colorUser;
368 InvalidateRect(GetDlgItem(hwnd,IDC_COLOR_BUTTON),NULL,0);
369 return 1;
370 }
371 break;
372 }
373 return 0;
374}
375
376BOOL CALLBACK DlgLinkFile(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
377 int i;
378 HWND hListView;
379 char temporary[255];
380 switch(message){
381 case WM_INITDIALOG:
382 SetPosCenter(hwnd);
383
384
385
386 ///////////////////////////
387 // カラムの設定
388 ///////////////////////////
389
390 //拡張スタイル
391 DWORD dwStyle;
392 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
393 dwStyle=ListView_GetExtendedListViewStyle(hListView);
394 dwStyle|=LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES;
395 ListView_SetExtendedListViewStyle(hListView,dwStyle);
396
397 LV_COLUMN ListView_Column;
398 ListView_Column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
399 ListView_Column.fmt=LVCFMT_LEFT;
400
401 ListView_Column.cx=50;
402 ListView_Column.pszText="拡張子";
403 ListView_Column.iSubItem=0;
404 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
405
406 ListView_Column.cx=150;
407 ListView_Column.pszText="説明";
408 ListView_Column.iSubItem++;
409 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
410
411 ListView_Column.cx=90;
412 ListView_Column.pszText="Windows検索";
413 ListView_Column.iSubItem++;
414 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
415
416 ListView_Column.cx=80;
417 ListView_Column.pszText="タブの色";
418 ListView_Column.iSubItem++;
419 ListView_InsertColumn(hListView,ListView_Column.iSubItem,&ListView_Column);
420
421
422 pobj_nv->pobj_ExtLink->ResetListView(hListView);
423 break;
424 case WM_COMMAND:
425 switch(LOWORD(wParam)){
426 case IDC_ADD_BUTTON:
427 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_EXTENSION_ADD),hwnd,DlgFileLinkAdd,0)) return 1;
428
429 pobj_nv->pobj_ExtLink->ResetListView(GetDlgItem(hwnd,IDC_EXTENSION_LIST));
430
431 return 1;
432 case IDC_EDIT_BUTTON:
433 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
434
435 for(i=0;i<ListView_GetItemCount(hListView);i++){
436 if(ListView_GetItemState(hListView,i,LVIS_SELECTED)){
437 break;
438 }
439 }
440 if(i==ListView_GetItemCount(hListView)) return 1;
441
442 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_EXTENSION_ADD),hwnd,DlgFileLinkAdd,(LPARAM)pobj_nv->pobj_ExtLink->ppobj_ExtItems[i])) return 1;
443
444 pobj_nv->pobj_ExtLink->ResetListView(GetDlgItem(hwnd,IDC_EXTENSION_LIST));
445
446 return 1;
447 case IDC_DELETE_BUTTON:
448 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
449
450 for(i=0;i<ListView_GetItemCount(hListView);i++){
451 if(ListView_GetItemState(hListView,i,LVIS_SELECTED)){
452 ListView_GetItemText(hListView,i,0,temporary,255);
453
454 char temp2[255];
455 sprintf(temp2,"%s をリストから削除します。",temporary);
456 if(MessageBox(hwnd,temp2,APPLICATION_NAME,MB_OKCANCEL)==IDCANCEL) return 1;
457
458 ListView_DeleteItem(hListView,i);
459
460 pobj_nv->pobj_ExtLink->del(temporary);
461 break;
462 }
463 }
464 return 1;
465 case IDOK:
466 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
467
468 for(i=0;i<ListView_GetItemCount(hListView);i++){
469 pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bReg=ListView_GetCheckState(hListView,i);
470 }
471
472 if(MessageBox(hwnd,"指定された内容で拡張子に関するレジストリキーを登録します。よろしいですか?",APPLICATION_NAME,MB_YESNO)==IDNO)
473 return 1;
474
475 EndDialog(hwnd,1);
476 return 1;
477 case IDCANCEL:
478 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
479
480 for(i=0;i<ListView_GetItemCount(hListView);i++){
481 pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bReg=ListView_GetCheckState(hListView,i);
482 }
483 EndDialog(hwnd,0);
484 return 1;
485 }
486 break;
487 case WM_NOTIFY:
488 hListView=GetDlgItem(hwnd,IDC_EXTENSION_LIST);
489
490 NMHDR *hdr;
491 hdr=(NMHDR *)lParam;
492 if(hdr->hwndFrom==hListView&&hdr->code==NM_DBLCLK){
493 SendMessage(hwnd,WM_COMMAND,IDC_EDIT_BUTTON,0);
494 }
495 break;
496 }
497 return 0;
498}
499
500HKEY ClassRoot_CreateKey(char *path,char *lpszData){
501 HKEY hKey;
502 RegCreateKeyEx(HKEY_CLASSES_ROOT,path,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
503 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)lpszData,lstrlen(lpszData));
504 return hKey;
505}
506void ExtensionLink(HWND hwnd){
507 int i;
508 HKEY hKey;
509
510 //初期状態の重複起動で関連付けを作動しないようにする
511 pobj_nv->save();
512
513 if(DialogBox(hResInst,MAKEINTRESOURCE(IDD_EXTENSION_LINK),hwnd,DlgLinkFile)==0) return;
514
515 char szApplicationPath[MAX_PATH];
516 GetModuleFileName(hInst,szApplicationPath,MAX_PATH);
517
518 char temporary[MAX_PATH],temp2[255],temp3[255];
519 for(i=0;i<pobj_nv->pobj_ExtLink->iExtItemNum;i++){
520 if(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bReg==0) continue;
521
522 //「.拡張子」キー
523 sprintf(temp2,".%s",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
524 sprintf(temp3,"%sfile",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
525 hKey=ClassRoot_CreateKey(temp2,temp3);
526
527 sprintf(temp2,"%s file.",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
528 RegSetValueEx(hKey,"Content Type",0,REG_SZ,(const unsigned char *)temp2,lstrlen(temp2));
529
530 RegCloseKey(hKey);
531
532
533 if(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_bWindowsSearch){
534 //検索対象に含める
535 sprintf(temporary,".%s\\PersistentHandler",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
536 hKey=ClassRoot_CreateKey(temporary,"{5e941d80-bf96-11cd-b579-08002b30bfeb}");
537 RegCloseKey(hKey);
538 }
539 else{
540 //検索対象に含めない
541 sprintf(temporary,".%s\\PersistentHandler",pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension);
542 RegDeleteKey(HKEY_CLASSES_ROOT,temporary);
543 }
544
545
546 //説明
547 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp3,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
548 RegSetValueEx(hKey,NULL,0,REG_SZ,
549 (const unsigned char *)pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szNote,
550 lstrlen(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szNote));
551 RegCloseKey(hKey);
552
553
554 //アプリケーションパス
555 sprintf(temporary,"\"%s\" \"%%1\"",szApplicationPath);
556 sprintf(temp2,"%s\\shell\\open\\command",temp3);
557 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
558 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
559 RegCloseKey(hKey);
560
561
562#ifndef THETEXT
563 /////////////////////
564 // アイコン設定
565 // ※ProjectEditorのみ
566 /////////////////////
567
568 sprintf(temp2,"%s\\DefaultIcon",temp3);
569 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"bas")==0){
570 sprintf(temporary,"\"%s\",8",szApplicationPath);
571 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
572 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
573 RegCloseKey(hKey);
574 }
575 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"ab")==0||
576 lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"abp")==0){
577 sprintf(temporary,"\"%s\",8",szApplicationPath);
578 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
579 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
580 RegCloseKey(hKey);
581 }
582 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"sbp")==0){
583 sprintf(temporary,"\"%s\",9",szApplicationPath);
584 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
585 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
586 RegCloseKey(hKey);
587 }
588 if(lstrcmpi(pobj_nv->pobj_ExtLink->ppobj_ExtItems[i]->m_szExtension,"pj")==0){
589 sprintf(temporary,"\"%s\",7",szApplicationPath);
590 RegCreateKeyEx(HKEY_CLASSES_ROOT,temp2,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
591 RegSetValueEx(hKey,NULL,0,REG_SZ,(const unsigned char *)temporary,lstrlen(temporary));
592 RegCloseKey(hKey);
593 }
594#endif
595 }
596
597 //アイコンの関連付けを瞬時に反映させる
598 SHChangeNotify( SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL );
599}
Note: See TracBrowser for help on using the repository browser.