50
lpFileName = App.Path + “\Sortition.ini"
X = GetPrivateProfileString(“SYSTEM",“AppTitle",“抽奖
程序", Temp, Len(Temp), lpFileName)
m_strAppTitle = Trim(Temp)
Temp =“"
X = GetPrivateProfileString(“SYSTEM", "Title", "欢迎使用抽奖
程序", Temp, Len(Temp), lpFileName)
m_strTitle = Trim(Temp)
Temp = “"
X = GetPrivateProfileString(“SYSTEM",“ScrollTitleRight", “恭喜发财!!!", Temp, Len(Temp), lpFileName)
m_strScrollTitleRight = Trim(Temp)
X = GetPrivateProfileString(“SYSTEM",“ScrollTitleLeft", “龙年大发!!!", Temp, Len(Temp), lpFileName)
m_strScrollTitleLeft = Trim(Temp)
Form_Bouns.Caption = m_strAppTitle
Label_CompanyTitle.Caption = m_strTitle
End Sub
模块源
程序:
''用于读取ini文件的API函数
Declare Function GetPrivateProfileString Lib “kernel32" Alias “GetPrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Type MyName
strName As String
bIsSelect As Boolean
End Type
由于
程序利用的windows ini文件保存一些标题信息,因而可以方便的修改使用环境,及标题内容。
见ini文件内容:
[SYSTEM]
;应用
程序的form名称
AppTitle=“风云电脑抽奖Test"
;窗口的内的标题(限9个字)
Title=“大抽奖"
;右滚动的文字(仅能为如下格式:XXXX!!!)
ScrollTitleRight=“恭喜发财!!!"
;左滚动的文字(仅能为如下格式:XXXX!!!)
ScrollTitleLeft=“祝您好运!!!"
如此一个小小的电脑抽奖程序便完成了。
以上程序在VB6.0 Windows98环境下编译通过