中国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 20:22
47,815 topics / 349,930 posts / today 0 new / 48,290 members
DOS开发编程 & 发展交流 (开发室) » A simple multitasking example for WinSail
Printable Version  1,187 / 2
Floor1 firstsail Posted 2005-10-25 18:45
高级用户 Posts 295 Credits 668 From 广东深圳
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);
}
Floor2 jpzsj Posted 2005-10-31 21:35
初级用户 Posts 26 Credits 43
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.
Floor3 jpzsj Posted 2005-10-31 23:58
初级用户 Posts 26 Credits 43
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?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023