File: winutils.c

package info (click to toggle)
xlispstat 3.52.0-3
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 7,472 kB
  • ctags: 12,480
  • sloc: ansic: 89,534; lisp: 21,690; sh: 1,525; makefile: 520; csh: 1
file content (55 lines) | stat: -rw-r--r-- 946 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <windows.h>
#include <windowsx.h>
#include <string.h>
#include <stdio.h>
#include "winutils.h"
#include <dos.h>

static double dbltime(struct time *tm)
{
  return(3600.0*tm->ti_hour+60.0*tm->ti_min+tm->ti_sec+0.01*tm->ti_hund);
}

void Delay(unsigned n)
{
  double first, second;
  struct time tm;

  gettime(&tm);
  first = 1000.0 * dbltime(&tm);
  do {
    gettime(&tm);
    second = 1000.0 * dbltime(&tm);
  } while (second - first < n);
}

void SysBeep(int n)
{
  for (; n > 0; n -= 10)
    MessageBeep(0);
}

void FlushAllEvents(void)
{
  MSG msg;

  while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_MOUSELAST, PM_REMOVE | PM_NOYIELD));
}

int WarningBox(char *msg)
{
  SysBeep(10);
  return(MessageBox(GetFocus(),
		    (LPSTR) msg,
		    "XLISP-STAT",
		    MB_ICONASTERISK | MB_OK));
}

int OKorCancelBox(char *msg)
{
  return(MessageBox(GetFocus(),
		    (LPSTR) msg,
		    "XLISP-STAT",
		    MB_ICONQUESTION | MB_OKCANCEL));
}