China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-21 09:57
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » The Terminator of DOS Interface Development View 94,121 Replies 290
Floor 241 Posted 2008-03-06 20:48 ·  中国 广东 深圳 宝安区 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
If Brother godai is interested in the "file open box", you can tell me your email, and I will send you the corresponding module source code. After you modify it, you can replace the "filedlg.obj" module in the "sail.lib" programming library file.
Floor 242 Posted 2008-03-07 01:45 ·  中国 广东 深圳 南山区 电信
初级用户
Credits 28
Posts 13
Joined 2008-02-18 12:33
18-year member
UID 110885
Gender Male
Status Offline
That's very thanks! My email is bingxizhao@tom.com
Hope to further discuss with you the completeness and application of the sail software!

Regarding the problem of compatibility versions between Windows and DOS, I haven't thought of a better way yet. I'll test it on the unit's machine tomorrow and see.

Another thing: The practical DOS utilities you wrote don't have devices like floppy drives? It's really not easy! Hehe. If needed, I have some here and can send one to you for testing.
Floor 243 Posted 2008-03-07 13:35 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
The email has been sent to bingxizhao@tom.com
Floor 244 Posted 2008-03-07 19:47 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
Find a feasible way to judge whether "the program is running under pure DOS". The basic idea is as follows:

The MSW (Machine Status Word) of the 80386 register can be read in real mode or any privilege level, while the control register CR0 can only be read in real mode or privilege level 0. And the lower 16 bits of CR0 are the MSW. According to this principle, if their values are equal, it is considered to be running under pure DOS; otherwise, it is running under the DOS virtual machine in Windows.

BOOL IsWindowVM()
{
DWORD dwCr0;
WORD wMsw;

// Read machine status word MSW
asm smsw ax;
asm mov wMsw, ax

// Read control register cr0, which may cause an exception under VM
asm mov eax, cr0
asm mov dwCr0, eax

// Judge whether they are equal. When equal, it means pure DOS; otherwise, VM
if (wMsw == (WORD)(dwCr0 & 0xFFFFlu))
{
return (FALSE);
}

return (TRUE);
}

Although after pure DOS loads "Emm386.Exe", pure DOS will enter "protected mode" from "real mode", but at this time pure DOS is running in "protected mode" of privilege level 0, and the code is not affected!

Since the above code uses 32-bit instructions, modify the 16-bit code as:
BOOL IsWindowVM()
{
DWORD dwCr0;
WORD wMsw;

// read MSW
__emit__(0x0F, 0x01, 0xE0);//asm mov smsw ax
asm mov wMsw, ax

// Read cr0
asm mov ax, wMsw
asm inc ax
__emit__(0x0F, 0x20, 0xC0); //asm mov eax, cr0

// eax to dwCr0
__emit__(0x66, 0x50); //asm push eax
asm pop ax
asm pop dx
asm mov word ptr dwCr0 + 0, ax
asm mov word ptr dwCr0 + 2, dx

// judge
return ((wMsw == (WORD)(dwCr0 & 0xFFFFlu)) ? FALSE : TRUE);

}

[ Last edited by firstsail on 2008-3-14 at 08:21 PM ]
Floor 245 Posted 2008-03-07 21:07 ·  中国 北京 中移铁通
初级用户
Credits 46
Posts 22
Joined 2006-11-13 10:14
19-year member
UID 70433
Gender Male
Status Offline
Does winsail support USB reading?
Floor 246 Posted 2008-03-08 00:55 ·  中国 广东 深圳 南山区 电信
初级用户
Credits 28
Posts 13
Joined 2008-02-18 12:33
18-year member
UID 110885
Gender Male
Status Offline
The file has been received. Thanks a lot, Brother Guo!
Floor 247 Posted 2008-03-14 12:38 ·  中国 北京 中移铁通
初级用户
Credits 46
Posts 22
Joined 2006-11-13 10:14
19-year member
UID 70433
Gender Male
Status Offline
Give it a thumbs up
Floor 248 Posted 2008-03-14 20:17 ·  中国 广东 深圳 宝安区 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
The file open dialog has improved access to floppy drives. Here, I would like to especially thank brother "godai" for sending the floppy drive and floppy disks!
Floor 249 Posted 2008-03-21 10:25 ·  中国 广东 联通数据上网公共出口
初级用户
Credits 46
Posts 22
Joined 2006-11-13 10:14
19-year member
UID 70433
Gender Male
Status Offline
May I ask Brother Guo, how to handle setting the background color or font color of each cell in a table.
Also, after loading doslen, it can be opened under bc and long filename files can be saved, but your file box does not support long filename display. Can it be solved?
Hope it is meaningful for improving and strengthening winsail.
Floor 250 Posted 2008-03-21 12:54 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
There are two functions in the base class CObject of the control. One is to set the background color of the control, and the other is to set the foreground color of the control.
Set the background color of the control: CObject::SetBackColor(int nColor);
Set the foreground color of the control: CObject::SetForeColor(int nColor);

Suppose your table control is pGrid1, then like this
pGrid1->SetBackColor(YELLOW); // Set the table background to "yellow"
pGrid1->SetForeColor(RED); // Set the text foreground color of the table to "red"

[ Last edited by firstsail on 2008-3-21 at 12:57 PM ]
Floor 251 Posted 2008-03-21 13:14 ·  中国 广东 联通数据上网公共出口
初级用户
Credits 46
Posts 22
Joined 2006-11-13 10:14
19-year member
UID 70433
Gender Male
Status Offline
I'm afraid this might not work. The function you encapsulated can't control the display settings of each cell individually.

Here's a suggestion: in the table control, add properties to set the foreground color and background color of each cell. In the internal display function, when displaying the table content, call the foreground color and background color separately.

This is practically meaningful because sometimes in projects, it's necessary to visually display 3D and 4D data. Color can be used as a one-dimensional data. I once made such a table, but I don't know how to control XMS memory, so the data volume can't be large. What do you think of this? Or can you give me some materials and I'll help you improve the table control?
Floor 252 Posted 2008-03-21 14:20 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
Setting the text color and background color for each cell individually takes up a large amount of memory and is not very practical. However, I think it is of great significance to be able to set the color for each column separately.

If you need to write non-standard controls, it is recommended to develop your own new controls by inheriting from the base class, such as ammeters, knobs, indicator lights, thermometers...



[ Last edited by firstsail on 2008-3-21 at 02:23 PM ]
Floor 253 Posted 2008-03-23 17:16 ·  中国 北京 中移铁通
初级用户
Credits 46
Posts 22
Joined 2006-11-13 10:14
19-year member
UID 70433
Gender Male
Status Offline
How to handle internal messages of a control by oneself? Can you give a complete example of control code?
Floor 254 Posted 2008-04-04 11:26 ·  中国 北京 中移铁通
初级用户
Credits 46
Posts 22
Joined 2006-11-13 10:14
19-year member
UID 70433
Gender Male
Status Offline
Encapsulated new table and list controls, how to draw a blinking cursor?
Floor 255 Posted 2008-04-07 14:42 ·  中国 山东 潍坊 联通
新手上路
Credits 10
Posts 5
Joined 2008-04-07 13:20
18-year member
UID 115172
Gender Male
Status Offline
Where to download it from?
Forum Jump: