多exe程序合成时,主程序调用子程序时,屏幕上会显示“sail200 触”,如何屏蔽呢?
......
settimefc()函数可否设定定时时间,dos下“嘟”得时间太短。有时不希望定时器工作太快。
默认情况下是55mS,现将它设置为110mS
void far OnTime_MyDialog(CObject* pObj)
{
CDialog* pDialog = (CDialog *)pObj;
//引入静态变量作为计时次数
static int nLoops = 0;
if ((++nLoops) < 2)
{
return;
}
nLoops = 0;
//这里加入您的代码
}
3。多行编辑框怎么设定最大字节数,或行最大字节数,或最大列数,这样在输入时不需回车就可自动换行。
//.....
4。能给个列表控件编辑和数据库相结合得例子吗?
BOOL LoadDatabase(CListBox* pListbox)
{
char buf;
char* pStrFile = "MyBase.Dbf";
//假设有一个数据库名称为“MyBase.Dbf”,其有三个字段
//其中索引为 2的字段是字符串字段
//打开数据库
CFoxpro mFoxpro;
if (!mFoxpro.Open (pStrFile))
{
::sprintf (buf, "文件开打错误\n---%s", pStrFile);
::AfxMessageBox("错误", buf, MB_OK);
return (FALSE);
}
//读索引为2的字段的属性
FOXPRO_FIELDS mFoxproFields = *(mFoxpro.GetFoxproFields(2));
//判断索引为2的字段是否为字符串字段
if (mFoxproFields.byStyle != 'C' && mFoxproFields.byStyle != 'c')
{
::sprintf (buf, "数据库非法\n---%s", pStrFile);
::AfxMessageBox("错误", buf, MB_OK);
return (FALSE);
}
int nMaxCh = (int)(WORD)mFoxproFields.byLength;
//得到数据库的总纪录数
long lgCount = mFoxpro.GetRecordCount();
//设置列表框每一行的最大字符数
pListBox->SetLineCharacter((nMaxCh == 255) ? 255 : nMaxzCh + 1);
//设置列表框的总项数为lgCount个
pListBox->SetCount (lgCount);
//循环读数据库的索引为2的字符串字段内容
for (long i = 0L; i < lgCount; i++)
{
//定位数据库
mFoxpro.Seek(i, SEEK_SET);
//读索引为2的字符串字段的值
mFoxpro.GetFieldString (2, buf);
//将读出来的值写入列表框
pListBox->SetSel(i, buf);
}
//关闭数据库
mFoxpro.Close();
return (TRUE);
}
Last edited by firstsail on 2008-2-27 at 11:27 AM ]
When combining multiple EXE programs, when the main program calls a subroutine, "sail200 触" is displayed on the screen. How to shield it?
......
Can the settimefc() function set the timing time? The "beep" time under DOS is too short. Sometimes it is not desired that the timer works too fast.
By default, it is 55ms, now set it to 110ms
void far OnTime_MyDialog(CObject* pObj)
{
CDialog* pDialog = (CDialog *)pObj;
//Introduce a static variable as the number of timing cycles
static int nLoops = 0;
if ((++nLoops) < 2)
{
return;
}
nLoops = 0;
//Add your code here
}
3. How to set the maximum number of bytes, or the maximum number of bytes per line, or the maximum number of columns for a multi-line edit box, so that automatic line wrapping can be done without pressing Enter when entering.
//.....
4. Can you give an example of combining list control editing with a database?
BOOL LoadDatabase(CListBox* pListbox)
{
char buf;
char* pStrFile = "MyBase.Dbf";
//Suppose there is a database named "MyBase.Dbf" which has three fields
//其中索引为 2的字段是字符串字段
//Open the database
CFoxpro mFoxpro;
if (!mFoxpro.Open (pStrFile))
{
::sprintf (buf, "File opening error\n---%s", pStrFile);
::AfxMessageBox("Error", buf, MB_OK);
return (FALSE);
}
//Read the properties of the field with index 2
FOXPRO_FIELDS mFoxproFields = *(mFoxpro.GetFoxproFields(2));
//Judge whether the field with index 2 is a string field
if (mFoxproFields.byStyle != 'C' && mFoxproFields.byStyle != 'c')
{
::sprintf (buf, "Illegal database\n---%s", pStrFile);
::AfxMessageBox("Error", buf, MB_OK);
return (FALSE);
}
int nMaxCh = (int)(WORD)mFoxproFields.byLength;
//Get the total number of records in the database
long lgCount = mFoxpro.GetRecordCount();
//Set the maximum number of characters per line of the list box
pListBox->SetLineCharacter((nMaxCh == 255) ? 255 : nMaxzCh + 1);
//Set the total number of items in the list box to lgCount
pListBox->SetCount (lgCount);
//Loop to read the content of the string field with index 2 in the database
for (long i = 0L; i < lgCount; i++)
{
//Locate the database
mFoxpro.Seek(i, SEEK_SET);
//Read the value of the string field with index 2
mFoxpro.GetFieldString (2, buf);
//Write the read value into the list box
pListBox->SetSel(i, buf);
}
//Close the database
mFoxpro.Close();
return (TRUE);
}
Last edited by firstsail on 2008-2-27 at 11:27 AM ]