中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-10-31 15:41
47,815 topics / 349,930 posts / today 0 new / 48,290 members
DOS开发编程 & 发展交流 (开发室) » Turn off the display for DOS software
Printable Version  2,425 / 13
Floor1 alionlian Posted 2006-04-07 22:18
新手上路 Posts 2 Credits 8
Windows has power-saving mode, and the display can be automatically turned off when not in use for a long time. Then, can DOS do that? It's best to implement it with TC.
I found a dpmsave.exe. As soon as I run it, it turns off the display, and pressing any key turns it on. I don't know how to implement it.
Floor2 alionlian Posted 2006-04-09 16:50
新手上路 Posts 2 Credits 8
Where are the experts?
Floor3 yk141 Posted 2006-04-10 23:35
初级用户 Posts 21 Credits 46 From 中华人民共和国
Is it big or not? Can't you just take a look at the anti-Jiang compilation? It seems to be implemented by calling INT 10H. Specifically, I forgot!
Floor4 JonePeng Posted 2006-04-11 22:37
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
I wrote such a program 6 years ago, calling the 4F10H sub-interrupt of INT 10H.



[ Last edited by JonePeng on 2006-4-11 at 22:39 ]
Floor5 xuantian Posted 2006-04-16 23:43
高级用户 Posts 282 Credits 587
Meddlesome
Press with hand and also tap the keyboard twice...
Floor6 asbai Posted 2006-04-17 00:17
高级用户 Posts 252 Credits 653
Originally posted by xuantian at 2006-4-16 23:43:
Meddlesome
It's two keystrokes less to press with the hand....


Makes sense. Anyway, since I have to execute this program manually every time, it's better to just press the monitor power button, heh
Floor7 JonePeng Posted 2006-04-21 00:07
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Re xuantian & asbai:

Your ideas are relatively one-sided.

What if the monitor's buttons fail or break?

The small program I made is to solve the problem of the second-hand monitor buttons I used before.

In addition, you can also create a shortcut of this program under Windows and place it in the quick launch bar of the taskbar, so that you can click this icon to avoid pressing the monitor switch.
Floor8 qingfen Posted 2006-04-23 14:47
初级用户 Posts 22 Credits 70
Can we write it in a way of port reading and writing????
Floor9 waynebeat Posted 2006-05-17 14:51
初级用户 Posts 28 Credits 84
Can the monitor be directly turned on when booting? My monitor button is broken. It can't be turned on after being turned off.
Floor10 JonePeng Posted 2006-05-18 10:57
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Originally posted by waynebeat at 2006-5-17 14:51:
Can the monitor
be turned on directly when booting?
My monitor button is broken
and it can't be turned on after being turned off.

Hehe, then don't turn off the monitor after shutting down.
Floor11 lqsoft Posted 2006-05-24 02:34
新手上路 Posts 1 Credits 2
```c
void crtoff()/*Turn off the display*/
{
int crtflag;/*Flag indicating whether the display supports power-saving mode*/
union REGS inregs,outregs;
inregs.x.ax=0x4f10;
inregs.x.bx=0;
int86(0x10,&inregs,&outregs);
if(outregs.h.al==0x4f)/*If the display supports power-saving mode, turn it off*/
{
inregs.x.ax=0x4f10;
inregs.x.bx=0x0201;
int86(0x10,&inregs,&outregs);
inregs.x.ax=0x4f10;
inregs.x.bx=0x0301;
int86(0x10,&inregs,&outregs);
crtflag=1;
}
else /*Otherwise, disable display refresh*/
{
inregs.x.ax=0x1201;
inregs.h.bl=0x36;
int86(0x10,&inregs,&outregs);
crtflag=0;
}
while(bioskey(1)==0&&Minf==0) /*Wait for keyboard or mouse information to turn on the display*/
GetMouseState(&Minf);
if(crtflag)/*If the display supports power-saving mode, turn it on*/
{
inregs.x.ax=0x4f10;
inregs.x.bx=0x1;
int86(0x10,&inregs,&outregs);
}
else/*Otherwise, allow display refresh*/
{
inregs.x.ax=0x1200;
inregs.h.bl=0x36;
int86(0x10,&inregs,&outregs);
}
}
```
Floor12 xiongwei2624 Posted 2006-06-30 14:47
初级用户 Posts 44 Credits 96 From 深圳
I'm not very familiar with assembly!
Floor13 scumyang Posted 2006-07-01 16:52
初级用户 Posts 9 Credits 20
```c
#define DPMS_ON 0
#define DPMS_WAIT 1
#define DPMS_SUSPEND 2
#define DPMS_OFF 4

//---------------------------------------------------------------------------
// Set DPMS status
//
// Set the monitor energy-saving status
//---------------------------------------------------------------------------
BYTE yana_SetDPMSStatus(BYTE Act)
{
union REGS r;

r.w.ax = 0x4F10;
r.h.bl = 1;
r.h.bh = Act;
int386(0x10, &r, &r);
return (r.h.al == 0x4F); // If AL != 4Fh, return FALSE
}
```
Floor14 bd123456789 Posted 2008-01-11 22:06
中级用户 Posts 216 Credits 360
Is there any way to test the above code?

Sorry, I really don't understand C language programming. Even if I have the code, I don't know how to test it!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023