实现:进入主程序界面之前,先显示一个qq魔法表情? 如题补充:在显示完一个qq魔法表情后,自动关闭.然后进入程序主界面请直接发代码,测试后给分 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 想QQ魔法表情是个Flash文件,你建个启动窗体,上加Flash控件,在里面放入魔法表情Flash影片在启动窗体里放个Timer控件,到时间则关闭启动窗体,或者响应Flash事件关闭启动窗体。在主窗体显示前先显示启启动窗体 Application.CreateForm(TfrmMain, frmMain); //启动窗体 frmSplash := TfrmSplash.Create(Application); try frmSplash.ShowModal(); finally frmSplash.Free; end; Application.Run; 控件,是不能让播放的flash背景透明的是要完全像qq魔法表情哪样的参照老妖的http://www.ccrun.com/view.asp?id=22 现在,用TShockwaveFlash,似乎没办法做到 用 gif ...省了 flash 知道什么叫桌面精灵? rising用过没? 呵呵... 楼主的需求大概是想把http://www.ccrun.com/view.asp?id=22 BCB代码翻译成Delphi,谁有空看看。现关注一下,没人我就揭榜了。 unit uMain;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls, ExtCtrls;type TfrmMain = class(TForm) lbl1: TLabel; imgProgram: TImage; btnPlay: TButton; btnAbout: TButton; dlgOpen: TOpenDialog; edtFileName: TEdit; stbMain: TStatusBar; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure btnBrowseClick(Sender: TObject); procedure btnPlayClick(Sender: TObject); private { Private declarations } strHtmlFileName: string; strTempPath: string; public { Public declarations } constructor Create(AOwner: TComponent); override; end;var frmMain: TfrmMain;implementationuses uPlay;{$R *.dfm}procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);begin // 程序结束时将用过的临时文件删除,做人要厚道 if FileExists(strHtmlFileName) then // MagicFlash模板文件 DeleteFile(strHtmlFileName); if FileExists(strTempPath + '_bg4mgc.tmp') then // HTML中的背景图片文件 DeleteFile(strTempPath + '_bg4mgc.tmp'); if FileExists(strTempPath + 'QQMagicFlash.htm') then // 真正显示的HTML文件 DeleteFile(strTempPath + 'QQMagicFlash.htm');end;procedure TfrmMain.btnBrowseClick(Sender: TObject);begin if dlgOpen.Execute then edtFileName.Text := dlgOpen.FileName;end;procedure TfrmMain.btnPlayClick(Sender: TObject);var strFlashFile: string; rs: TResourceStream; pList: TStringList; frmPlay: TfrmPlay;begin strFlashFile := edtFileName.Text; if not FileExists(strFlashFile) then begin MessageBox(Handle, '请选择正确的播放文件!', PChar(Application.Title), MB_OK or MB_ICONWARNING); Exit; end; // 如果临时文件夹下的_QQMagicFlash.htm文件不存在,就从资源中释放一个 if not FileExists(strHtmlFileName) then begin rs := TResourceStream.Create(HInstance, 'HTMLFILE', RT_RCDATA); try try rs.SaveToFile(strHtmlFileName); except MessageBox(Handle, PChar('HTML资源释放失败: ' + strHtmlFileName + '\r\n请检查这个文件是否正在使用中,' + '或手动删除这个文件再试试'), PChar(Application.Title), MB_OK or MB_ICONERROR); Exit; end; finally rs.Free; end; end; // 将_QQMagicFlash.htm文件读入并将其中的initflash.swf字符串 // 替换为刚才选定的文件名 pList := TStringList.Create; pList.LoadFromFile(strHtmlFileName); pList.Text := StringReplace(pList.Text, 'initflash.swf', strFlashFile, [rfReplaceAll]); // 另存为临时目录下的QQMagicFlash.htm pList.SaveToFile(strTempPath + 'QQMagicFlash.htm'); pList.Free; // 一切就绪, 播放的说 frmPlay := TfrmPlay.Create(Self); frmPlay.ShowModal(); frmPlay.Free;end;constructor TfrmMain.Create(AOwner: TComponent);var szBuf: array[0..MAX_PATH - 1] of Char;begin inherited; imgProgram.Picture.Assign(Application.Icon); // 临时文件夹所在的路径 GetTempPath(MAX_PATH, szBuf); strTempPath := string(szBuf); // 如果路径最后没有"\"就添加一个 strTempPath := IncludeTrailingPathDelimiter(strTempPath); // _QQMagicFlash.htm文件 strHtmlFileName := strTempPath + '_QQMagicFlash.tmp';end;end.object frmMain: TfrmMain Left = 199 Top = 133 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = 'MagicFlash - 模拟QQ魔法表情' ClientHeight = 145 ClientWidth = 359 Color = clBtnFace Font.Charset = GB2312_CHARSET Font.Color = clWindowText Font.Height = -12 Font.Name = '宋体' Font.Style = [] OldCreateOrder = False Position = poScreenCenter OnClose = FormClose PixelsPerInch = 96 TextHeight = 12 object lbl1: TLabel Left = 7 Top = 16 Width = 78 Height = 12 Caption = 'Flash文件名:' end object lbl2: TLabel Left = 48 Top = 87 Width = 210 Height = 12 Caption = '致力于C++Builder的学习, 探讨和研究.' end object lblAuthor: TLabel Left = 48 Top = 103 Width = 96 Height = 12 Caption = 'by GaoLun, ccrun' end object imgProgram: TImage Left = 8 Top = 87 Width = 32 Height = 32 end object btnBrowse: TButton Left = 334 Top = 36 Width = 20 Height = 21 Caption = '..' TabOrder = 1 OnClick = btnBrowseClick end object btnPlay: TButton Left = 280 Top = 64 Width = 75 Height = 25 Caption = '播放(&P)' TabOrder = 2 OnClick = btnPlayClick end object edtFileName: TEdit Left = 7 Top = 37 Width = 323 Height = 20 ReadOnly = True TabOrder = 0 end object stbMain: TStatusBar Left = 0 Top = 126 Width = 359 Height = 19 Panels = <> SimplePanel = True SimpleText = '欢迎光临 C++ Builder 研究! - http://www.ccrun.com' end object btnAbout: TButton Left = 280 Top = 96 Width = 75 Height = 25 Caption = '关于(&A)' TabOrder = 3 end object dlgOpen: TOpenDialog Filter = 'Flash 文件 (*.swf)|*.swf' InitialDir = '.' Left = 328 Top = 1 endend unit uPlay;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, OleCtrls, SHDocVw;type TfrmPlay = class(TForm) tmrAutoClose: TTimer; cwb: TWebBrowser; imgScreen: TImage; procedure FormShow(Sender: TObject); procedure cwbDocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); procedure tmrAutoCloseTimer(Sender: TObject); private { Private declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; end;//var//// frmPlay: TfrmPlay;//implementation{$R *.dfm}uses jpeg;procedure TfrmPlay.FormShow(Sender: TObject);var szBuf: array[0..MAX_PATH - 1] of Char; strTempPath: string; _hdc: HDC; jpg: TJPEGImage;begin // 临时文件夹所在的路径 GetTempPath(MAX_PATH, szBuf); strTempPath := string(szBuf); // 如果路径最后没有"\"就添加一个 strTempPath := IncludeTrailingPathDelimiter(strTempPath); // 将屏幕中间400*400的区域抓图并保存到jpg文件 // 这个文件将作为显示Flash的HTML文件的背景 // 因为HTML是居中显示,这样看起来HTML显示是透明的 _hdc := GetDC(0); BitBlt(imgScreen.Canvas.Handle, 0, 0, imgScreen.Width, imgScreen.Height, _hdc, (Screen.Width - Width) div 2, (Screen.Height - Height) div 2, SRCCOPY); jpg := TJPEGImage.Create; jpg.PixelFormat := jf24Bit; try jpg.Assign(imgScreen.Picture.Bitmap); jpg.SaveToFile(strTempPath + '_bg4mgc.tmp'); finally jpg.Free; end; // 打开播放Flash的Html文件 cwb.Navigate(strTempPath + 'QQMagicFlash.htm');end;procedure TfrmPlay.cwbDocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant);begin tmrAutoClose.Enabled := true;end;procedure TfrmPlay.tmrAutoCloseTimer(Sender: TObject);begin // 魔法表情大概播放5-6秒钟,6秒钟以后关闭窗体 Close();end;constructor TfrmPlay.Create(AOwner: TComponent);begin inherited; imgScreen.Width := 400; imgScreen.Height := 400; tmrAutoClose.Enabled := False;end;end.object frmPlay: TfrmPlay Left = 233 Top = 141 BorderStyle = bsNone Caption = 'frmPlay' ClientHeight = 350 ClientWidth = 350 Color = clWindow TransparentColorValue = clFuchsia Ctl3D = False Font.Charset = GB2312_CHARSET Font.Color = clWindowText Font.Height = -12 Font.Name = '宋体' Font.Style = [] FormStyle = fsStayOnTop OldCreateOrder = False Position = poScreenCenter OnShow = FormShow PixelsPerInch = 96 TextHeight = 12 object imgScreen: TImage Left = 25 Top = 48 Width = 20 Height = 20 end object cwb: TWebBrowser Left = -2 Top = -2 Width = 400 Height = 400 TabStop = False ParentShowHint = False ShowHint = False TabOrder = 0 OnDocumentComplete = cwbDocumentComplete ControlData = { 4C00000057290000572900000000000000000000000000000000000000000000 000000004C000000000000000000000001000000E0D057007335CF11AE690800 2B2E126208000000000000004C0000000114020000000000C000000000000046 8000000000000000000000000000000000000000000000000000000000000000 00000000000000000100000000000000000000000000000000000000} end object tmrAutoClose: TTimer Interval = 6000 OnTimer = tmrAutoCloseTimer Left = 16 Top = 8 endend 如何 把进度条 弄成像Windows 开机时那 滚动的进度条 Delphi 里有GetLayeredWindowAttributes函数吗?怎么取一个窗口透明度? 关于远程屏幕抓取的问题。 system error 87,有人知道这是什么错误吗? 请教关于事务处理的问题。。 请帮帮一个delphi的新手! 一个很不专业的问题,希望各位指教 如何添加查询字段? 请教一个关于动态SQL的问题! 哪有中文版的,制作hlpe文件的软件? 如何隐藏主控制台程序的窗口 dbgrideh拉动下拉滚动条时,选中的记录不跟着变化?
在启动窗体里放个Timer控件,到时间则关闭启动窗体,或者响应Flash事件关闭启动窗体。
在主窗体显示前先显示启启动窗体
Application.CreateForm(TfrmMain, frmMain);
//启动窗体
frmSplash := TfrmSplash.Create(Application);
try
frmSplash.ShowModal();
finally
frmSplash.Free;
end;
Application.Run;
是要完全像qq魔法表情哪样的
参照老妖的http://www.ccrun.com/view.asp?id=22
http://www.ccrun.com/view.asp?id=22
BCB代码翻译成Delphi,谁有空看看。
现关注一下,没人我就揭榜了。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls;type
TfrmMain = class(TForm)
lbl1: TLabel;
imgProgram: TImage;
btnPlay: TButton;
btnAbout: TButton;
dlgOpen: TOpenDialog;
edtFileName: TEdit;
stbMain: TStatusBar;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnBrowseClick(Sender: TObject);
procedure btnPlayClick(Sender: TObject);
private
{ Private declarations }
strHtmlFileName: string;
strTempPath: string;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
end;var
frmMain: TfrmMain;implementationuses uPlay;{$R *.dfm}procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
// 程序结束时将用过的临时文件删除,做人要厚道
if FileExists(strHtmlFileName) then // MagicFlash模板文件
DeleteFile(strHtmlFileName);
if FileExists(strTempPath + '_bg4mgc.tmp') then // HTML中的背景图片文件
DeleteFile(strTempPath + '_bg4mgc.tmp');
if FileExists(strTempPath + 'QQMagicFlash.htm') then // 真正显示的HTML文件
DeleteFile(strTempPath + 'QQMagicFlash.htm');
end;procedure TfrmMain.btnBrowseClick(Sender: TObject);
begin
if dlgOpen.Execute then
edtFileName.Text := dlgOpen.FileName;
end;procedure TfrmMain.btnPlayClick(Sender: TObject);
var
strFlashFile: string;
rs: TResourceStream;
pList: TStringList;
frmPlay: TfrmPlay;
begin
strFlashFile := edtFileName.Text;
if not FileExists(strFlashFile) then
begin
MessageBox(Handle, '请选择正确的播放文件!',
PChar(Application.Title), MB_OK or MB_ICONWARNING);
Exit;
end;
// 如果临时文件夹下的_QQMagicFlash.htm文件不存在,就从资源中释放一个
if not FileExists(strHtmlFileName) then
begin
rs := TResourceStream.Create(HInstance, 'HTMLFILE', RT_RCDATA);
try
try
rs.SaveToFile(strHtmlFileName);
except
MessageBox(Handle, PChar('HTML资源释放失败: ' + strHtmlFileName
+ '\r\n请检查这个文件是否正在使用中,'
+ '或手动删除这个文件再试试'),
PChar(Application.Title), MB_OK or MB_ICONERROR);
Exit;
end;
finally
rs.Free;
end;
end;
// 将_QQMagicFlash.htm文件读入并将其中的initflash.swf字符串
// 替换为刚才选定的文件名
pList := TStringList.Create;
pList.LoadFromFile(strHtmlFileName);
pList.Text := StringReplace(pList.Text, 'initflash.swf',
strFlashFile, [rfReplaceAll]);
// 另存为临时目录下的QQMagicFlash.htm
pList.SaveToFile(strTempPath + 'QQMagicFlash.htm');
pList.Free; // 一切就绪, 播放的说
frmPlay := TfrmPlay.Create(Self);
frmPlay.ShowModal();
frmPlay.Free;
end;constructor TfrmMain.Create(AOwner: TComponent);
var
szBuf: array[0..MAX_PATH - 1] of Char;
begin
inherited;
imgProgram.Picture.Assign(Application.Icon);
// 临时文件夹所在的路径
GetTempPath(MAX_PATH, szBuf);
strTempPath := string(szBuf);
// 如果路径最后没有"\"就添加一个
strTempPath := IncludeTrailingPathDelimiter(strTempPath);
// _QQMagicFlash.htm文件
strHtmlFileName := strTempPath + '_QQMagicFlash.tmp';
end;end.object frmMain: TfrmMain
Left = 199
Top = 133
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'MagicFlash - 模拟QQ魔法表情'
ClientHeight = 145
ClientWidth = 359
Color = clBtnFace
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = '宋体'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 12
object lbl1: TLabel
Left = 7
Top = 16
Width = 78
Height = 12
Caption = 'Flash文件名:'
end
object lbl2: TLabel
Left = 48
Top = 87
Width = 210
Height = 12
Caption = '致力于C++Builder的学习, 探讨和研究.'
end
object lblAuthor: TLabel
Left = 48
Top = 103
Width = 96
Height = 12
Caption = 'by GaoLun, ccrun'
end
object imgProgram: TImage
Left = 8
Top = 87
Width = 32
Height = 32
end
object btnBrowse: TButton
Left = 334
Top = 36
Width = 20
Height = 21
Caption = '..'
TabOrder = 1
OnClick = btnBrowseClick
end
object btnPlay: TButton
Left = 280
Top = 64
Width = 75
Height = 25
Caption = '播放(&P)'
TabOrder = 2
OnClick = btnPlayClick
end
object edtFileName: TEdit
Left = 7
Top = 37
Width = 323
Height = 20
ReadOnly = True
TabOrder = 0
end
object stbMain: TStatusBar
Left = 0
Top = 126
Width = 359
Height = 19
Panels = <>
SimplePanel = True
SimpleText = '欢迎光临 C++ Builder 研究! - http://www.ccrun.com'
end
object btnAbout: TButton
Left = 280
Top = 96
Width = 75
Height = 25
Caption = '关于(&A)'
TabOrder = 3
end
object dlgOpen: TOpenDialog
Filter = 'Flash 文件 (*.swf)|*.swf'
InitialDir = '.'
Left = 328
Top = 1
end
end
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, OleCtrls, SHDocVw;type
TfrmPlay = class(TForm)
tmrAutoClose: TTimer;
cwb: TWebBrowser;
imgScreen: TImage;
procedure FormShow(Sender: TObject);
procedure cwbDocumentComplete(Sender: TObject; const pDisp: IDispatch;
var URL: OleVariant);
procedure tmrAutoCloseTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
end;//var//
// frmPlay: TfrmPlay;//implementation{$R *.dfm}uses jpeg;procedure TfrmPlay.FormShow(Sender: TObject);
var
szBuf: array[0..MAX_PATH - 1] of Char;
strTempPath: string;
_hdc: HDC;
jpg: TJPEGImage;
begin
// 临时文件夹所在的路径
GetTempPath(MAX_PATH, szBuf);
strTempPath := string(szBuf);
// 如果路径最后没有"\"就添加一个
strTempPath := IncludeTrailingPathDelimiter(strTempPath);
// 将屏幕中间400*400的区域抓图并保存到jpg文件
// 这个文件将作为显示Flash的HTML文件的背景
// 因为HTML是居中显示,这样看起来HTML显示是透明的
_hdc := GetDC(0);
BitBlt(imgScreen.Canvas.Handle, 0, 0,
imgScreen.Width, imgScreen.Height,
_hdc,
(Screen.Width - Width) div 2,
(Screen.Height - Height) div 2,
SRCCOPY);
jpg := TJPEGImage.Create;
jpg.PixelFormat := jf24Bit;
try
jpg.Assign(imgScreen.Picture.Bitmap);
jpg.SaveToFile(strTempPath + '_bg4mgc.tmp');
finally
jpg.Free;
end;
// 打开播放Flash的Html文件
cwb.Navigate(strTempPath + 'QQMagicFlash.htm');
end;procedure TfrmPlay.cwbDocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
tmrAutoClose.Enabled := true;
end;procedure TfrmPlay.tmrAutoCloseTimer(Sender: TObject);
begin
// 魔法表情大概播放5-6秒钟,6秒钟以后关闭窗体
Close();
end;constructor TfrmPlay.Create(AOwner: TComponent);
begin
inherited;
imgScreen.Width := 400;
imgScreen.Height := 400; tmrAutoClose.Enabled := False;
end;end.object frmPlay: TfrmPlay
Left = 233
Top = 141
BorderStyle = bsNone
Caption = 'frmPlay'
ClientHeight = 350
ClientWidth = 350
Color = clWindow
TransparentColorValue = clFuchsia
Ctl3D = False
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = '宋体'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
Position = poScreenCenter
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 12
object imgScreen: TImage
Left = 25
Top = 48
Width = 20
Height = 20
end
object cwb: TWebBrowser
Left = -2
Top = -2
Width = 400
Height = 400
TabStop = False
ParentShowHint = False
ShowHint = False
TabOrder = 0
OnDocumentComplete = cwbDocumentComplete
ControlData = {
4C00000057290000572900000000000000000000000000000000000000000000
000000004C000000000000000000000001000000E0D057007335CF11AE690800
2B2E126208000000000000004C0000000114020000000000C000000000000046
8000000000000000000000000000000000000000000000000000000000000000
00000000000000000100000000000000000000000000000000000000}
end
object tmrAutoClose: TTimer
Interval = 6000
OnTimer = tmrAutoCloseTimer
Left = 16
Top = 8
end
end