⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_id.txt

📁 国外网站上的一些精典的C程序
💻 TXT
字号:
                    Multi-Tasker Detection Routines                             by David Gibbs                          FidoNet: 1:115/439.0             Internet: David.Gibbs@f439.n115.z1.fidonet.orgThe following is a set of C routines that will enable a programmer todetect a multi-tasking environment and release the time slice whendesired.  Currently DESQview, Windows, & OS/2 are the environmentssupported.Routines consist of two functions, two global int variables, one globalstructure, and a table of character pointers.void t_get_os(); This routines detects the operating environment, setson the appropriate bits in the t_os_type field, and sets the t_os fieldto the dominant environment.void t_slice(); This routine will release the remainder of the currenttasks time slice in the manner appropriate to the dominant environment.The following fields & structures are available...int t_os_type; is a bit mapped integer that indicates the presence ofvarious operating environments.  If Bit 0 is on, DOS is present, Bit 1 =OS2, bit 2 = DESQview, bit 3 = Windows standard, bit 4 = Windows 386Enh.  These bits can be tested by using logical operations with thesymbolic constants is_DOS, is_OS2, is_DV, is_WINS, and is_WIN3.int t_os; represents the dominant environment.  The dominant environmentis defined as the multi-tasking system that takes precedence.  Forinstance, you can run Windows *UNDER* DESQview, but DESQview would bedominant, the same goes true for OS/2 & Windows.  This value can betested by comparing to the symbolic constants: DOS, OS2, DV, WINS, andWIN3.struct t_os_ver ts_os_ver[]; indicates the versions of the variousenvironments present.  Major & minor versions are found in thestructure members 'maj' and 'min'.  The structure is subscripted, so youcan access the version of environments using the symbolic constants usein 't_os'.const char *t_os_name[]; contains the names of the environmentsdetectable.  These too are subscripted and can be accessed using thesymbolic constants above.A sample program that uses these routines follows:#include <stdio.h>#include "tasker.h"void main() {        get_os();        printf("%s %d.%d detected",t_os_name[t_os],                                   t_os_ver[t_os].maj,                                   t_os_ver[t_os].min);        while(!kbhit()) {                printf("Hit a key!\r\n");                t_slice();        }}Special thanks go to Geoffery Booher (1:2270/233) for assistance withWindows & OS/2 detection & Time slicing.This routine is released to the public as CommentWare - If you use it,please send me a comment as to what you thought of it... oh yeah, youmight think of giving me credit for the routines.Also, if you can think of a enhancement or correction, please let meknow.  I can be reached at the above mentioned email addresses.Copyrights: DESQview by Quarterdeck Office Systems            Windows by Microsoft            OS/2 by IBM            TurboC++ by Borland

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -