annotate nt/addpm.c @ 12408:67f759e94c3e

(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
author Paul Eggert <eggert@twinsun.com>
date Wed, 28 Jun 1995 01:47:55 +0000
parents e97b20222345
children 705eb8c3d935
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1 /* Add entries to the GNU Emacs Program Manager folder.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 This file is part of GNU Emacs.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify it
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any later
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 version.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 more details.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License along
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 with GNU Emacs; see the file COPYING. If not, write to the Free Software
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
18 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
19 */
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
21 /****************************************************************************
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
22 *
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
23 * Program: addpm (adds emacs to the Windows program manager)
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
24 *
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
25 * Usage:
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
26 * argv[1] = full path to program to execute
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
27 * argv[2] = full path to icon for emacs (optional)
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 */
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
30 #include <windows.h>
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
31 #include <ddeml.h>
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
32 #include <stdlib.h>
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
33 #include <stdio.h>
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
35 HDDEDATA CALLBACK DdeCallback (UINT uType, UINT uFmt, HCONV hconv,
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
36 HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
37 DWORD dwData1, DWORD dwData2)
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
38 {
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
39 return ((HDDEDATA)NULL);
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
40 }
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
42 #define DdeCommand(str) \
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
43 DdeClientTransaction (str, strlen(str)+1, HConversation, (HSZ)NULL, \
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
44 CF_TEXT, XTYP_EXECUTE, 30000, NULL)
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
46 main (argc, argv)
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
47 int argc;
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
48 char *argv[];
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 {
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
50 DWORD idDde;
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
51 HCONV HConversation;
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
52 HSZ ProgMan;
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 char additem[MAX_PATH*2 + 100];
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
55 if (argc < 2 || argc > 3)
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 {
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
57 fprintf(stderr, "usage: addpm exe_path [icon_path]\n");
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
58 exit(1);
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 }
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
60
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
61 DdeInitialize (&idDde, (PFNCALLBACK)DdeCallback, APPCMD_CLIENTONLY, 0);
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
62
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
63 ProgMan = DdeCreateStringHandle (idDde, "PROGMAN", CP_WINANSI);
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
64
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
65 if (HConversation = DdeConnect (idDde, ProgMan, ProgMan, NULL))
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66 {
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
67 DdeCommand ("[CreateGroup(Gnu Emacs)]");
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
68 DdeCommand ("[ReplaceItem(Emacs)]");
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
69 sprintf (additem, "[AddItem(%s,Emacs%c%s)]",
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
70 argv[1], (argc>2 ? ',' : ' '),
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
71 (argc>2 ? argv[2] : ""));
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
72 DdeCommand (additem);
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
73
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
74 DdeDisconnect (HConversation);
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 }
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
77 DdeFreeStringHandle (idDde, ProgMan);
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78
12329
e97b20222345 Mostly rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 12181
diff changeset
79 DdeUninitialize (idDde);
12181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 return (0);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 }