2 * Copyright (c) 2000, Red Hat, Inc.
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.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to provide common functionality for
17 all the dialogs in the program. */
26 eget (HWND h
, int id
, char *var
)
34 if (GetDlgItemText (h
, id
, tmp
, sizeof (tmp
)) > 0)
36 var
= (char *) malloc (strlen (tmp
)+1);
46 int r
= GetDlgItemInt (h
, id
, &s
, TRUE
);
51 eset (HWND h
, int id
, char *val
)
53 SetDlgItemText (h
, id
, val
);
57 eset (HWND h
, int id
, int val
)
59 SetDlgItemInt (h
, id
, (UINT
)val
, TRUE
);
63 rbget (HWND h
, int *ids
)
66 for (i
=0; ids
[i
]; i
++)
67 if (IsDlgButtonChecked (h
, ids
[i
]) == BST_CHECKED
)
73 rbset (HWND h
, int *ids
, int id
)
76 for (i
=0; ids
[i
]; i
++)
77 CheckDlgButton (h
, ids
[i
], id
==ids
[i
] ? BST_CHECKED
: BST_UNCHECKED
);
83 DWORD e
= GetLastError ();
85 FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
,
92 MessageBox (0, buf
, msg
, 0);