精心打造的New MMS Form(2)

2008-04-09 04:20:46来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

procedure TNewMMS.getMMSContentType();
var
i:Integer;
extendname:string;
text,picture,sound,video:Integer;
begin
text:=0;
picture:=0;
sound:=0;
video:=0;

if Stringlist.Count=0 then RCBType.ItemIndex:=0;

for i := 0 to Stringlist.Count - 1 do
begin
extendname:=LowerCase( RightStr(Trim(Stringlist.Strings[i]),3));
if (extendname=''''txt'''') or (extendname=''''htm'''') or (extendname=''''tml'''') then
text:=text 1;
if (extendname=''''bmp'''') or (extendname=''''jpg'''') or (extendname=''''gif'''') then
picture:=picture 1;
if (extendname=''''wma'''') or (extendname=''''mp3'''') then
sound:=sound 1;
if (extendname=''''avi'''') or (extendname=''''mp4'''') then
video:=video 1;
end;

if (text>0) and (picture=0) and (sound=0) and (video=0) then
RCBType.ItemIndex:=0;

if (text=0) and (picture>0) and (sound=0) and (video=0) then
RCBType.ItemIndex:=1;

if (text>0) and (picture>0) and (sound=0) and (video=0) then
RCBType.ItemIndex:=2;

if (text=0) and (picture=0) and (sound>0) and (video=0) then
RCBType.ItemIndex:=3;

if (text>0) and (picture=0) and (sound>0) and (video=0) then
RCBType.ItemIndex:=4;

if (text=0) and (picture>0) and (sound>0) and (video=0) then
RCBType.ItemIndex:=5;

if (text>0) and (picture>0) and (sound>0) and (video=0) then
RCBType.ItemIndex:=6;

if (text=0) and (picture=0) and (sound=0) and (video>0) then
RCBType.ItemIndex:=7;

if (text>0) and (picture=0) and (sound=0) and (video>0) then
RCBType.ItemIndex:=8;

if (text=0) and (picture>0) and (sound=0) and (video>0) then
RCBType.ItemIndex:=9;

if (text>0) and (picture>0) and (sound=0) and (video>0) then
RCBType.ItemIndex:=10;

if (text=0) and (picture=0) and (sound>0) and (video>0) then
RCBType.ItemIndex:=11;

if (text>0) and (picture=0) and (sound>0) and (video>0) then
RCBType.ItemIndex:=12;

if (text=0) and (picture>0) and (sound>0) and (video>0) then
RCBType.ItemIndex:=13;

if (text>0) and (picture>0) and (sound>0) and (video>0) then
RCBType.ItemIndex:=14;

end;

//自写函数,获取文件的大小,值为Byte,故数据类型选择longint

function TNewMMS.getFileSize(sFileName:string):Longint;
var
Attrs: Word;
f: file of Byte;
size: Longint;
begin
Attrs := FileGetAttr(sFileName);
try
AssignFile(f, sFileName);
Reset(f);
size := FileSize(f);
finally
CloseFile(f);
end;
result:=size;
end;


procedure TNewMMS.VSTreeResourceGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
var
i:Integer;
begin
for I := 0 to Stringlist.Count - 1 do
begin
case Column of
0: CellText:=getFilenameFromFullpath(Stringlist[node.index]);
end;
end;
end;

//自写函数,根据文件的绝对路径,得到包括了扩展名的文件名

function TNewMMS.getFilenameFromFullpath(s:string):string;
var
i:Integer;
temp:string;
begin
temp:=trim(s);
i:=Pos(''''\'''',temp);
while i<>0 do
begin
temp:=copy(temp,i 1,StrLen(PAnsiChar(temp))-i);
i:=Pos(''''\'''',temp);
end;
result:=temp;
end;

procedure TNewMMS.XpBtnDeleteClick(Sender: TObject);
var
node:PVirtualNode;
begin
if VSTreeResource.FocusedNode=nil then Exit;

node:=VSTreeResource.FocusedNode;

totalSize:=totalSize-getFileSize(Stringlist.Strings[node.index]);
edtsize.Text:=IntToStr(totalSize) '''' Byte'''';

Stringlist.Delete(node.Index);
RefreshTree;

getMMSContentType;

end;

procedure TNewMMS.FormDestroy(Sender: TObject);
begin
stringlist.Free;
inherited;
end;


procedure TNewMMS.edtSubjectMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if edtsubject.Text=''''You can set a subject here'''' then
edtSubject.SetFocus;
end;

end.

『绝对原创 飞飞于北京 2005-08-31』

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:在 程 序 中 加 入 英 文 朗 读 功 能

下一篇:取Run下所有值(原创)