;/* sc resopt link optimize debug=line idir=include: nostackcheck opt data=far getmodeidrate.c quit */ /* ** Example on getting display modeid vert & horiz refresh rates ** ** Written by Harry "Piru" Sintonen ** Public Domain. ** */ #include #include #include #include #include #include int main(int argc, char **argv) { struct MonitorInfo moninfo; ULONG modeid; if (argc != 2) { Printf("Usage: %s modeid\n", argv[0]); return RETURN_WARN; } modeid = strtoul(argv[1], NULL, 0); if (GetDisplayInfoData(NULL, (UBYTE *) &moninfo, sizeof(struct MonitorInfo), DTAG_MNTR, modeid) >= offsetof(struct MonitorInfo, MinRow)) { ULONG vfreq = 1000000000UL / ((ULONG) moninfo.TotalColorClocks * 280 * moninfo.TotalRows / 1000) + 5; ULONG vfreqk = vfreq / 1000; ULONG hfreq = 1000000000UL / ((ULONG) moninfo.TotalColorClocks * 280) + 5; ULONG hfreqk = hfreq / 1000; Printf("Scanrate: %lu.%02lu Hz\n", vfreqk, (vfreq - vfreqk * 1000) / 10); Printf("Scanline: %lu.%02lu kHz\n", hfreqk, (hfreq - hfreqk * 1000) / 10); return RETURN_OK; } else Printf("GetDisplayInfoData DTAG_MNTR failed!\n"); return RETURN_ERROR; }