如题。

解决方案 »

  1.   

    1、使用ADO
    2、修改Delphi的编译参数,把无用的开关关闭。
      

  2.   

    我不做数据库。
    举个简单的例子,delphi启动时建立的application,不做任何改动,编译成 .exe,是360多K,怎样可以让他最小且可以在不安装delphi的机器上运行。
    如果点了 with runtime packages 只有14K,但是在不装delphi的机器上找不到 rtl60.dll ,运行不了。
      

  3.   

    不要选中with runtime packages ,编译后再用aspack工具压缩,应该会小很多.
      

  4.   

    如果只想把EXE文件变小,可采用DLL和RES文件.
    但要同EXE一起发布.
      

  5.   

    我不想搞的那么罗嗦啊,只要一个exe文件,不要有dll的。
    这样吧,
    delphi启动时建立的application,不做任何改动,编译成 .exe,让他最小且可以在不安装delphi的机器上运行。你们能搞到多小?怎么搞?
      

  6.   

    在你编译的时候在project option里面把不用的pack删掉,这样可以小一点
      

  7.   

    好的,发给我吧,[email protected]
    另外 to  means_pan  把不用的pack删掉,删哪里的?是上边的复选框吗,我删光了也没效果啊。
      

  8.   

    設置編譯器的環境變量,在packages中選中build with runtime packages,*.exe文件會小好多,
    但你在做安裝程式時要打包,打需要的文件包進去。
      

  9.   

    用纯手写比较小,因为delphi集成了许多你可能用不到的库
      

  10.   

    一、KOL是什么?KOL能做什么? MCK是什么?MCK能做什么?KOL是一套对象库,免费而且开放源代码,大家可以http://bonanzas.rinet.ru/去下载到
    它。它能够使Delphi编出尺寸非常小的32位Windows图形用户界面的应用程序。目前支持的Delphi版本:Delphi6,Delphi5,Delphi4,Delphi3和Delphi2。使用KOL在D2-D5中编写的最小图形界面程序(只有一个窗体的空应用程序),只有13K左右。
    在D6中为20K左右。MCK一套以KOL为基础的可视化组件,用它就像用VCL一样的方便省事而且可以达到和KOL一
    样的效果。二、KOL和MCK的安装1、http://bonanzas.rinet.ru/下载到KOL和MCK后,把它们解压到你自已想要的目录中。
    把KOL中的kol.pas拷贝到MCK目录中。2、运行Delphi选择Tools菜单->Environmaent Options...->Library页,选择"Library
    Path"右边的按钮会弹出"Directories"对话框,然后添加KOL和MCK的路径。3、打MCK目录中的包文件安装。
      

  11.   

    三、如何创建一个KOL工程1、在Delphi中新建一个应用程序,然后保存(这一步一定要做),保存时工程名一定不要改
    变,窗体名可以随便。2、在控件面板KOL中放一个TKOLProject控件到窗体并设置projectDest属性为你想要的工
    程名比如说是"KOLSample",再把dprResource属性设为真(这关系到你能不能用Project->
    Options...中的设置设置你的程序图标以及程序的版本号)。3、在控件面板KOL中放一个TKOLForm控件到窗体,这个控件和TForm差不多的,保存并关
    闭当前工程。4、这时候你就会在保存目录中发现一个名为"KOLSample"的工程,聪明的你可能会想到
    Project1这个工程不再需要了,是的你可以毫不留情的删掉它(其它的就不要删了)。打
    开KOLSample,运行它,看看生成的程序,怎么样?:)注:其实在KOL的老家还有很多KOL爱好者写的第三方KOL可视化组件,如要传载请注明
    出处。待继......SQUALL[S&A SSC]
    2002.8.27 
      

  12.   

    哈哈,KOL又更新了
    是我知道的DELPHI中非VCL的最“接近”实用的framework
    http://bonanzas.rinet.ru/e_kolmck.htm
      

  13.   

    下面再发个以前保存的页面,是N年前国人写的一篇推荐,可参考一下,复制到记事本保存为.mht文件用IE打开就行了
      

  14.   

    可是kol上的字体好难看,怎么改成和原来的一样啊,明明是同一种字体吗,显示出来的却粗的多
      

  15.   

    用api函数怎么写呢,举个例子吧,谢谢
      

  16.   

    所有的窗体都用代码写,程序可以缩小至少1/5~~~~~~~~~~且不需要其他辅助的东西
    比如form、edit、button等~~~~~~~~
      

  17.   

    给你一个经典例子,将下面程序直接粘贴到一个新建的工程里面运行就可以看到结果:program AutoShutDown;uses
      Windows,
      ShellAPI,
      Sysutils,
      Messages;{$R *.RES}
    var
      WinClass:TWndClassA;
      Handle:hwnd;
      Inst,Button1, Label1, Edit1: Integer;
      Msg: TMsg;
      tid: TNotifyIconDataA;
      sdt:tdatetime;
      timerid:integer;
      hFont: Integer;
    const
      AppName='AutoShutDown';
      st='定时关机:';
      About='不想吃天鹅肉的癞蛤蟆不是好癞蛤蟆!';
      gjs='设定关机时间';
    procedure SetShutdownTime;
    var
      Textlength: Integer;
      Text: PChar;
      i:tdatetime;
    begin
      TextLength := GetWindowTextLength(Edit1);
        GetMem(Text, TextLength + 1);
        GetWindowText(Edit1, Text, TextLength + 1);
        try
         i:=Strtodatetime(Text);
         if i<=now then
         begin
         MessageBox(handle,'设置有误,请重来!','错误',mb_ok or MB_ICONERROR);
         exit;
         end;
         sdt:=i;
         timerid:=Settimer(handle,1000,1000,nil);
         Showwindow(handle,sw_hide);
         lstrcpy (tid.szTip,pchar(st+'  关机时间:'+Datetimetostr(sdt)));
         Shell_NotifyIcon (nim_modify, @tid);
        except
         Killtimer(handle,timerid);
         Messagebox(handle,pchar('关机时间设定错误!'#13#10#13#10+'格式因该是:'#13#10#13#10
                   +Datetimetostr(now)),AppName,Mb_ok or MB_ICONINFORMATION);
        end;
        FreeMem(Text, TextLength + 1);
    end;
    function WindowProc(hWnd, uMsg, wParam, lParam: Integer): Integer; stdcall;
    var
      pt:tpoint;pm:Hmenu;
      htoken:thandle;
      tkp:token_privileges;
      rr:dword;
    begin
      result:=0;
      Case uMsg of
      wm_timer:
      begin
        if now>=sdt then
        begin
        openprocesstoken(getcurrentprocess(),token_adjust_privileges or token_query,htoken);
        lookupprivilegevalue(nil,'seshutdownprivilege',tkp.privileges[0].luid);
        //设定权限为1
        tkp.PrivilegeCount:=1;
        tkp.privileges[0].Attributes:=se_privilege_enabled;
        //得到关机权限
        adjusttokenprivileges(htoken,false,tkp,0,nil,rr);
        //关闭计算机
        exitwindowsex(ewx_shutdown or ewx_poweroff,0);
        PostMessage(handle,wm_Destroy,0,0);
        end;
      end;
      wm_User:
      begin
        Case lparam of
        WM_LBUTTONDBLCLK:
        begin
        showwindow(handle,sw_restore);
        setforegroundwindow(handle);
        end;
        wm_LButtonDown,wm_RButtonDown:
        begin
        GetCursorPos (pt);
        pm := CreatePopupMenu;
        AppendMenu (pm,0,Ord ('S'),gjs);
        AppendMenu (pm, 0, Ord ('A'), '关于...');
        AppendMenu (pm, mf_Separator, 0, Nil);
        AppendMenu (pm, 0, Ord ('E'), '退出');
        SetForegroundWindow (handle);
        if TrackPopupMenu (pm, tpm_BottomAlign or tpm_RightAlign, pt.x,{GetDeviceCaps(dc,Vertres)}pt.y, 0, handle, Nil) then
                     SetForegroundWindow (handle);
        DestroyMenu (pm)
        end;
      end;
      end;
      wm_Destroy:
      begin
         Shell_NotifyIcon (nim_Delete, @tid);
         Killtimer(handle,timerid);
         halt;
      end;
      wm_Command:
      begin
         if (lParam = Button1) then begin SetshutdownTime;exit end;
         Case Loword(wParam) of
             Ord ('A'): MessageBox (0, About, AppName, mb_ok or MB_ICONINFORMATION);
             Ord ('E'): PostMessage (handle, wm_Close, 0, 0);
             Ord ('S'):
             begin
             Showwindow(handle,sw_restore);
             end;
         end;
      end;
      end;
      Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
    end;begin
      { ** Register Custom WndClass ** }
      if FindWindow (AppName, Nil) <> 0 then begin
      Messagebox(handle,'已经有一个AutoShutDown运行了',AppName,mb_ok or MB_ICONWARNING);
      halt(0);
      end;
      Inst := hInstance;
      with WinClass do
      begin
        style              := CS_CLASSDC or CS_PARENTDC;
        lpfnWndProc        := @WindowProc;
        hInstance          := Inst;
        hbrBackground      := color_btnface + 1;
        lpszClassname      := AppName;
        hCursor            := LoadCursor(0, IDC_ARROW);
      end;
      RegisterClass(WinClass);
      Handle := CreateWindowEx(WS_EX_WINDOWEDGE, AppName, '定时关机XP',
                               WS_VISIBLE {or WS_SIZEBOX} or WS_CAPTION or WS_SYSMENU,
                               315, 248, 330, 75, 0, 0, Inst, nil);
      Button1 := CreateWindow('Button', '确 定', WS_VISIBLE or WS_CHILD or BS_PUSHLIKE or BS_TEXT,
                               240, 10, 75, 20, handle, 0, Inst, nil);
      Label1 := Createwindow('Static', '', WS_VISIBLE or WS_CHILD or SS_LEFT,
                               10, 14, 105, 13, Handle, 0, Inst, nil);
      Edit1 := CreateWindowEx(WS_EX_CLIENTEDGE, 'Edit', Pchar(Datetimetostr(now)), WS_CHILD or WS_VISIBLE or
                               WS_BORDER {or ES_PASSWORD}, 105, 10, 125, 20, Handle, 0, Inst, nil);
      hFont := CreateFont(-12, 0, 0, 0, 500, 0, 0, 0, GB2312_CHARSET,
                               OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                               DEFAULT_PITCH or FF_DONTCARE, '宋体');
      if hFont <> 0 then
      begin
        SendMessage(Button1, WM_SETFONT, hFont, 0);
        SendMessage(Label1, WM_SETFONT, hFont, 0);
        SendMessage(Edit1, WM_SETFONT, hFont, 0);
      end;
      SetWindowText(Label1, pchar('请'+gjs+':'));
      SetFocus(Edit1);
      UpdateWindow(Handle);
         tid.cbSize           := sizeof (tid);
         tid.Wnd              := handle;
         tid.uID              := 1;
         tid.uFlags           := nif_Message or nif_Icon or nif_Tip;
         tid.uCallBackMessage := wm_User;
         tid.hIcon            := LoadIcon (hInstance, 'MAINICON');
         lstrcpy (tid.szTip,st);
         Shell_NotifyIcon (nim_Add, @tid);
      while(GetMessage(Msg, Handle, 0, 0)) do
      begin
        TranslateMessage(msg);
        DispatchMessage(msg);
      end;
    end.程序功能很简单,就是定时关机,但是没有一定的基础很难办到!
    在下看懂了~~~~~~~ 但是不全理解~~~~~~~  
    看懂跟理解是两码事!
      

  18.   

    不要选中with runtime packages ,编译后再用aspack工具压缩,应该会小很多.
    不错。
      

  19.   

    用aspack工具压缩最简单,实用
      

  20.   

    用upx,能压缩到原来的30%左右。
      

  21.   

    如果是这样你可以标准的PAS。。写一个像C 中的函数就可以了,不过什么功能都滑 
    保证你小于 10K