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-08-01 15:31
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » A simple multitasking example for WinSail View 1,054 Replies 2
Original Poster Posted 2005-10-25 18:45 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
1: In the Config.Sys file
[System]
MultiTask = TRUE ;requires multitasking support

2: In the Main program

#include <Symbol.h>
#include <MyFrame.h>


//Default virtual keyboard function for all windows
void far TransrateKey(CObject* pObject)
{
return(0);
}


int far MyThread1(DWORD dwParam)
{
WORD k = 0;
//The AfxKbhit function is the multitasking version of the upgraded kbhit()
while(!::AfxKbhit())
{
if ((k % 60) == 0)
{
::sound(500);
}
else if ((k % 60) == 30)
{
::nosound();
}
k++;
}
}

void far MyDebugFunction()
{
//Press any key to exit this function
while (!AfxKbhit())
{
}
}

//Main program
int main(int argc, char** argv)
{
//Register the multitasking kernel that comes with WinSail
::AfxRegisterMultitaskEntry(
::KernalInitProcess,
::KernalCloseProcess,
::__MultiTaskDelay);

//Initialize system functions
if (!::InitSystem(argc, argv))
{
::CloseSystem();
::printf("\nInit System Error");
return(0);
}
//At this point, the main program has already become thread 0!

//...

//You can start your own thread here
if ( -1 == ::AfxBeginProcess(MyThread1, NULL, DEFAULT_STACK_SIZE))
{
//Error handling
}

//Your work below
::MyDebugFunction();


//Close the system
::CloseSystem();
//Note: when process 0 closes, all processes will be forcibly closed, dangerous!
return(0);
}
Floor 2 Posted 2005-10-31 21:35 ·  中国 云南 红河哈尼族彝族自治州 屏边苗族自治县 电信
初级用户
Credits 43
Posts 26
Joined 2005-10-07 11:08
20-year member
UID 43188
Status Offline
Boss, right now I really want to use this tool to write a program under DOS, but I don't know how to get started. Also, that oval button in the message prompt is too ugly.
Floor 3 Posted 2005-10-31 23:58 ·  中国 云南 红河哈尼族彝族自治州 屏边苗族自治县 电信
初级用户
Credits 43
Posts 26
Joined 2005-10-07 11:08
20-year member
UID 43188
Status Offline
Tonight I used VC6.0 to draw a dialog box, and when compiling it with BC31, 26 errors came up. How do I solve this?
Forum Jump: