annotate nt/addpm.c @ 12230:7275b8e0d272

(universal-argument, describe-arg): Restore Lisp code, undoing Feb 28 change. (prefix-arg-internal, digit-argument, negative-argument): Likewise.
author Karl Heuer <kwzh@gnu.org>
date Wed, 14 Jun 1995 22:30:41 +0000
parents 702f2ac242de
children e97b20222345
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
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /* addpm: Adds entries to the GNU Emacs Program Manager folder.
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 argv[1] = full path to program to execute
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 argv[2] = full path to icon for emacs (optional)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 */
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include <windows.h> // required for all Windows applications
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 #include <ddeml.h> // required for DDEML
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 #include <string.h> // required for strcpy and strlen
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 HDDEDATA EXPENTRY dde_callback (WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32 BOOL send_shell_command (DWORD, LPSTR);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 // Global variables
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 HANDLE gh_inst; // current instance
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 /****************************************************************************
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 FUNCTION: WinMain()
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40 PURPOSE: Calls initialization function, processes message loop
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 PARAMETERS:
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 HANDLE h_instance
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 HANDLE h_prev_instance
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 LPSTR lp_cmd_line
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 int n_cmd_show
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 RETURNS:
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 int
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 ****************************************************************************/
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52 int PASCAL
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 WinMain (HANDLE h_instance, // current instance
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54 HANDLE h_prev_instance, // previous instance
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
55 LPSTR lp_cmd_line, // command line
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 int n_cmd_show) // show-window type (open/icon)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 {
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58 DWORD id_inst = 0L; // instance identifier
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 FARPROC lp_dde_proc;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 char *path, *icon, *s;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 char additem[MAX_PATH*2 + 100];
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 gh_inst = h_instance;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65 for (path = NULL, s = lp_cmd_line; *s && isspace (*s); s++);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66 if (*s)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67 {
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68 path = s;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69 while (*s && !isspace (*s))
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70 s++;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71 if (*s)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
72 *(s++) = '\0';
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73 }
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74 for (icon = NULL; *s && isspace (*s); s++);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 if (*s)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 {
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 icon = s;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78 while (*s && !isspace (*s))
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79 s++;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 if (*s)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 *(s++) = '\0';
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 }
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84 lp_dde_proc = MakeProcInstance ((FARPROC) dde_callback, gh_inst);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 DdeInitialize (&id_inst, // receives instance ID
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 (PFNCALLBACK) lp_dde_proc, // address of callback function
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 APPCMD_CLIENTONLY, // this is a client app
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 0L); // reserved
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 send_shell_command (id_inst, (LPSTR) "[CreateGroup(Gnu Emacs)]");
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93 send_shell_command (id_inst, (LPSTR) "[ReplaceItem(Emacs)]");
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 sprintf (additem, "[AddItem(%s,Emacs%c%s)]",
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96 path, (icon ? ',' : ' '), (icon ? icon : ""));
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 send_shell_command (id_inst, additem);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 DdeUninitialize (id_inst);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 return (0);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 }
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
103
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 /****************************************************************************
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 FUNCTION: dde_callback()
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 PURPOSE: Processes messages for DDEML conversation
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 PARAMETERS:
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 WORD w_type
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 WORD w_fmt
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 HCONV h_conv
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 HSZ hsz1
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 HSZ hsz2
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 HDDEDATA h_data
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 DWORD dw_data1
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 DWORD dw_data2
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 RETURNS:
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 HDDEDATA
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 ****************************************************************************/
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 HDDEDATA EXPENTRY
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 dde_callback (WORD w_type, // transaction type
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 WORD w_fmt, // clipboard format
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 HCONV h_conv, // handle of the conversation
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 HSZ hsz1, // handle of a string
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 HSZ hsz2, // handle of a string
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 HDDEDATA h_data, // handle of a global memory object
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 DWORD dw_data1, // transaction-specific data
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 DWORD dw_data2) // transaction-specific data
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133 {
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134 // Nothing need be done here...
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 return (HDDEDATA) NULL;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 }
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 /****************************************************************************
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 FUNCTION: send_shell_command()
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 PURPOSE: Sends the given command string to Program Manager
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 PARAMETERS:
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145 LPSTR - pointer to command string
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 RETURNS:
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 BOOL - TRUE if this function succeeds, FALSE otherwise
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 ****************************************************************************/
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 BOOL
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 send_shell_command (DWORD id_inst, // instance identifier
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 LPSTR lp_command) // command string to execute
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 {
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 HSZ hsz_serv_top; // Service and Topic name are "PROGMAN"
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 HCONV hconv; // handle of conversation
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 int n_len; // length of command string
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 HDDEDATA h_data; // return value of DdeClientTransaction
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 DWORD dw_result; // result of transaction
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 BOOL b_result = FALSE; // TRUE if this function is successful
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 // create string handle to service/topic
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 hsz_serv_top = DdeCreateStringHandle (id_inst, "PROGMAN", CP_WINANSI);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 // attempt to start conversation with server app
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 if ((hconv = DdeConnect (id_inst, hsz_serv_top, hsz_serv_top, NULL))
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 != (HCONV) NULL)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 {
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 // get length of the command string
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 n_len = lstrlen ((LPSTR) lp_command);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
172 // send command to server app
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 h_data = DdeClientTransaction ((LPBYTE) lp_command, // data to pass
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 n_len + 1, // length of data
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 hconv, // handle of conversation
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 (HCONV) NULL, // handle of name-string
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 CF_TEXT, // clipboard format
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 XTYP_EXECUTE, // transaction type
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179 1000, // timeout duration
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 &dw_result); // transaction result
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 if (h_data)
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183 b_result = TRUE;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185 // end conversation
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 DdeDisconnect (hconv);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187 }
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 // free service/topic string handle
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 DdeFreeStringHandle (id_inst, hsz_serv_top);
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 return b_result;
702f2ac242de Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193 }