source: trunk/dll/assoc.c@ 123

Last change on this file since 123 was 123, checked in by root, 21 years ago

Rework lstrip/rstrip usage

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.5 KB
Line 
1
2/***********************************************************************
3
4 $Id: assoc.c 123 2004-12-05 00:20:19Z root $
5
6 Copyright (c) 1993-98 M. Kimes
7 Copyright (c) 2004 Steven H.Levine
8
9 Revisions 01 Aug 04 SHL Rework lstrip/rstrip usage
10
11***********************************************************************/
12
13#define INCL_DOS
14#define INCL_WIN
15
16#include <os2.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include <ctype.h>
21#include <share.h>
22#include "fm3dll.h"
23#include "fm3dlg.h"
24#include "fm3str.h"
25
26#pragma data_seg(DATA1)
27
28typedef struct {
29 CHAR mask[CCHMAXPATH];
30 CHAR cl[1001];
31 CHAR sig[CCHMAXPATH];
32 LONG offset;
33 ULONG flags;
34} ASSOC;
35
36typedef struct LINKASSOC {
37 CHAR *mask;
38 CHAR *cl;
39 CHAR *sig;
40 LONG offset;
41 ULONG flags;
42 struct LINKASSOC *prev;
43 struct LINKASSOC *next;
44} LINKASSOC;
45
46static LINKASSOC *asshead = NULL,*asstail = NULL;
47static BOOL assloaded = FALSE;
48
49#pragma alloc_text(ASSOC2,free_commands,load_associations,save_associations)
50#pragma alloc_text(ASSOC2,ExecAssociation,AssocTextProc)
51
52
53MRESULT EXPENTRY AssocTextProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
54
55 PFNWP oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
56 static BOOL emphasized = FALSE;
57
58 switch(msg) {
59 case DM_DRAGOVER:
60 if(!emphasized) {
61 emphasized = TRUE;
62 DrawTargetEmphasis(hwnd,emphasized);
63 }
64 if(AcceptOneDrop(mp1,mp2))
65 return MRFROM2SHORT(DOR_DROP,
66 DO_MOVE);
67 return MRFROM2SHORT(DOR_NEVERDROP,0);
68
69 case DM_DRAGLEAVE:
70 if(emphasized) {
71 emphasized = FALSE;
72 DrawTargetEmphasis(hwnd,emphasized);
73 }
74 break;
75
76 case DM_DROPHELP:
77 DropHelp(mp1,mp2,hwnd,GetPString(IDS_ASSOCDROPHELPTEXT));
78 return 0;
79
80 case DM_DROP:
81 {
82 char szFrom[CCHMAXPATH + 5];
83
84 if(emphasized) {
85 emphasized = FALSE;
86 DrawTargetEmphasis(hwnd,emphasized);
87 }
88 if(GetOneDrop(mp1,mp2,szFrom,CCHMAXPATH)) {
89 strcat(szFrom," %a");
90 WinSetWindowText(hwnd,szFrom);
91 }
92 }
93 return 0;
94 }
95 return (oldproc) ? oldproc(hwnd,msg,mp1,mp2) :
96 WinDefWindowProc(hwnd,msg,mp1,mp2);
97}
98
99
100VOID free_associations (VOID) {
101
102 LINKASSOC *info,*next;
103
104 info = asshead;
105 while(info) {
106 next = info->next;
107 free(info->mask);
108 free(info->cl);
109 if(info->sig)
110 free(info->sig);
111 free(info);
112 info = next;
113 }
114 asshead = asstail = NULL;
115}
116
117
118VOID load_associations (VOID) {
119
120 FILE *fp;
121 LINKASSOC *info;
122 CHAR cl[1024];
123 CHAR mask[CCHMAXPATH + 24];
124 CHAR sig[CCHMAXPATH + 24];
125 CHAR offset[72];
126 CHAR flags[72];
127
128 if(asshead)
129 free_associations();
130 assloaded = TRUE;
131 save_dir2(mask);
132 if(mask[strlen(mask) - 1] != '\\')
133 strcat(mask,"\\");
134 strcat(mask,"ASSOC.DAT");
135 fp = _fsopen(mask,"r",SH_DENYWR);
136 if(fp) {
137 while(!feof(fp)) {
138 if(!fgets(mask,CCHMAXPATH + 24,fp))
139 break;
140 mask[CCHMAXPATH] = 0;
141 bstripcr(mask);
142 if(!*mask || *mask == ';')
143 continue;
144 if(!fgets(cl,1024,fp) ||
145 !fgets(sig,CCHMAXPATH + 24,fp) ||
146 !fgets(offset,72,fp) ||
147 !fgets(flags,72,fp))
148 break; /* error! */
149 cl[1000] = 0;
150 sig[CCHMAXPATH] = 0;
151 offset[34] = 0;
152 flags[34] = 0;
153 bstripcr(cl);
154 bstripcr(sig);
155 bstripcr(offset);
156 bstripcr(flags);
157 if(!*cl)
158 continue;
159 info = malloc(sizeof(LINKASSOC));
160 if(info) {
161 memset(info,0,sizeof(LINKASSOC));
162 info->cl = strdup(cl);
163 info->mask = strdup(mask);
164 if(*sig)
165 info->sig = strdup(sig);
166 info->offset = atol(offset);
167 info->flags = atol(flags);
168 if(!info->cl || !info->mask) {
169 if(info->cl)
170 free(info->cl);
171 if(info->mask)
172 free(info->mask);
173 free(info);
174 break;
175 }
176 if(!asshead)
177 asshead = info;
178 else {
179 asstail->next = info;
180 info->prev = asstail;
181 }
182 asstail = info;
183 }
184 }
185 fclose(fp);
186 }
187}
188
189
190VOID save_associations (VOID) {
191
192 LINKASSOC *info;
193 FILE *fp;
194 CHAR s[CCHMAXPATH + 14];
195
196 if(!assloaded || !asshead)
197 return;
198 info = asshead;
199#ifdef NEVER
200 while(info) {
201 next = info->next;
202 if(!strcmp("*",info->mask)) {
203 if(info != asshead) { /* already top record */
204 if(info->prev)
205 (info->prev)->next = info->next;
206 if(info->next)
207 (info->next)->prev = info->prev;
208 if(info == asstail)
209 asstail = info->prev;
210 info->next = asshead->next;
211 info->prev = NULL;
212 asshead = info;
213 }
214 }
215 info = next;
216 }
217#endif
218 save_dir2(s);
219 if(s[strlen(s) - 1] != '\\')
220 strcat(s,"\\");
221 strcat(s,"ASSOC.DAT");
222 fp = fopen(s,"w");
223 if(fp) {
224 fputs(GetPString(IDS_ASSOCFILETEXT),fp);
225 info = asshead;
226 while(info) {
227 fprintf(fp,
228 ";\n%0.*s\n%0.1000s\n%0.*s\n%lu\n%lu\n",
229 CCHMAXPATH,
230 info->mask,
231 info->cl,
232 CCHMAXPATH,
233 (info->sig) ? info->sig : NullStr,
234 info->offset,
235 info->flags);
236 info = info->next;
237 }
238 fclose(fp);
239 }
240}
241
242
243#pragma alloc_text(ASSOC,add_association,kill_association,AssocDlgProc,EditAssociations)
244
245
246LINKASSOC * add_association (ASSOC *addme) {
247
248 LINKASSOC *info;
249
250 if(addme && *addme->cl && *addme->mask) {
251 info = asshead;
252 while(info) {
253 if(!stricmp(info->mask,addme->mask) &&
254 ((!info->sig && !*addme->sig) ||
255 (info->sig && !strcmp(addme->sig,info->sig))))
256 return NULL;
257 info = info->next;
258 }
259 if(!info) {
260 info = malloc(sizeof(LINKASSOC));
261 if(info) {
262 memset(info,0,sizeof(LINKASSOC));
263 info->cl = strdup(addme->cl);
264 info->mask = strdup(addme->mask);
265 if(*addme->sig)
266 info->sig = strdup(addme->sig);
267 if(addme->offset)
268 info->offset = addme->offset;
269 if(addme->flags)
270 info->flags = addme->flags;
271 if(!info->cl || !info->mask) {
272 if(info->cl)
273 free(info->cl);
274 if(info->mask)
275 free(info->mask);
276 free(info);
277 }
278 else {
279 if(!asshead) /* only item in list */
280 asshead = asstail = info;
281 else {
282 if(asstail) { /* place at tail */
283 asstail->next = info;
284 info->prev = asstail;
285 }
286 asstail = info;
287 }
288 return info;
289 }
290 }
291 }
292 }
293 return NULL;
294}
295
296
297BOOL kill_association (ASSOC *killme) {
298
299 LINKASSOC *info;
300
301 if(killme && *killme->mask) {
302 info = asshead;
303 while(info) {
304 if(!stricmp(info->mask,killme->mask) &&
305 info->offset == killme->offset &&
306 (((!info->sig || !*info->sig) && !*killme->sig) ||
307 (info->sig && !strcmp(killme->sig,info->sig)))) {
308 if(info == asshead) {
309 asshead = info->next;
310 if(info == asstail)
311 asstail = info->prev;
312 }
313 else {
314 if(info->next)
315 (info->next)->prev = info->prev;
316 if(info->prev)
317 (info->prev)->next = info->next;
318 if(info == asstail)
319 asstail = info->prev;
320 }
321 free(info->cl);
322 free(info->mask);
323 if(info->sig)
324 free(info->sig);
325 free(info);
326 return TRUE;
327 }
328 info = info->next;
329 }
330 }
331 return FALSE;
332}
333
334
335INT ExecAssociation (HWND hwnd, CHAR *datafile) {
336
337 CHAR *file,sig[CCHMAXPATH],sigl[CCHMAXPATH],mask[CCHMAXPATH],*p;
338 FILE *fp;
339 BOOL didmatch,exclude;
340 ULONG offset;
341 LINKASSOC *info;
342
343 if(!assloaded)
344 load_associations();
345 if(!asshead)
346 return -1;
347 if(!datafile ||
348 !*datafile)
349 return -1;
350 file = strrchr(datafile,'\\');
351 if(!file)
352 file = strrchr(datafile,':');
353 if(file)
354 file++;
355 else
356 file = datafile;
357 info = asshead;
358 while(info) {
359 strcpy(mask,
360 info->mask);
361 p = strtok(mask,";");
362 while(p) {
363 if(*p == '/') {
364 p++;
365 exclude = TRUE;
366 }
367 else
368 exclude = FALSE;
369 didmatch = wildcard((strchr(p,'\\') ||
370 strchr(p,':')) ?
371 datafile :
372 file,
373 p,
374 FALSE);
375 if(exclude &&
376 didmatch)
377 didmatch = FALSE;
378 if(didmatch) {
379 if(info->sig &&
380 *info->sig) {
381 strcpy(sigl,
382 info->sig);
383 literal(sigl);
384 fp = _fsopen(datafile,
385 "rb",
386 SH_DENYNO);
387 if(fp) {
388 if(info->offset < 0L) {
389 fseek(fp,
390 0L,
391 SEEK_END);
392 offset = ftell(fp) + info->offset;
393 }
394 else
395 offset = info->offset;
396 fseek(fp,
397 offset,
398 SEEK_SET);
399 if(fread(sig,
400 1,
401 strlen(sigl),
402 fp) !=
403 strlen(sigl) ||
404 strncmp(sigl,
405 sig,
406 strlen(sigl)))
407 didmatch = FALSE;
408 fclose(fp);
409 }
410 }
411 }
412 if(didmatch) { /* got a match; do it... */
413
414 CHAR *list[2];
415 INT flags,rc;
416 BOOL dieafter = FALSE;
417
418 if(fAmAV2) {
419 if(stristr(info->cl,"AV2.EXE") ||
420 stristr(info->cl,"AV2.CMD") ||
421 stristr(info->cl,"<>"))
422 return -1;
423 }
424 if(!strcmp(info->cl,"<>")) {
425 OpenObject(datafile,
426 Default,
427 hwnd);
428 return 0;
429 }
430 list[0] = datafile;
431 list[1] = NULL;
432 flags = info->flags;
433 if(!(flags & FULLSCREEN))
434 flags |= WINDOWED;
435 if(flags & KEEP)
436 flags |= SEPARATEKEEP;
437 else
438 flags |= SEPARATE;
439 flags &= (~KEEP);
440 if(flags & DIEAFTER)
441 dieafter = TRUE;
442 flags &= (~DIEAFTER);
443 rc = ExecOnList(hwnd,
444 info->cl,
445 flags,
446 NULL,
447 list,
448 GetPString(IDS_EXECASSOCTITLETEXT));
449 if(rc != -1 &&
450 dieafter)
451 PostMsg((HWND)0,
452 WM_QUIT,
453 MPVOID,
454 MPVOID);
455 return rc;
456 }
457 p = strtok(0,";");
458 }
459 info = info->next;
460 }
461 return -1;
462}
463
464
465MRESULT EXPENTRY AssocDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
466
467 LINKASSOC *info;
468 SHORT x;
469
470 switch(msg) {
471 case WM_INITDLG:
472 WinSendDlgItemMsg(hwnd,ASS_LISTBOX,LM_DELETEALL,MPVOID,MPVOID);
473 WinSendDlgItemMsg(hwnd,ASS_MASK,EM_SETTEXTLIMIT,
474 MPFROM2SHORT(CCHMAXPATH,0),MPVOID);
475 WinSendDlgItemMsg(hwnd,ASS_CL,EM_SETTEXTLIMIT,
476 MPFROM2SHORT(1000,0),MPVOID);
477 WinSendDlgItemMsg(hwnd,ASS_SIG,EM_SETTEXTLIMIT,
478 MPFROM2SHORT(CCHMAXPATH,0),MPVOID);
479 WinSendDlgItemMsg(hwnd,ASS_OFFSET,EM_SETTEXTLIMIT,
480 MPFROM2SHORT(34,0),MPVOID);
481 WinSetDlgItemText(hwnd,ASS_MASK,NullStr);
482 WinSetDlgItemText(hwnd,ASS_CL,NullStr);
483 WinSetDlgItemText(hwnd,ASS_SIG,NullStr);
484 WinSetDlgItemText(hwnd,ASS_OFFSET,"0");
485 WinCheckButton(hwnd,ASS_DEFAULT,TRUE);
486 WinCheckButton(hwnd,ASS_PROMPT,FALSE);
487 WinCheckButton(hwnd,ASS_KEEP,FALSE);
488 WinCheckButton(hwnd,ASS_DIEAFTER,FALSE);
489 PostMsg(hwnd,UM_UNDO,MPVOID,MPVOID);
490 {
491 PFNWP oldproc;
492
493 oldproc = WinSubclassWindow(WinWindowFromID(hwnd,ASS_CL),
494 (PFNWP)AssocTextProc);
495 if(oldproc)
496 WinSetWindowPtr(WinWindowFromID(hwnd,ASS_CL),0,(PVOID)oldproc);
497 }
498 break;
499
500 case UM_UNDO:
501 {
502 CHAR s[1002 + CCHMAXPATH + 6];
503
504 WinSendDlgItemMsg(hwnd,
505 ASS_LISTBOX,
506 LM_DELETEALL,
507 MPVOID,
508 MPVOID);
509 info = asshead;
510 while(info) {
511 sprintf(s,
512 "%-12s \x1a %-24s %s%s%s",
513 info->mask,
514 info->cl,
515 (info->sig && *info->sig) ?
516 "[" : NullStr,
517 (info->sig && *info->sig) ? info->sig : NullStr,
518 (info->sig && *info->sig) ? "]" : NullStr);
519 x = (SHORT)WinSendDlgItemMsg(hwnd,
520 ASS_LISTBOX,
521 LM_INSERTITEM,
522 MPFROM2SHORT(LIT_END,0),
523 MPFROMP(s));
524 if(x >= 0)
525 WinSendDlgItemMsg(hwnd,
526 ASS_LISTBOX,
527 LM_SETITEMHANDLE,
528 MPFROMSHORT(x),
529 MPFROMP(info));
530 info = info->next;
531 }
532 WinSendDlgItemMsg(hwnd,
533 ASS_LISTBOX,
534 LM_SELECTITEM,
535 MPFROMSHORT(0),
536 MPFROMSHORT(TRUE));
537 }
538 return 0;
539
540 case WM_CONTROL:
541 if(SHORT1FROMMP(mp1) == ASS_LISTBOX) {
542 switch(SHORT2FROMMP(mp1)) {
543 case LN_ENTER:
544 case LN_SELECT:
545 x = (SHORT)WinSendDlgItemMsg(hwnd,
546 ASS_LISTBOX,
547 LM_QUERYSELECTION,
548 MPFROMSHORT(LIT_FIRST),
549 MPVOID);
550 if(x >= 0) {
551
552 CHAR s[36];
553
554 info = (LINKASSOC *)WinSendDlgItemMsg(hwnd,
555 ASS_LISTBOX,
556 LM_QUERYITEMHANDLE,
557 MPFROMSHORT(x),
558 MPVOID);
559 if(!info) {
560 DosBeep(50,100);
561 break;
562 }
563 WinSetDlgItemText(hwnd,ASS_MASK,info->mask);
564 WinSetDlgItemText(hwnd,ASS_CL,info->cl);
565 WinSetDlgItemText(hwnd,ASS_SIG,
566 (info->sig && *info->sig) ? info->sig : NullStr);
567 sprintf(s,"%ld",info->offset);
568 WinSetDlgItemText(hwnd,ASS_OFFSET,s);
569 if(!(info->flags & 1023))
570 WinCheckButton(hwnd,ASS_DEFAULT,TRUE);
571 else {
572 if(info->flags & FULLSCREEN)
573 WinCheckButton(hwnd,ASS_FULLSCREEN,TRUE);
574 else if(info->flags & MINIMIZED)
575 WinCheckButton(hwnd,ASS_MINIMIZED,TRUE);
576 else if(info->flags & MAXIMIZED)
577 WinCheckButton(hwnd,ASS_MAXIMIZED,TRUE);
578 else if(info->flags & INVISIBLE)
579 WinCheckButton(hwnd,ASS_INVISIBLE,TRUE);
580 }
581 WinCheckButton(hwnd,ASS_KEEP,((info->flags & KEEP) != 0));
582 WinCheckButton(hwnd,ASS_DIEAFTER,((info->flags & DIEAFTER) != 0));
583 WinCheckButton(hwnd,ASS_PROMPT,((info->flags & PROMPT) != 0));
584 {
585 CHAR env[1002];
586 ULONG size;
587
588 *env = 0;
589 size = sizeof(env) - 1;
590 if(PrfQueryProfileData(fmprof,
591 FM3Str,
592 info->cl,
593 env,
594 &size) &&
595 *env)
596 WinSetDlgItemText(hwnd,
597 ASS_ENVIRON,
598 env);
599 else
600 WinSetDlgItemText(hwnd,
601 ASS_ENVIRON,
602 NullStr);
603 }
604 }
605 break;
606 }
607 }
608 return 0;
609
610 case WM_COMMAND:
611 switch(SHORT1FROMMP(mp1)) {
612 case ASS_TOP:
613 x = (SHORT)WinSendDlgItemMsg(hwnd,ASS_LISTBOX,
614 LM_QUERYSELECTION,
615 MPFROMSHORT(LIT_FIRST),
616 MPVOID);
617 if(x >= 0) {
618 info = (LINKASSOC *)WinSendDlgItemMsg(hwnd,ASS_LISTBOX,
619 LM_QUERYITEMHANDLE,
620 MPFROMSHORT(x),
621 MPVOID);
622 if(info) {
623 if(info != asshead) {
624 if(info->prev)
625 info->prev->next = info->next;
626 if(info->next)
627 info->next->prev = info->prev;
628 if(info == asstail)
629 asstail = info->prev;
630 info->prev = NULL;
631 info->next = asshead;
632 asshead->prev = info;
633 asshead = info;
634 WinSendMsg(hwnd,UM_UNDO,MPVOID,MPVOID);
635 }
636 }
637 }
638 break;
639
640 case ASS_FIND:
641 {
642 CHAR filename[CCHMAXPATH + 9];
643
644 *filename = 0;
645 if(insert_filename(hwnd,filename,2,FALSE) && *filename) {
646 strcat(filename," %a");
647 WinSetDlgItemText(hwnd,ASS_CL,filename);
648 }
649 }
650 break;
651
652 case DID_OK:
653 WinDismissDlg(hwnd,1);
654 break;
655
656 case DID_CANCEL:
657 WinDismissDlg(hwnd,0);
658 break;
659
660 case IDM_HELP:
661 if(hwndHelp)
662 WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
663 MPFROM2SHORT(HELP_ASSOC,0),
664 MPFROMSHORT(HM_RESOURCEID));
665 break;
666
667 case ASS_ADD:
668 {
669 ASSOC temp;
670 CHAR dummy[34];
671
672 memset(&temp,0,sizeof(ASSOC));
673 WinQueryDlgItemText(hwnd,ASS_MASK,sizeof(temp.mask),temp.mask);
674 WinQueryDlgItemText(hwnd,ASS_CL,sizeof(temp.cl),temp.cl);
675 WinQueryDlgItemText(hwnd,ASS_SIG,sizeof(temp.sig),temp.sig);
676 rstrip(temp.sig);
677 if(*temp.sig) {
678 WinQueryDlgItemText(hwnd,ASS_OFFSET,sizeof(dummy),dummy);
679 temp.offset = atol(dummy);
680 }
681 bstrip(temp.mask);
682 bstrip(temp.cl);
683 if(WinQueryButtonCheckstate(hwnd,ASS_DEFAULT))
684 temp.flags = 0;
685 else if(WinQueryButtonCheckstate(hwnd,ASS_FULLSCREEN))
686 temp.flags = FULLSCREEN;
687 else if(WinQueryButtonCheckstate(hwnd,ASS_MINIMIZED))
688 temp.flags = MINIMIZED;
689 else if(WinQueryButtonCheckstate(hwnd,ASS_MAXIMIZED))
690 temp.flags = MAXIMIZED;
691 else if(WinQueryButtonCheckstate(hwnd,ASS_INVISIBLE))
692 temp.flags = INVISIBLE;
693 if(WinQueryButtonCheckstate(hwnd,ASS_KEEP))
694 temp.flags |= KEEP;
695 if(WinQueryButtonCheckstate(hwnd,ASS_DIEAFTER))
696 temp.flags |= DIEAFTER;
697 if(WinQueryButtonCheckstate(hwnd,ASS_PROMPT))
698 temp.flags |= PROMPT;
699 info = add_association(&temp);
700 if(info) {
701
702 CHAR s[1002 + CCHMAXPATH + 6];
703
704 *s = 0;
705 WinQueryDlgItemText(hwnd,ASS_ENVIRON,1000,s);
706 bstripcr(s);
707 if(*s)
708 PrfWriteProfileString(fmprof,FM3Str,temp.cl,s);
709 sprintf(s,"%-12s \x1a %-24s %s%s%s",temp.mask,
710 temp.cl,(*temp.sig) ?
711 "[" : NullStr,(*temp.sig) ? temp.sig : NullStr,
712 (*temp.sig) ? "]" : NullStr);
713 x = (SHORT)WinSendDlgItemMsg(hwnd,
714 ASS_LISTBOX,
715 LM_INSERTITEM,
716 MPFROM2SHORT(LIT_END,0),
717 MPFROMP(s));
718 if(x >= 0) {
719 WinSendDlgItemMsg(hwnd,
720 ASS_LISTBOX,
721 LM_SETITEMHANDLE,
722 MPFROMSHORT(x),
723 MPFROMP(info));
724 WinSendDlgItemMsg(hwnd,
725 ASS_LISTBOX,
726 LM_SELECTITEM,
727 MPFROMSHORT(x),
728 MPFROMSHORT(TRUE));
729 }
730 save_associations();
731 }
732 else
733 DosBeep(50,200);
734 }
735 break;
736
737 case ASS_DELETE:
738 {
739 ASSOC temp;
740 CHAR dummy[34];
741
742 memset(&temp,0,sizeof(ASSOC));
743 WinQueryDlgItemText(hwnd,ASS_MASK,sizeof(temp.mask),temp.mask);
744 WinQueryDlgItemText(hwnd,ASS_SIG,sizeof(temp.sig),temp.sig);
745 rstrip(temp.sig);
746 if(*temp.sig) {
747 WinQueryDlgItemText(hwnd,ASS_OFFSET,sizeof(dummy),dummy);
748 temp.offset = atol(dummy);
749 }
750 bstrip(temp.mask);
751 PrfWriteProfileData(fmprof,
752 FM3Str,
753 temp.mask,
754 NULL,
755 0L);
756 if(kill_association(&temp)) {
757 x = (SHORT)WinSendDlgItemMsg(hwnd,
758 ASS_LISTBOX,
759 LM_QUERYSELECTION,
760 MPFROMSHORT(LIT_FIRST),
761 MPVOID);
762 if(x >= 0) {
763 WinSendDlgItemMsg(hwnd,
764 ASS_LISTBOX,
765 LM_DELETEITEM,
766 MPFROMSHORT(x),
767 MPVOID);
768 WinSendDlgItemMsg(hwnd,ASS_LISTBOX,LM_SELECTITEM,
769 MPFROMSHORT(LIT_NONE),
770 MPFROMSHORT(FALSE));
771 }
772 save_associations();
773 }
774 else
775 DosBeep(50,200);
776 }
777 break;
778 }
779 return 0;
780 }
781 return WinDefDlgProc(hwnd,msg,mp1,mp2);
782}
783
784
785VOID EditAssociations (HWND hwnd) {
786
787 static CHAR stop = 0;
788
789 if(stop)
790 return;
791 stop++;
792 if(!assloaded)
793 load_associations();
794 WinDlgBox(HWND_DESKTOP,hwnd,AssocDlgProc,FM3ModHandle,ASS_FRAME,NULL);
795 stop = 0;
796}
797
Note: See TracBrowser for help on using the repository browser.