1 /* NT Message Box and Exec functions for regutil
3 * The contents of this file are subject to the Mozilla Public License
4 * Version 1.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 * http://www.mozilla.org/MPL/
8 * Software distributed under the License is distributed on an "AS IS"
9 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
10 * License for the specific language governing rights and limitations
13 * The Original Code is regutil.
15 * The Initial Developer of the Original Code is Patrick TJ McPhee.
16 * Portions created by Patrick McPhee are Copyright © 2001
17 * Patrick TJ McPhee. All Rights Reserved.
21 * $Header: /opt/cvs/Regina/regutil/regwin.c,v 1.1 2009/10/07 07:52:21 mark Exp $
26 /* rxmessagebox(text, [title], [button], [icon]) */
30 char * text
, *but
= NULL
, *ic
= NULL
;
31 char * title
= "Error!";
33 int icon
= MB_ICONHAND
;
40 "OKCANCEL", MB_OKCANCEL
,
41 "ABORTRETRYIGNORE", MB_ABORTRETRYIGNORE
,
42 "YESNOCANCEL", MB_YESNOCANCEL
,
44 "RETRYCANCEL", MB_RETRYCANCEL
,
47 "QUESTION", MB_ICONQUESTION
,
48 "EXCLAMATION", MB_ICONEXCLAMATION
,
49 "ASTERISK", MB_ICONASTERISK
,
50 "INFORMATION", MB_ICONINFORMATION
,
56 rxstrdup(text
, argv
[0]);
57 if (argc
> 1 && argv
[1].strptr
) {
58 rxstrdup(title
, argv
[1]);
60 if (argc
> 2 && argv
[2].strptr
) {
61 rxstrdup(but
, argv
[2]);
63 if (argc
> 3 && argv
[3].strptr
) {
64 rxstrdup(ic
, argv
[3]);
69 for (i
= 0; i
< DIM(is
); i
++) {
70 if (!strcmp(ic
, is
[i
].text
)) {
79 for (i
= 0; i
< DIM(bs
); i
++) {
80 if (!strcmp(but
, bs
[i
].text
)) {
87 result
->strlength
= sprintf(result
->strptr
, "%d",
88 MessageBox(NULL
, text
, title
, icon
|button
));
94 /* call winexec with the specified arguments. The same effect can be had
95 * using the start command
96 * rc = rxwinexec(cmd[, flags])
100 char * cmd
, *sflags
= NULL
;
101 int flags
= SW_SHOWNORMAL
;
103 static const struct {
107 "SHOWNORMAL", SW_SHOWNORMAL
,
108 "SHOWNOACTIVATE", SW_SHOWNOACTIVATE
,
109 "SHOWMINNOACTIVE", SW_SHOWMINNOACTIVE
,
110 "SHOWMINIMIZED", SW_SHOWMINIMIZED
,
111 "SHOWMAXIMIZED", SW_SHOWMAXIMIZED
,
113 "MINIMIZE", SW_MINIMIZE
118 rxstrdup(cmd
, argv
[0]);
119 if (argc
> 1 && argv
[1].strptr
) {
120 rxstrdup(sflags
, argv
[1]);
125 for (i
= 0; i
< DIM(fs
); i
++) {
126 if (!strcmp(sflags
, fs
[i
].text
)) {
133 /* return the rc of winexec */
134 result
->strlength
= sprintf(result
->strptr
, "%d", WinExec(cmd
, flags
));