|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 271 楼』:
使用 LLM 解释/回答一下
Originally posted by godai at 2008-7-17 12:00:
郭大大, 您的winsail程序在试用中出现一个现象: 就是在振动环境中有时候偶尔会发生PS2鼠标指针乱飞掉的情况。 初步判断是干扰引起的鼠标通讯错误 ...
关于鼠标在振动的工业环境中乱跳的情况可能是由于用了“光电鼠标”,建议在工业强振动环境用“机械式滚轮鼠标”试一试。
Originally posted by godai at 2008-7-17 12:00:
Mr. Guo, there is a phenomenon in the trial of your winsail program: that is, sometimes the PS2 mouse pointer flies around and drops occasionally in a vibrating environment. Initially judged to be an interference - caused mouse communication error...
Regarding the situation where the mouse jumps randomly in an industrial environment with vibration, it may be due to using a "photoelectric mouse". It is suggested to try using a "mechanical scroll mouse" in an industrial strong - vibration environment.
|
|
2008-11-20 11:18 |
|
|
windowsvesta
初级用户
 
积分 138
发帖 67
注册 2007-7-4 来自 云南
状态 离线
|
『第 272 楼』:
使用 LLM 解释/回答一下
好像好久没有更新了!
It seems that there hasn't been an update for a long time!
|
|
2009-3-5 00:45 |
|
|
andyond
新手上路

积分 16
发帖 8
注册 2009-3-12
状态 离线
|
|
2009-3-15 10:05 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 274 楼』:
使用 LLM 解释/回答一下
窗口控件支持了“命令快捷键”函数
void CWindow::AddCommandKey(WORD wKey, void far (*pMyFc)(CObject *));
函数功能:增加键盘快捷键(无需控件宿主)
入口参数:wKey ------ 虚拟按键值。例如F1键是VK_F1,F1键是VK_F2,...,F10键是VK_F10
pMyFc ---- 回调函数。原型为
void far MyFc(CObject* pObject)
{
CWindow* pWindow = (CWindow *)pObject;
//下面增加您自己的代码
//......
}
出口参数:无
返 回 值:无
Last edited by firstsail on 2009-4-2 at 23:39 ]
Window control supports "command shortcut key" function
void CWindow::AddCommandKey(WORD wKey, void far (*pMyFc)(CObject *));
Function: Add keyboard shortcut key (no need for control host)
Input parameters: wKey ------ Virtual key value. For example, F1 key is VK_F1, F2 key is VK_F2,..., F10 key is VK_F10
pMyFc ---- Callback function. The prototype is
void far MyFc(CObject* pObject)
{
CWindow* pWindow = (CWindow *)pObject;
//Add your own code below
//......
}
Output parameters: None
Return value: None
Last edited by firstsail on 2009-4-2 at 23:39 ]
|
|
2009-4-2 23:36 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 275 楼』:
发现数据库Flush函数的严重出错
使用 LLM 解释/回答一下
发现经过:
有客户反映,程序未正常关机时,经常造成数据库文件的数据丢失,数据库文件非法!
检查程序:
自己的程序每写一次数据纪录,已经调用了“CFoxpro::Flush()”函数,其作用是将数据真正写入磁盘,如果有上面说过的情况,理应是该函数有问题。
BOOL CFoxpro::Flush()
{
//检查文件指针的合法性
if (NULL == m_pFile)
{
return(FALSE);
}
//刷新磁盘缓冲区
::fflush(m_pFile);
return(TRUE);
}
初步怀疑C函数库提供的fflush()函数并不是将磁盘冲区数据全部写入磁盘,经过使用BC31的帮助文件,发现真不是这回事!正确应如下修改
解决问题:
将CFoxpro::Flush()修改为如下所示,已解决
BOOL CFoxpro::Flush()
{
//检查文件指针的合法性
if (NULL == m_pFile)
{
return(FALSE);
}
//刷新磁盘缓冲区
::fflush(m_pFile);
int duphandle = ::dup(fileno(m_pFile));
::close(duphandle);
return(TRUE);
}
Discovery Process:
Some customers reported that when the program did not shut down normally, it often caused data loss in the database file, and the database file was illegal!
Check the Program:
In my own program, every time I write a data record, I have already called the "CFoxpro::Flush()" function, whose function is to truly write the data to the disk. If the situation mentioned above occurs, it should be that there is a problem with this function.
BOOL CFoxpro::Flush()
{
//Check the validity of the file pointer
if (NULL == m_pFile)
{
return(FALSE);
}
//Flush the disk buffer
::fflush(m_pFile);
return(TRUE);
}
Initially, it was suspected that the fflush() function provided by the C function library did not completely write the data in the disk buffer to the disk. After using the help file of BC31, it was found that this was indeed the case! The correct modification should be as follows
Solve the Problem:
Modify CFoxpro::Flush() as shown below, which has been solved
BOOL CFoxpro::Flush()
{
//Check the validity of the file pointer
if (NULL == m_pFile)
{
return(FALSE);
}
//Flush the disk buffer
::fflush(m_pFile);
int duphandle = ::dup(fileno(m_pFile));
::close(duphandle);
return(TRUE);
}
|
|
2009-5-6 08:12 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 276 楼』:
WinSail的TCP/IP栈是如何工作的?
使用 LLM 解释/回答一下
为了让大家对WINSAIL在单任务系统中如何调度TCP/IP的。下面作一些说明!
(1)在窗口的CWindow::OnIdle(CObject* pObj)函数中,调用了TCP/IP的循环处理入口函数指针pSocketLoopFc指向的套接字循环函数。
CWindow::OnIdle(CObject* pObj)的源代码如下
extern BOOL bAfxNetcard; //是否在CONFIG.Sys文件中配置需要网卡标志
extern BOOL bAfxInitSocket; //是否套接字成功初始化标志
extern BOOL (*__pSocketInitFc)(); //套接字初始化函数指针
extern BOOL (*__pSocketCloseFc)();//套接字关闭函数指针
extern BOOL (*__pSocketLoopFc)(BOOL, BOOL, BOOL);//套接字循环函数指针
void CWindow::OnIdle()
{
//这里判断是否需要执行TCP/IP栈
if (bAfxNetcard && bAfxInitSocket && __pSocketLoopFc != NULL)
{
__pSocketLoopFc(TRUE, TRUE, TRUE);
}
//这里执行void CWindow::SetIdleFc()函数注册的“空闲函数指针“
if (m_pIdleFc != NULL)
{
m_pIdleFc((CObject*)this);
}
}
(2)注册TCP/IP协议栈的函数AfxRegisterNetcardEntry()源代码如下
BOOL AfxRegisterNetcardEntry(BOOL (*pSocketInitFc)(),
BOOL (*pSocketCloseFc)(), BOOL (*pSocketLoopFc)(BOOL, BOOL, BOOL))
{
if (pSocketInitFc == NULL || pSocketCloseFc == NULL)
{
return(FALSE);
}
__pSocketInitFc = pSocketInitFc;
__pSocketCloseFc = pSocketCloseFc;
__pSocketLoopFc = pSocketLoopFc;
return(TRUE);
}
(3)WinSail默认的
套接字初始化函数:GlobalInitSocket()函数
套接字关闭函数是:GlobalCloseSocket()函数
套接字循环函数:EthernetEntry()函数
EthernetEntry只处理ARP、RARP、ICMP请求以及没有发送的数据包及时发送出去,对于其它的请求则被忽略。
所以用户应用还需要重新编写自己的“套接字循环函数”。
//下面是用户自己编写的“套接字循环函数”。这个可以参照Sail3000工程的Sail2000.Cpp文件和Remote_N.Cpp文件,它实现了“文件传输、键盘按键下发、鼠标按键下发、屏幕上传、QQ聊天”等功能。
BOOL User_EthernetEntry(BOOL bSingle, BOOL bSend, BOOL bIcmp)
{
//运行默认的套接字循环函数
::EthernetEntry(bSingle, bSend, bIcmp);
//下面编写自己的SOCKET查询、读、写等等
//(略)
return(TRUE);
}
(4)由于WINSAIL运行于单任务中,所以任何地方的长时间堵塞,都会造成TCP/IP的长期堵塞。为了减少这情况,在堵塞的循环中,须调用
User_EthernetEnty(TRUE, TRUE, TRUE);
(5)如果用户注册第三方的TCP/IP栈(如Watcp等),初始化函数成功须返回TRUE,否则返回FALSE,WinSail自动对初始化函数的返回标志对bAfxInitSocket变量置位,同时别忘了配置config.Sys文件中的“Netcard”段的“netCard”键值置成 TRUE,方能与WinSail完美结合!
在WINSAIL里面的InitSystem()函数是这样初始化TCP/IP协议栈的:
bAfxInitSocket = FALSE;
if (bAfxNetcard && __pSocketInitFc != NULL &&
__pSocketCloseFc != NULL)
{
if (!__pSocketInitFc())
{
__pSocketCloseFc();
bAfxInitSocket = FALSE;
//AfxMessageBox("网络","无法加载网络!");
}
else
{
bAfxInitSocket = TRUE;
}
}
Last edited by firstsail on 2009-5-16 at 02:25 ]
In order to let everyone know how WINSAIL schedules TCP/IP in a single-task system, the following explanations are made!
(1) In the CWindow::OnIdle(CObject* pObj) function of the window, the socket loop function pointed to by the TCP/IP loop processing entry function pointer pSocketLoopFc is called.
The source code of CWindow::OnIdle(CObject* pObj) is as follows
extern BOOL bAfxNetcard; // Flag indicating whether a network card is configured in the CONFIG.Sys file
extern BOOL bAfxInitSocket; // Flag indicating whether the socket is successfully initialized
extern BOOL (*__pSocketInitFc)(); // Socket initialization function pointer
extern BOOL (*__pSocketCloseFc)();// Socket closing function pointer
extern BOOL (*__pSocketLoopFc)(BOOL, BOOL, BOOL);// Socket loop function pointer
void CWindow::OnIdle()
{
// Here, it is judged whether the TCP/IP stack needs to be executed
if (bAfxNetcard && bAfxInitSocket && __pSocketLoopFc != NULL)
{
__pSocketLoopFc(TRUE, TRUE, TRUE);
}
// Here, the "idle function pointer" registered by the void CWindow::SetIdleFc() function is executed
if (m_pIdleFc != NULL)
{
m_pIdleFc((CObject*)this);
}
}
(2) The source code of the function AfxRegisterNetcardEntry() for registering the TCP/IP protocol stack is as follows
BOOL AfxRegisterNetcardEntry(BOOL (*pSocketInitFc)(),
BOOL (*pSocketCloseFc)(), BOOL (*pSocketLoopFc)(BOOL, BOOL, BOOL))
{
if (pSocketInitFc == NULL || pSocketCloseFc == NULL)
{
return(FALSE);
}
__pSocketInitFc = pSocketInitFc;
__pSocketCloseFc = pSocketCloseFc;
__pSocketLoopFc = pSocketLoopFc;
return(TRUE);
}
(3) The default in WinSail
The socket initialization function: GlobalInitSocket() function
The socket closing function is: GlobalCloseSocket() function
The socket loop function: EthernetEntry() function
EthernetEntry only processes ARP, RARP, ICMP requests and sends out the packets that have not been sent in time, and other requests are ignored.
So users still need to rewrite their own "socket loop function".
// The following is the user's own "socket loop function". This can refer to the Sail2000.Cpp file and Remote_N.Cpp file of the Sail3000 project, which implements functions such as "file transfer, keyboard key sending, mouse key sending, screen uploading, QQ chatting".
BOOL User_EthernetEntry(BOOL bSingle, BOOL bSend, BOOL bIcmp)
{
// Run the default socket loop function
::EthernetEntry(bSingle, bSend, bIcmp);
// Write your own SOCKET query, read, write, etc. below
// (omitted)
return(TRUE);
}
(4) Since WINSAIL runs in a single task, any long-term blocking anywhere will cause the TCP/IP to be blocked for a long time. In order to reduce this situation, in the blocking loop, you must call
User_EthernetEnty(TRUE, TRUE, TRUE);
(5) If the user registers a third-party TCP/IP stack (such as Watcp, etc.), the initialization function must return TRUE if it is successful, otherwise return FALSE. WinSail automatically sets the return flag of the initialization function to the bAfxInitSocket variable, and don't forget to set the "netCard" key value in the "Netcard" segment of the config.Sys file to TRUE to perfectly integrate with WinSail!
The InitSystem() function in WINSAIL initializes the TCP/IP protocol stack in this way:
bAfxInitSocket = FALSE;
if (bAfxNetcard && __pSocketInitFc != NULL &&
__pSocketCloseFc != NULL)
{
if (!__pSocketInitFc())
{
__pSocketCloseFc();
bAfxInitSocket = FALSE;
//AfxMessageBox("Network","Failed to load network!");
}
else
{
bAfxInitSocket = TRUE;
}
}
Last edited by firstsail on 2009-5-16 at 02:25 ]
|
|
2009-5-16 01:11 |
|
|
zhiming420
新手上路

积分 5
发帖 3
注册 2009-11-9
状态 离线
|
|
2009-11-15 09:08 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 278 楼』:
使用 LLM 解释/回答一下
网站因地址解析错误,导致网站几个月不能正常登录.现在终于可以登录了!
The website couldn't be logged in normally for several months due to an address resolution error. Now it can finally be logged in!
|
|
2010-7-5 14:17 |
|
|
houwenhui
新手上路

积分 14
发帖 9
注册 2010-7-3
状态 离线
|
『第 279 楼』:
使用 LLM 解释/回答一下
太神奇了 看不懂啊
That's amazing. I don't understand it.
|
|
2010-7-9 13:56 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 280 楼』:
WinSail的MakeDlg.Exe文件升级
使用 LLM 解释/回答一下
WinSail的MakeDlg.Exe文件升级
增高了两个选项
(1)将CLabel和CGroup控件解释成非控件
(2)将CGroup坐标与Windows对齐
<1>如果选中"CLabel和CGroup控件解释成非控件"选项, 则将所有的CLabel与CGroup控件的生成代码被注释,并且生成void FAR OnDraw_VccFunction(CObject *)函数,函数内部生成代码如下:
其中CLabel控件解释成ChPrintf()函数
其中CGroup控件解释成DrawBoxCaptionEx()函数
这样设计的目的是为了节省宝贵的内存
<2>如果选中"将CGroup坐标与Windows对齐"选项, 则WinSail的Group控件与Windows的Group控件的可视边框区域相同,强列推荐使用该选项.
下载地址: http://www.firstsail.com.cn/software.html
Last edited by firstsail on 2011-1-14 at 11:23 ]
Upgrading the MakeDlg.Exe File of WinSail
Two options are increased
(1) Interpret CLabel and CGroup controls as non-controls
(2) Align CGroup coordinates with Windows
<1> If the option "Interpret CLabel and CGroup controls as non-controls" is selected, then the generation code of all CLabel and CGroup controls is commented out, and the void FAR OnDraw_VccFunction(CObject *) function is generated. The code inside the function is as follows:
Among them, the CLabel control is interpreted as the ChPrintf() function
Among them, the CGroup control is interpreted as the DrawBoxCaptionEx() function
The purpose of such design is to save precious memory
<2> If the option "Align CGroup coordinates with Windows" is selected, then the visible border area of the Group control of WinSail is the same as that of the Windows Group control. It is strongly recommended to use this option.
Download address: http://www.firstsail.com.cn/software.html
Last edited by firstsail on 2011-1-14 at 11:23 ]
|
|
2011-1-14 11:15 |
|
|
wuhengsi
新手上路

积分 10
发帖 5
注册 2010-11-7
状态 离线
|
|
2011-1-16 00:48 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
|
2011-1-19 10:16 |
|
|
f371575950
新手上路

积分 10
发帖 5
注册 2016-12-24
状态 离线
|
|
2016-12-24 23:58 |
|
|
firstsail2
新手上路

积分 5
发帖 4
注册 2017-5-16
状态 离线
|
|
2018-7-13 20:16 |
|
|
firstsail
高级用户
   
积分 668
发帖 295
注册 2005-7-26 来自 广东深圳
状态 离线
|
『第 285 楼』:
如果定制可移值的Excel能识别的数据库
使用 LLM 解释/回答一下
在单片机系统,或Linux系统中,经常要用到自定义的数据库,该数据库文件希望能被Windows下的Office Excel识别,怎么办呢?现在有一个方法,可以使用Foxpro2.6版本的数据库,文件结构是公开的,且可被Excel识别。
在WinSail中,由Foxpro.h和Foxpro.Cpp文件组成,稍后会公开所有源代码上来,如果有需要的人士可以移值!
In a single - chip microcomputer system or a Linux system, a custom database is often needed. How to make this database file recognizable by Office Excel under Windows? Now there is a method. You can use the database of Foxpro 2.6 version. The file structure is open and can be recognized by Excel.
In WinSail, it is composed of Foxpro.h and Foxpro.Cpp files. All the source code will be made public later. Those who need it can port it!
|
|
2018-7-14 12:08 |
|