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. */
27 eget (HWND h, int id, char *var)
35 if (GetDlgItemText (h, id, tmp, sizeof (tmp)) > 0)
37 var = (char *) malloc (strlen (tmp)+1);
47 int r = GetDlgItemInt (h, id, &s, TRUE);
52 eset (HWND h, int id, char *val)
54 SetDlgItemText (h, id, val);
58 eset (HWND h, int id, int val)
60 SetDlgItemInt (h, id, (UINT)val, TRUE);
64 rbget (HWND h, int *ids)
67 for (i=0; ids[i]; i++)
68 if (IsDlgButtonChecked (h, ids[i]) == BST_CHECKED)
74 rbset (HWND h, int *ids, int id)
77 for (i=0; ids[i]; i++)
78 CheckDlgButton (h, ids[i], id==ids[i] ? BST_CHECKED : BST_UNCHECKED);
84 DWORD e = GetLastError ();
86 FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
93 MessageBox (0, buf, m, 0);