]> cygwin.com Git - cygwin-apps/setup.git/blob - msg.cc
* msg.cc (mbox): added MB_TOPMOST to MessageBox type flags
[cygwin-apps/setup.git] / msg.cc
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16 /* The purpose of this file is to centralize all the message
17 functions. */
18
19 #include "win32.h"
20 #include <stdio.h>
21 #include <stdarg.h>
22 #include "dialog.h"
23
24 void
25 msg (char *fmt, ...)
26 {
27 char buf[1000];
28 va_list args;
29 va_start (args, fmt);
30 vsprintf (buf, fmt, args);
31 OutputDebugString (buf);
32 }
33
34 static int
35 mbox (int type, int id, va_list args)
36 {
37 char buf[1000], fmt[1000];
38
39 if (LoadString (hinstance, id, fmt, sizeof (fmt)) <= 0)
40 ExitProcess (0);
41
42 vsprintf (buf, fmt, args);
43 return MessageBox (0, buf, "Cygwin Setup", type | MB_TOPMOST);
44 }
45
46 void
47 note (int id, ...)
48 {
49 va_list args;
50 va_start (args, id);
51 mbox (0, id, args);
52 }
53
54 void
55 fatal (int id, ...)
56 {
57 va_list args;
58 va_start (args, id);
59 mbox (0, id, args);
60 ExitProcess (1);
61 }
62
63 int
64 yesno (int id, ...)
65 {
66 va_list args;
67 va_start (args, id);
68 return mbox (MB_YESNO, id, args);
69 }
This page took 0.041697 seconds and 6 git commands to generate.