📄 pubunit.pas
字号:
unit PubUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, QExtCtrls, ExtCtrls, MMSystem, Registry,
IniFiles, StrUtils, SUIForm, SUIDBCtrls, SUIThemes, SUIButton, SUIDlg,
TypInfo, DBTables ;
const
{mp3播放状态}
MP3STOP = 0 ;
MP3PLAY = 1 ;
MP3PAUSE = 2 ;
type
TSongList = record
SongName : string;//歌名
FileName : string;//歌曲全路经
end;
//Init mp3
//hInstance: instance of application
//hWnd: handle of window to display
//DisplayW, DisplayH: width and height
//bands: number of bars
function pvInitMp3(hInstance, hWnd, DisplayW, DisplayH, bands: integer): integer; stdcall; external 'pvmp3.dll';
//free. MUST call this before exit
procedure pvFreeMp3; stdcall; external 'pvmp3.dll';
//get the frequence and length of mp3
procedure pvGetMp3Info(pFileName: PChar; pFreq, pLen: pointer); stdcall; external 'pvmp3.dll';
//play mp3
function pvPlayMp3(pFileName: PChar): integer; stdcall; external 'pvmp3.dll';
//stop mp3
procedure pvStopMp3; stdcall; external 'pvmp3.dll';
//pasue mp3
procedure pvPauseMp3; stdcall; external 'pvmp3.dll';
//resume mp3
procedure pvResumeMp3; stdcall; external 'pvmp3.dll';
var
SysPath : string ;
Pub_SongListArr : array of TSongList ;//歌曲列表
P_SongName,P_SongFile : string ;//正在播放的歌曲名称
P_SongIndex : integer ;//歌曲索引值
SongFreq : Integer ;//歌曲侦数
PlayStatus : Integer;//播放状态
SongTimeLong : Integer ;//....歌曲长度
PlayTimeLong : Integer ;//已经播放时间
AutoPlayMp3 : Boolean ;//自动播放MP3文件
PicPath : String;//图片存放路径
P_StyleValue : integer ; //图片显示方式
P_ClearOldImage : Boolean ;//显示新的图片前清除老的图片
P_Threaded : Boolean; //采用线程模式显示
P_StepValue : integer ; //
P_ShowPause : integer ;
P_DelayValue : integer ;
P_RandomStyle : Boolean ;
P_TurnStyle : Boolean ;
P_AutoStyle : Boolean ;
P_ManualStyle : Boolean;
P_InterFace : integer;//界面代码
P_PicFileName : string;
P_SelectSfNo : Integer ;//所选择的省份编码
P_SelectDwNo : Integer ;//所选择的单位编码
P_SelectSfMc : string;//所选择的省份名称
P_SelectDwMc : string;//所选择的单位名称
{序列号定义}
P_BmPrefix : String;//序列号前缀
P_BmDigSf : Integer ;//几位省份
P_BmSpace : string ;//编码间隔
P_BmYear : string;//编码年
P_BmMonth : string;//编码月
P_BmDigXlh : Integer ;//序列号位数
P_Xlh : Integer ;//序列号
P_AppName : string ;//应用程序名称
P_DebugFlag : Boolean;//调试模式
P_SplashDelay : Integer ;//Splash延时时间
LoginUser : string ;//注册用户名
Super : Integer ;//权限
P_LoginUserName,P_LoginPwd : string;
procedure SaveSongList();//保存歌曲列表
procedure LoadSongList();//导入歌曲列表
procedure WriteIni ;
procedure ReadIni ;
//以下函数可以找到一个控件是否有某个属性
function FindProperty(AClass: TObject; sPropertyName: String): Boolean;
//======改变窗口的显示风格
Procedure ChangeInterface(MyForm : TForm; MysuiForm : TSuiForm);
//======显示BALLOON窗口提示
procedure ShowBalloonTip(Control: TWinControl; Icon: integer; Title: pchar; Text : PWideChar);
{延时函数}
procedure DelayMsec(DelayTime : LongInt);
//------------------------------------------------------------------------------
// 数据操作相关函数
//------------------------------------------------------------------------------
{改变应用程序的调试模式}
// procedure ChgDebugMode(Debuged : Boolean);
{打开所有的MSQUERY}
procedure OpenAllQuery();
{设置界面属性}
procedure SetReadOnly(Form : TForm; ReadOnly : Boolean; Color : TColor);
implementation
uses DataModule;
//------------------------------------------------------------------------------
// 数据操作相关函数
//------------------------------------------------------------------------------
{设置界面属性}
procedure SetReadOnly(Form : TForm; ReadOnly : Boolean; Color : TColor);
var CmCount, i : Integer ;
begin
CmCount := Form.ComponentCount ;
for i := 0 to CmCount - 1 do
begin
if (Form.Components[i] is TsuiDBEdit) then//suiDBEdit
begin
TsuiDBEdit(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBEdit(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBMemo) then//suiDbMemo
begin
TsuiDBMemo(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBMemo(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBImage) then//suiDBImage
begin
TsuiDBImage(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBImage(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBListBox) then//suiDBListBox
begin
TsuiDBListBox(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBListBox(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBComboBox) then//suiDBComboBox
begin
TsuiDBComboBox(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBComboBox(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBCheckBox) then//suiDBCheckBox
begin
TsuiDBCheckBox(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBCheckBox(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBRadioGroup) then//suiDBRadioGroup
begin
TsuiDBRadioGroup(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBRadioGroup(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBLookupListBox) then//suiDBLookupListBox
begin
TsuiDBLookupListBox(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBLookupListBox(Form.Components[i]).Color := Color ;
end;
if (Form.Components[i] is TsuiDBLookupComboBox) then//suiDBLookupComboBox
begin
TsuiDBLookupComboBox(Form.Components[i]).ReadOnly := ReadOnly ;
TsuiDBLookupComboBox(Form.Components[i]).Color := Color ;
end;
end;
end;
{改变应用程序的调试模式}
{ procedure ChgDebugMode(Debuged : Boolean);
var i,CmCount : Integer ;
begin
with DataModule1 do
begin
CmCount := ComponentCount ;
for i := 0 to CmCount - 1 do
if (Components[i] is TMSQuery) then
TMSQuery(Components[i]).Debug := Debuged ;
end;
end;}
{打开所有的MSQUERY}
procedure OpenAllQuery();
var i,CmCount : Integer ;
begin
with DataModule1 do
begin
CmCount := ComponentCount ;
for i := 0 to CmCount - 1 do
begin
if (Components[i] is TQuery) then
TQuery(Components[i]).Open ;
if (Components[i] is TTable) then
TTable(Components[i]).Active := True ;
end ;
end;
end;
//------------------------------------------------------------------------------
// 数据操作相关函数=====Over
//------------------------------------------------------------------------------
{延时函数}
procedure DelayMsec(DelayTime : LongInt);
var FirstTime : LongInt ;
begin
FirstTime := timeGetTime ;
repeat
Application.ProcessMessages ;
until ((timeGetTime - FirstTime) >= DelayTime);
end;
procedure SaveSongList();//保存歌曲列表
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -