主题:一个CS的主程序,望有高人给我解释一下!万分感谢
* * 2003/11/21 《星级酒店管理》系统 主程序
* * 作者:刘雪均
* * 版权所有 (C) 2003 宝明城大酒店
* * 广东深圳市公明镇长春花园
* * 深圳, 广东 518106
* * 中国
* * 说明: 版权所有,严禁非法复制,违者必穷
Clear
Clear All
Clear Dlls
Clear Macros
Close All
Set Talk Off
Set Safe Off
Set Escape Off
Set Debug Off
Set Exact Off
Set Sysmenu Save
Set Sysmenu To
Set Sysmenu Off
Set NullDisplay To ''
Set Null Off
Set Dohistory Off
Set Notify Cursor Off
Release Windows
Close Databases
Set Date To YMD
Set Hour To 24
Set Seconds Off
Set Century On
Set Deleted On
Set Resource On
Set Help On
On Shutdown Quit
Set Clock Off
With _Screen
.WindowState=2
.ZOOMBOX=.F.
.Movable=.F.
.MinButton=.F.
.MaxButton=.F.
.Closable=.F.
.Icon="Ball.ICO"
.Caption='《星级酒店管理》系统--均维软件工作室'
.LockScreen=.T.
.AddObject('ScreenImg','Image')
.ScreenImg.Stretch=2
.ScreenImg.Visible=.T.
.ScreenImg.Height=Sysmetric(2)-50
.ScreenImg.Width=Sysmetric(1)
.ScreenImg.Picture='DeskTopr.jpg'
.LockScreen=.F.
Endwith
=Capslock(.T.)
=Numlock(.T.)
Public TempFile,ExePath,CurWinDir,CurPic,pCompany,ReportFile,pTeamId,pUserGroup,pUserId,pUserName,sConn,gcUpdateId,;
m.Date_From,m.Date_To,nConn,OFBLX,OFBLY,Times
Store 0 To nConn,OFBLX,OFBLY,Times
Store Date() To m.Date_From,m.Date_To
Store '' To TempFile,ExePath,CurWinDir,CurPic,pCompany,ReportFile,sConn,pTeamId,pUserGroup,pUserId,pUserName
TempFile='T'+Right(Sys(2015),7)
CurWinDir=Getenv('WinDir')
ExePath=Left(Sys(16,1),Rat("\",Sys(16,1)))
Set Default To (ExePath)
Set Resource To &ExePath.FoxUser.Dbf
Set Path To &ExePath.;&ExePath.HelpS
If !Directory("&ExePath.Temp")
Md &ExePath.Temp
Endif
Tmpfiles="&ExePath.Temp" &&设定当前VFP使用的临时文件目录
=DelTmpFile() &&删除当前用户系统目录和VFP目录的过时的临时文件
*!* SET HELP TO &ExePath.HelpS\Hotel.CHM
If !File('MYDLL.DLL')
Messagebox('MYDLL.DLL丢失,程序不能正常运行!',48,'系统提示')
Quit
Endif
Declare String getserial In "MyDll.dll" Integer &&获得硬盘厂商物理永久性的ID
Declare String num2txt_c In "MyDll.dll" As RMBZH Double &&小写金额转换成大写金额
Declare String topy In "MyDll.dll" String &&汉字转拼音首字母
Declare Integer changeres In "MyDll.dll" Integer, Integer &&分变率设定
Declare Integer WinExec In "kernel32" String,Integer
Declare Integer FindWindow In Win32api String, String
Declare Long BringWindowToTop In Win32API Long
Declare Long ShowWindow In Win32API Long, Long
Declare Integer SendMessage In user32 Integer,Integer,Integer,Integer
Declare Integer ShellExecute In SHELL32.Dll Integer, String, String, String, String, Integer
Declare Integer GetPrivateProfileString In Win32API As GetPrivStr String, String, String, String @, Integer, String
Declare Integer WritePrivateProfileString In Win32API As WritePrivStr String, String, String, String
Declare SHORT SetLocalTime In win32api String SystemTime
*!* Declare integer ShowWindowAsync in user32 integer hwnd, integer nCmdShow
*!* htaskbar = FindWindow("Shell_TrayWnd",0)
*!* ShowWindowAsync(htaskbar,0) &&0为隐藏任务栏,1为显示任务栏
Set Class To MyLibs Additive &&使用自已的类库
On Error Do Err_Fix With Error( ),Message( ),Message(1), Program( ),Lineno( ) &&错误跟踪处理
If !File("&ExePath.LXJ.INI") &&判断配置文件存在否,不存在就创建。
=WriteIni('REGISTRY','Local_Id',Str(DiskSpace(Sys(5),1)),'&ExePath.LXJ.INI')
=WriteIni('REGISTRY','Reg_Date',Ttoc(Datetime()),'&ExePath.LXJ.INI')
=WriteIni('REGISTRY',' ','======================','&ExePath.LXJ.INI')
=WriteIni('AUTHOR','Contact','刘 雪 均','&ExePath.LXJ.INI')
=WriteIni('AUTHOR','Title','电脑工程师','&ExePath.LXJ.INI')
=WriteIni('AUTHOR','Telephone','13613026728','&ExePath.LXJ.INI')
=WriteIni('AUTHOR',' ','======================','&ExePath.LXJ.INI')
=WriteIni('SCREEN','RandomLoad','Yes','&ExePath.LXJ.INI')
=WriteIni('SCREEN','SourceXY','Yes','&ExePath.LXJ.INI')
=WriteIni('SCREEN','Picture ','Picture.JPG','&ExePath.LXJ.INI')
=WriteIni('SCREEN','StatusBar ','On','&ExePath.LXJ.INI')
=WriteIni('SCREEN','','======================','&ExePath.LXJ.INI')
=WriteIni('CONNECT','DRIVER','SQL SERVER','&ExePath.LXJ.INI')
=WriteIni('CONNECT','SERVER',GETENV("COMPUTERNAME"),'&ExePath.LXJ.INI')
=WriteIni('CONNECT','PORTNO','1433','&ExePath.LXJ.INI')
=WriteIni('CONNECT','UID','SA','&ExePath.LXJ.INI')
=WriteIni('CONNECT','PWD','DBA','&ExePath.LXJ.INI')
=WriteIni('CONNECT','DATABASE','HOTEL','&ExePath.LXJ.INI')
=WriteIni('CONNECT',' ','======================','&ExePath.LXJ.INI')
=WriteIni('USER','LastUser','Guest','&ExePath.LXJ.INI')
=WriteIni('USER',' ','======================','&ExePath.LXJ.INI')
=WriteIni('UPDATE','NewExe','&ExePath.Main.EXE','&ExePath.LXJ.INI') &&工作站自动升级的共享目录
=WriteIni('UPDATE','NewInfo','欢迎使用本系统!','&ExePath.LXJ.INI') &&提示的信息
=WriteIni('UPDATE',' ','======================','&ExePath.LXJ.INI')
=WriteIni('OCXDLLREG',GETENV("COMPUTERNAME"),'NO','&ExePath.LXJ.INI')
Endif
If Upper(ReadIni('SCREEN','StatusBar','&ExePath.LXJ.INI'))='ON'
Set Status Bar On
_vfp.StatusBar=' 欢 迎 您 使 用 本 系 统 . . . '
Else
Set Status Bar Off
Endif
=OleRegister() &&根据INI文件判断是否注册OCX,DLL文件
=SetShortCut('酒店管理') &&在屏幕上创建快捷方式
*!*工作站是否注册判断
If ReadIni('REGISTRY','Local_Id','&ExePath.LXJ.INI')!=WorkJm(Iif(Empty(GetSerial(0)),Str(Diskspace(Sys(5),1)),Allt(GetSerial(0))),'HTL')
Do Form RegWork.SCX &&调用本工作站使用注册表单
Endif
Wait Window "正在连接 SQL SERVER 数据库 ,请稍候 ...... " At Srows()/2-10,(Scol()-45)/2 Nowait Noclear
SQLSETPROP(0,"DispLogin" ,3) &&连接不成功时不显示ODBC登录对话窗口
SQLSETPROP(0,"ConnectTimeOut",20) &&连接超时等待秒数设置,可取值0至600
SQLSETPROP(0,"IdleTimeout",0) &&空闲超时间隔秒数,取0为无限期等待
SQLSETPROP(0,"QueryTimeOut",20) &&超时错误之前等待的时间
SQLSETPROP(0,"Asynchronous",.F.) &&指定结果集合是同步返回
SQLSETPROP(0,"DispWarnings",.F.) &&不显示一个错误信息
*!*从配置文件中获得SQL SERVER的加密连接串
sConn='DRIVER=SQL SERVER'
sConn=sConn+'; SERVER='+Iif(Empty(ReadIni('CONNECT','SERVER','&ExePath.LXJ.INI')),GETENV("COMPUTERNAME"),ReadIni('CONNECT','SERVER','&ExePath.LXJ.INI'))
sConn=sConn+','+Iif(Empty(ReadIni('CONNECT','PORTNO','&ExePath.LXJ.INI')),'1433',ReadIni('CONNECT','PORTNO','&ExePath.LXJ.INI'))
sConn=sConn+';UID='+ReadIni('CONNECT','UID','&ExePath.LXJ.INI')
sConn=sConn+';PWD='+Iif(Empty(ReadIni('CONNECT','PWD','&ExePath.LXJ.INI')),'',JmWd(ReadIni('CONNECT','PWD','&ExePath.LXJ.INI')))
sConn=sConn+';DATABASE='+Iif(Empty(ReadIni('CONNECT','DATABASE','&ExePath.LXJ.INI')),'NoDatabase',ReadIni('CONNECT','DATABASE','&ExePath.LXJ.INI'))
sConn=sConn+';NetWork=DBMSSOCN'
nConn=Sqlstringconnect(sConn)
Wait Clear
Do While nConn<=0
Local YN
YN=Messagebox('SQL Server 数据库连接失败,请选择 !'+Chr(13)+Chr(13)+"Y ->重试 , N ->设定 , 取消 ->退出 !",67 ,'SQL Connect Info.')
_Screen.Refresh
Do Case
Case YN=6
Wait Window "正在连接 SQL SERVER 数据库 ,请稍候 ...... " At Srows()/2-10,(Scol()-45)/2 Nowait Noclear
nConn=Sqlstringconnect(sConn)
Wait Clear
Case YN=7
Do Form SetServer.SCX &&SQL SERVER服务器连接配置
Otherwise
Quit
Endcase
Enddo
*!*下面是测试连接有效否,有效就检测服务器注册及过期情况等
If IsConn()
=GetServerTime() &&设定当前机器时间为服务器的时间
If SQLEXEC(nConn,'Select * From Registry','MyCursor')>0
Select MyCursor
pCompany=Alltrim(MyCursor.Corp)
If Alltrim(MyCursor.RegKey)!=Alltrim(ServerJm(Dtoc(Ttod(MyCursor.EndTime))-TOPY(pCompany)-Dtoc(Ttod(MyCursor.BeginTime)),'HTL'))
Do Form RegServer.SCX &&调用注册SQL SERVER服务器使用权表单
Endif
If MyCursor.BeginTime>Date()
Messagebox('系统时间小于注册时间,程序不可运行!',16,'Information',3000)
Quit
Endif
If MyCursor.EndTime<DATE()
Messagebox('系统使用期限已到,请重新注册!',16,'Information',3000)
Do Form RegServer.SCX
Endif
If MyCursor.EndTime<=Date()+7
Messagebox('1、使用期限快到,程序将在 '+Alltrim(MyCursor.EndTime)+' 后终止运行,切记!'+Chr(13)+Chr(13)+'2、请尽快同 刘雪均 联系(E-MAIL:CQTony@tom.com),谢谢!',64 ,'系统提示')
Endif
Else
Messagebox('注册信息查询失败,请等会重试!',16,'Information',3000)
=SQLDisConnect(0)
Quit
Endif
Else
Messagebox('后台数据库连接失败,请等会重试!',16,'Information',3000)
=SQLDIsConnect(0)
Quit
Endif
If Empty(pCompany)
cTitle="【 星 级 酒 店 管 理 系 统 】"
Else
cTitle="【 &pCompany. --- 酒店管理系统 】"
Endif
m.LNHWND=FindWindow(0,cTitle)
If m.LNHWND<>0
Wait Window "重 复 提 示 : 程 序 已 经 运 行 !" At Srows()/2-3,(Scol()-34)/2 Timeout 2
BringWindowToTop(m.LNHWND)
ShowWindow(m.LNHWND,3)
Quit
Endif
*!*分变率处理,如果低于800*600就修改为800*600,否则就从配置文件进行相应处理,程序本身有自动适应功能。
OFBLX=Sysmetric(1)
OFBLY=Sysmetric(2)
If OFBLX<800 Or (Upper(ReadIni('SCREEN','SourceXY','&ExePath.LXJ.INI'))='YES' And OFBLX<>800)
CHANGERES(800,600)
OFBLX=800
OFBLY=600
_Screen.ScreenImg.Height=600-50
_Screen.ScreenImg.Width=800
Endif
*!*下面是背景图自动随机调用或是调用用户设定的固定图片处理
If Upper(ReadIni('SCREEN','RandomLoad','&ExePath.LXJ.INI'))='YES'
Set Default To &ExePath.PictureS
FileNo=Adir(PicFile,"*.JPG")
If FileNo>0
FileNo=Int(Rand(Seconds())*FileNo)+1
CurPic =PicFile[FileNo,1]
Else
CurPic=ReadIni('SCREEN','Picture','&ExePath.LXJ.INI')
Endif
Release FileNo,PicFile,LNHWND
Set Default To &ExePath.
CurPic=ExePath+'PictureS\'+CurPic
Else
CurPic=ReadIni('SCREEN','Picture','&ExePath.LXJ.INI')
Endif
If !File(CurPic)
CurPic='DeskTopr.jpg'
Endif
_Screen.ScreenImg.Picture=CurPic
_Screen.Caption=cTitle
_Screen.Refresh
Do Form Login.SCX &&运行登录用密码校验界面
Read Events
=VFP_INIT()
Return
Function VFP_INIT
With _Screen
.ZOOMBOX=.T.
.MinButton=.T.
.MaxButton=.T.
.BorderStyle=2
.Closable=.T.
.Movable=.T.
.Icon=""
.Caption=Chr(49653)+Chr(53673)+Chr(48889)
Endwith
Close Databases All
Close Tables All
Release Windows
Set Sysmenu To Default
Set Sysmenu On
Set Deleted Off
Set Procedure To
Set Exclusive On
Set Multilocks Off
Set Library To
Set Talk On
Set Escap On
Set Safe On
Set Exact Off
Close All
Clear Dlls
Clear All
Clear
On Key
On Error
On Escap
Return
Endfunc
* * 作者:刘雪均
* * 版权所有 (C) 2003 宝明城大酒店
* * 广东深圳市公明镇长春花园
* * 深圳, 广东 518106
* * 中国
* * 说明: 版权所有,严禁非法复制,违者必穷
Clear
Clear All
Clear Dlls
Clear Macros
Close All
Set Talk Off
Set Safe Off
Set Escape Off
Set Debug Off
Set Exact Off
Set Sysmenu Save
Set Sysmenu To
Set Sysmenu Off
Set NullDisplay To ''
Set Null Off
Set Dohistory Off
Set Notify Cursor Off
Release Windows
Close Databases
Set Date To YMD
Set Hour To 24
Set Seconds Off
Set Century On
Set Deleted On
Set Resource On
Set Help On
On Shutdown Quit
Set Clock Off
With _Screen
.WindowState=2
.ZOOMBOX=.F.
.Movable=.F.
.MinButton=.F.
.MaxButton=.F.
.Closable=.F.
.Icon="Ball.ICO"
.Caption='《星级酒店管理》系统--均维软件工作室'
.LockScreen=.T.
.AddObject('ScreenImg','Image')
.ScreenImg.Stretch=2
.ScreenImg.Visible=.T.
.ScreenImg.Height=Sysmetric(2)-50
.ScreenImg.Width=Sysmetric(1)
.ScreenImg.Picture='DeskTopr.jpg'
.LockScreen=.F.
Endwith
=Capslock(.T.)
=Numlock(.T.)
Public TempFile,ExePath,CurWinDir,CurPic,pCompany,ReportFile,pTeamId,pUserGroup,pUserId,pUserName,sConn,gcUpdateId,;
m.Date_From,m.Date_To,nConn,OFBLX,OFBLY,Times
Store 0 To nConn,OFBLX,OFBLY,Times
Store Date() To m.Date_From,m.Date_To
Store '' To TempFile,ExePath,CurWinDir,CurPic,pCompany,ReportFile,sConn,pTeamId,pUserGroup,pUserId,pUserName
TempFile='T'+Right(Sys(2015),7)
CurWinDir=Getenv('WinDir')
ExePath=Left(Sys(16,1),Rat("\",Sys(16,1)))
Set Default To (ExePath)
Set Resource To &ExePath.FoxUser.Dbf
Set Path To &ExePath.;&ExePath.HelpS
If !Directory("&ExePath.Temp")
Md &ExePath.Temp
Endif
Tmpfiles="&ExePath.Temp" &&设定当前VFP使用的临时文件目录
=DelTmpFile() &&删除当前用户系统目录和VFP目录的过时的临时文件
*!* SET HELP TO &ExePath.HelpS\Hotel.CHM
If !File('MYDLL.DLL')
Messagebox('MYDLL.DLL丢失,程序不能正常运行!',48,'系统提示')
Quit
Endif
Declare String getserial In "MyDll.dll" Integer &&获得硬盘厂商物理永久性的ID
Declare String num2txt_c In "MyDll.dll" As RMBZH Double &&小写金额转换成大写金额
Declare String topy In "MyDll.dll" String &&汉字转拼音首字母
Declare Integer changeres In "MyDll.dll" Integer, Integer &&分变率设定
Declare Integer WinExec In "kernel32" String,Integer
Declare Integer FindWindow In Win32api String, String
Declare Long BringWindowToTop In Win32API Long
Declare Long ShowWindow In Win32API Long, Long
Declare Integer SendMessage In user32 Integer,Integer,Integer,Integer
Declare Integer ShellExecute In SHELL32.Dll Integer, String, String, String, String, Integer
Declare Integer GetPrivateProfileString In Win32API As GetPrivStr String, String, String, String @, Integer, String
Declare Integer WritePrivateProfileString In Win32API As WritePrivStr String, String, String, String
Declare SHORT SetLocalTime In win32api String SystemTime
*!* Declare integer ShowWindowAsync in user32 integer hwnd, integer nCmdShow
*!* htaskbar = FindWindow("Shell_TrayWnd",0)
*!* ShowWindowAsync(htaskbar,0) &&0为隐藏任务栏,1为显示任务栏
Set Class To MyLibs Additive &&使用自已的类库
On Error Do Err_Fix With Error( ),Message( ),Message(1), Program( ),Lineno( ) &&错误跟踪处理
If !File("&ExePath.LXJ.INI") &&判断配置文件存在否,不存在就创建。
=WriteIni('REGISTRY','Local_Id',Str(DiskSpace(Sys(5),1)),'&ExePath.LXJ.INI')
=WriteIni('REGISTRY','Reg_Date',Ttoc(Datetime()),'&ExePath.LXJ.INI')
=WriteIni('REGISTRY',' ','======================','&ExePath.LXJ.INI')
=WriteIni('AUTHOR','Contact','刘 雪 均','&ExePath.LXJ.INI')
=WriteIni('AUTHOR','Title','电脑工程师','&ExePath.LXJ.INI')
=WriteIni('AUTHOR','Telephone','13613026728','&ExePath.LXJ.INI')
=WriteIni('AUTHOR',' ','======================','&ExePath.LXJ.INI')
=WriteIni('SCREEN','RandomLoad','Yes','&ExePath.LXJ.INI')
=WriteIni('SCREEN','SourceXY','Yes','&ExePath.LXJ.INI')
=WriteIni('SCREEN','Picture ','Picture.JPG','&ExePath.LXJ.INI')
=WriteIni('SCREEN','StatusBar ','On','&ExePath.LXJ.INI')
=WriteIni('SCREEN','','======================','&ExePath.LXJ.INI')
=WriteIni('CONNECT','DRIVER','SQL SERVER','&ExePath.LXJ.INI')
=WriteIni('CONNECT','SERVER',GETENV("COMPUTERNAME"),'&ExePath.LXJ.INI')
=WriteIni('CONNECT','PORTNO','1433','&ExePath.LXJ.INI')
=WriteIni('CONNECT','UID','SA','&ExePath.LXJ.INI')
=WriteIni('CONNECT','PWD','DBA','&ExePath.LXJ.INI')
=WriteIni('CONNECT','DATABASE','HOTEL','&ExePath.LXJ.INI')
=WriteIni('CONNECT',' ','======================','&ExePath.LXJ.INI')
=WriteIni('USER','LastUser','Guest','&ExePath.LXJ.INI')
=WriteIni('USER',' ','======================','&ExePath.LXJ.INI')
=WriteIni('UPDATE','NewExe','&ExePath.Main.EXE','&ExePath.LXJ.INI') &&工作站自动升级的共享目录
=WriteIni('UPDATE','NewInfo','欢迎使用本系统!','&ExePath.LXJ.INI') &&提示的信息
=WriteIni('UPDATE',' ','======================','&ExePath.LXJ.INI')
=WriteIni('OCXDLLREG',GETENV("COMPUTERNAME"),'NO','&ExePath.LXJ.INI')
Endif
If Upper(ReadIni('SCREEN','StatusBar','&ExePath.LXJ.INI'))='ON'
Set Status Bar On
_vfp.StatusBar=' 欢 迎 您 使 用 本 系 统 . . . '
Else
Set Status Bar Off
Endif
=OleRegister() &&根据INI文件判断是否注册OCX,DLL文件
=SetShortCut('酒店管理') &&在屏幕上创建快捷方式
*!*工作站是否注册判断
If ReadIni('REGISTRY','Local_Id','&ExePath.LXJ.INI')!=WorkJm(Iif(Empty(GetSerial(0)),Str(Diskspace(Sys(5),1)),Allt(GetSerial(0))),'HTL')
Do Form RegWork.SCX &&调用本工作站使用注册表单
Endif
Wait Window "正在连接 SQL SERVER 数据库 ,请稍候 ...... " At Srows()/2-10,(Scol()-45)/2 Nowait Noclear
SQLSETPROP(0,"DispLogin" ,3) &&连接不成功时不显示ODBC登录对话窗口
SQLSETPROP(0,"ConnectTimeOut",20) &&连接超时等待秒数设置,可取值0至600
SQLSETPROP(0,"IdleTimeout",0) &&空闲超时间隔秒数,取0为无限期等待
SQLSETPROP(0,"QueryTimeOut",20) &&超时错误之前等待的时间
SQLSETPROP(0,"Asynchronous",.F.) &&指定结果集合是同步返回
SQLSETPROP(0,"DispWarnings",.F.) &&不显示一个错误信息
*!*从配置文件中获得SQL SERVER的加密连接串
sConn='DRIVER=SQL SERVER'
sConn=sConn+'; SERVER='+Iif(Empty(ReadIni('CONNECT','SERVER','&ExePath.LXJ.INI')),GETENV("COMPUTERNAME"),ReadIni('CONNECT','SERVER','&ExePath.LXJ.INI'))
sConn=sConn+','+Iif(Empty(ReadIni('CONNECT','PORTNO','&ExePath.LXJ.INI')),'1433',ReadIni('CONNECT','PORTNO','&ExePath.LXJ.INI'))
sConn=sConn+';UID='+ReadIni('CONNECT','UID','&ExePath.LXJ.INI')
sConn=sConn+';PWD='+Iif(Empty(ReadIni('CONNECT','PWD','&ExePath.LXJ.INI')),'',JmWd(ReadIni('CONNECT','PWD','&ExePath.LXJ.INI')))
sConn=sConn+';DATABASE='+Iif(Empty(ReadIni('CONNECT','DATABASE','&ExePath.LXJ.INI')),'NoDatabase',ReadIni('CONNECT','DATABASE','&ExePath.LXJ.INI'))
sConn=sConn+';NetWork=DBMSSOCN'
nConn=Sqlstringconnect(sConn)
Wait Clear
Do While nConn<=0
Local YN
YN=Messagebox('SQL Server 数据库连接失败,请选择 !'+Chr(13)+Chr(13)+"Y ->重试 , N ->设定 , 取消 ->退出 !",67 ,'SQL Connect Info.')
_Screen.Refresh
Do Case
Case YN=6
Wait Window "正在连接 SQL SERVER 数据库 ,请稍候 ...... " At Srows()/2-10,(Scol()-45)/2 Nowait Noclear
nConn=Sqlstringconnect(sConn)
Wait Clear
Case YN=7
Do Form SetServer.SCX &&SQL SERVER服务器连接配置
Otherwise
Quit
Endcase
Enddo
*!*下面是测试连接有效否,有效就检测服务器注册及过期情况等
If IsConn()
=GetServerTime() &&设定当前机器时间为服务器的时间
If SQLEXEC(nConn,'Select * From Registry','MyCursor')>0
Select MyCursor
pCompany=Alltrim(MyCursor.Corp)
If Alltrim(MyCursor.RegKey)!=Alltrim(ServerJm(Dtoc(Ttod(MyCursor.EndTime))-TOPY(pCompany)-Dtoc(Ttod(MyCursor.BeginTime)),'HTL'))
Do Form RegServer.SCX &&调用注册SQL SERVER服务器使用权表单
Endif
If MyCursor.BeginTime>Date()
Messagebox('系统时间小于注册时间,程序不可运行!',16,'Information',3000)
Quit
Endif
If MyCursor.EndTime<DATE()
Messagebox('系统使用期限已到,请重新注册!',16,'Information',3000)
Do Form RegServer.SCX
Endif
If MyCursor.EndTime<=Date()+7
Messagebox('1、使用期限快到,程序将在 '+Alltrim(MyCursor.EndTime)+' 后终止运行,切记!'+Chr(13)+Chr(13)+'2、请尽快同 刘雪均 联系(E-MAIL:CQTony@tom.com),谢谢!',64 ,'系统提示')
Endif
Else
Messagebox('注册信息查询失败,请等会重试!',16,'Information',3000)
=SQLDisConnect(0)
Quit
Endif
Else
Messagebox('后台数据库连接失败,请等会重试!',16,'Information',3000)
=SQLDIsConnect(0)
Quit
Endif
If Empty(pCompany)
cTitle="【 星 级 酒 店 管 理 系 统 】"
Else
cTitle="【 &pCompany. --- 酒店管理系统 】"
Endif
m.LNHWND=FindWindow(0,cTitle)
If m.LNHWND<>0
Wait Window "重 复 提 示 : 程 序 已 经 运 行 !" At Srows()/2-3,(Scol()-34)/2 Timeout 2
BringWindowToTop(m.LNHWND)
ShowWindow(m.LNHWND,3)
Quit
Endif
*!*分变率处理,如果低于800*600就修改为800*600,否则就从配置文件进行相应处理,程序本身有自动适应功能。
OFBLX=Sysmetric(1)
OFBLY=Sysmetric(2)
If OFBLX<800 Or (Upper(ReadIni('SCREEN','SourceXY','&ExePath.LXJ.INI'))='YES' And OFBLX<>800)
CHANGERES(800,600)
OFBLX=800
OFBLY=600
_Screen.ScreenImg.Height=600-50
_Screen.ScreenImg.Width=800
Endif
*!*下面是背景图自动随机调用或是调用用户设定的固定图片处理
If Upper(ReadIni('SCREEN','RandomLoad','&ExePath.LXJ.INI'))='YES'
Set Default To &ExePath.PictureS
FileNo=Adir(PicFile,"*.JPG")
If FileNo>0
FileNo=Int(Rand(Seconds())*FileNo)+1
CurPic =PicFile[FileNo,1]
Else
CurPic=ReadIni('SCREEN','Picture','&ExePath.LXJ.INI')
Endif
Release FileNo,PicFile,LNHWND
Set Default To &ExePath.
CurPic=ExePath+'PictureS\'+CurPic
Else
CurPic=ReadIni('SCREEN','Picture','&ExePath.LXJ.INI')
Endif
If !File(CurPic)
CurPic='DeskTopr.jpg'
Endif
_Screen.ScreenImg.Picture=CurPic
_Screen.Caption=cTitle
_Screen.Refresh
Do Form Login.SCX &&运行登录用密码校验界面
Read Events
=VFP_INIT()
Return
Function VFP_INIT
With _Screen
.ZOOMBOX=.T.
.MinButton=.T.
.MaxButton=.T.
.BorderStyle=2
.Closable=.T.
.Movable=.T.
.Icon=""
.Caption=Chr(49653)+Chr(53673)+Chr(48889)
Endwith
Close Databases All
Close Tables All
Release Windows
Set Sysmenu To Default
Set Sysmenu On
Set Deleted Off
Set Procedure To
Set Exclusive On
Set Multilocks Off
Set Library To
Set Talk On
Set Escap On
Set Safe On
Set Exact Off
Close All
Clear Dlls
Clear All
Clear
On Key
On Error
On Escap
Return
Endfunc