如何让exe文件变小? 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、不要使用太多的第三方控件;2、删除在Uses中出现的不必要的内容;3、尽量不要使用大的资源对象;4、使用AsPack或UPX压缩。 http://expert.csdn.net/Expert/TopicView1.asp?id=2227108仅有13KB的程序。 在project->Options->packages里面将build with runtime packages前面的复选框勾上,然后编译 aspack压缩效果不错,一般可以压二分之一,另外,将能分离出去的尽量分离出EXE文件,比如报表文件、dll、com. look!http://218.56.11.178:8020/web/technology.aspx->下载基地->例程-精品例程->号称最小的带界面的DELPHI程序 1、不要使用太多的第三方控件;2、删除在Uses中出现的不必要的内容;3、尽量不要使用大的资源对象;4、使用AsPack或UPX压缩。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~支持! 把下面的代码存为.dpr文件,用dalphi调入编译后仅16kprogram testwindow;uses Windows, Messages;var WinClass: TWndClassA; Inst, Handle, Button1, Label1, Edit1: Integer; Msg: TMsg; hFont: Integer;{ Checks if typed password is 'aaaa' and shows Message }procedure CheckPassword;var Textlength: Integer; Text: PChar;begin TextLength := GetWindowTextLength(Edit1); if TextLength = 4 then begin GetMem(Text, TextLength + 1); GetWindowText(Edit1, Text, TextLength + 1); if Text = 'aaaa' then begin MessageBoxA(Handle, '密码正确.', '密码检测', MB_OK); FreeMem(Text, TextLength + 1); Exit; end; end; MessageBoxA(Handle, '密码错误.', '密码检测', MB_OK);end;{ Custom WindowProc function }function WindowProc(hWnd, uMsg, wParam, lParam: Integer): Integer; stdcall;begin Result := DefWindowProc(hWnd, uMsg, wParam, lParam); { Checks for messages } if (lParam = Button1) and (uMsg = WM_COMMAND) then CheckPassword; if uMsg = WM_DESTROY then Halt;end;begin { ** Register Custom WndClass ** } Inst := hInstance; with WinClass do begin style := CS_CLASSDC or CS_PARENTDC; lpfnWndProc := @WindowProc; hInstance := Inst; hbrBackground := color_btnface + 1; lpszClassname := 'AG_TESTWINDOW'; hCursor := LoadCursor(0, IDC_ARROW); end; { with } RegisterClass(WinClass); { ** Create Main Window ** } Handle := CreateWindowEx(WS_EX_WINDOWEDGE, 'AG_TESTWINDOW', 'Amigreen TestWindow 1.00', WS_VISIBLE or WS_SIZEBOX or WS_CAPTION or WS_SYSMENU, 363, 278, 305, 65, 0, 0, Inst, nil); { ** Create a button ** } Button1 := CreateWindow('Button', 'OK', WS_VISIBLE or WS_CHILD or BS_PUSHLIKE or BS_TEXT, 216, 8, 75, 25, handle, 0, Inst, nil); { ** Create a label (static) ** } Label1 := Createwindow('Static', '', WS_VISIBLE or WS_CHILD or SS_LEFT, 8, 12, 76, 13, Handle, 0, Inst, nil); { ** Create an edit field ** } Edit1 := CreateWindowEx(WS_EX_CLIENTEDGE, 'Edit', '', WS_CHILD or WS_VISIBLE or WS_BORDER or ES_PASSWORD, 88, 8, 121, 21, Handle, 0, Inst, nil); { ** Create Font Handle ** } hFont := CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH or FF_DONTCARE, 'MS Sans Serif'); { Change fonts } if hFont <> 0 then begin SendMessage(Button1, WM_SETFONT, hFont, 0); SendMessage(Label1, WM_SETFONT, hFont, 0); SendMessage(Edit1, WM_SETFONT, hFont, 0); end; { Change label (static) text } SetWindowText(Label1, 'Enter password:'); { Set the focus to the edit control } SetFocus(Edit1); UpdateWindow(Handle); { ** Message Loop ** } while(GetMessage(Msg,Handle, 0, 0)) do begin TranslateMessage(msg); DispatchMessage(msg); end; { with }end. 学习,请问aspack是另外的软件还是Delphi自带的工具。怎么用呢? 求救ADOConnection数据库路径连接问题 启动应用程序 如何自定义鼠标样式? Delphi中怎样把一个文件复制到另外一个地方 散分 ,今天高兴 买到一个超值空间,推荐给大家 比较菜的问题,不过还是希望有人解答一下! 寻找一个功能强大的实时曲线绘制控件,全分答谢!!!!! 关于midas服务器的问题 delphi中计算字段如何排序? 我用WebBrowser.HWND 老说对象WHND的方法错误,这是什么回家呀,您有办法解决吗?谢谢了 小妹今年大二,非常想结识各位开发软件的大哥哥! 如何让Edit控件中的内容居在控件的右面?
2、删除在Uses中出现的不必要的内容;
3、尽量不要使用大的资源对象;
4、使用AsPack或UPX压缩。
另外,将能分离出去的尽量分离出EXE文件,比如报表文件、dll、com.
2、删除在Uses中出现的不必要的内容;
3、尽量不要使用大的资源对象;
4、使用AsPack或UPX压缩。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
支持!
program testwindow;uses
Windows,
Messages;var
WinClass: TWndClassA;
Inst, Handle, Button1, Label1, Edit1: Integer;
Msg: TMsg;
hFont: Integer;{ Checks if typed password is 'aaaa' and shows Message }
procedure CheckPassword;
var
Textlength: Integer;
Text: PChar;
begin
TextLength := GetWindowTextLength(Edit1);
if TextLength = 4 then
begin
GetMem(Text, TextLength + 1);
GetWindowText(Edit1, Text, TextLength + 1);
if Text = 'aaaa' then
begin
MessageBoxA(Handle, '密码正确.', '密码检测', MB_OK);
FreeMem(Text, TextLength + 1);
Exit;
end;
end;
MessageBoxA(Handle, '密码错误.', '密码检测', MB_OK);
end;{ Custom WindowProc function }
function WindowProc(hWnd, uMsg, wParam, lParam: Integer): Integer; stdcall;
begin
Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
{ Checks for messages }
if (lParam = Button1) and (uMsg = WM_COMMAND) then
CheckPassword;
if uMsg = WM_DESTROY then
Halt;
end;begin
{ ** Register Custom WndClass ** }
Inst := hInstance;
with WinClass do
begin
style := CS_CLASSDC or CS_PARENTDC;
lpfnWndProc := @WindowProc;
hInstance := Inst;
hbrBackground := color_btnface + 1;
lpszClassname := 'AG_TESTWINDOW';
hCursor := LoadCursor(0, IDC_ARROW);
end; { with }
RegisterClass(WinClass); { ** Create Main Window ** }
Handle := CreateWindowEx(WS_EX_WINDOWEDGE, 'AG_TESTWINDOW', 'Amigreen TestWindow 1.00',
WS_VISIBLE or WS_SIZEBOX or WS_CAPTION or WS_SYSMENU,
363, 278, 305, 65, 0, 0, Inst, nil);
{ ** Create a button ** }
Button1 := CreateWindow('Button', 'OK', WS_VISIBLE or WS_CHILD or BS_PUSHLIKE or BS_TEXT,
216, 8, 75, 25, handle, 0, Inst, nil);
{ ** Create a label (static) ** }
Label1 := Createwindow('Static', '', WS_VISIBLE or WS_CHILD or SS_LEFT,
8, 12, 76, 13, Handle, 0, Inst, nil); { ** Create an edit field ** }
Edit1 := CreateWindowEx(WS_EX_CLIENTEDGE, 'Edit', '', WS_CHILD or WS_VISIBLE or
WS_BORDER or ES_PASSWORD, 88, 8, 121, 21, Handle, 0, Inst, nil); { ** Create Font Handle ** }
hFont := CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH or FF_DONTCARE, 'MS Sans Serif'); { Change fonts }
if hFont <> 0 then
begin
SendMessage(Button1, WM_SETFONT, hFont, 0);
SendMessage(Label1, WM_SETFONT, hFont, 0);
SendMessage(Edit1, WM_SETFONT, hFont, 0);
end;
{ Change label (static) text }
SetWindowText(Label1, 'Enter password:');
{ Set the focus to the edit control }
SetFocus(Edit1); UpdateWindow(Handle); { ** Message Loop ** }
while(GetMessage(Msg,Handle, 0, 0)) do
begin
TranslateMessage(msg);
DispatchMessage(msg);
end; { with }
end.
请问aspack是另外的软件还是Delphi自带的工具。怎么用呢?