C++Builder 2009 試用心得

4 09 2008

C++ Builder 2009 

試用過後的心得: 

第一,安裝速度緩慢,在我的Q6600四核心機器上要安裝半個小時

第二,BCB啟動速度比前幾版快很多,第一次啟動大約10~15秒。

第三,CodeInsight反應有比較正常一點,不過仍然有時候會發生Internal Copmiler error

第四,編譯出來的執行檔大小增肥了!最小的簡單Hello World約600kb左右。

第五,支援Unicode了!不過在IDE裡面仍然有時候無法正常顯示Unicode文字。

 

New features:

 

  • ● Compiler support for C++0x Scoped Enumerations, Static Assertions with Type Traits, and Move Semantics 
    ● Boost library integration 
    ● New components and enhancements to existing components including support for Microsoft Office UI Ribbon controls 
    ● Resource Manager 
    ● Enhanced Build Configuration management system 
    ● Updated database drivers 
    ● New capabilities for DataSnap that provide a powerful, flexible, and COM-free solution for building multi-tier applications 
    ● Full Unicode-enablement of the IDE, Language, RTL, VCL, and Database access




以C++重寫Borland VCL Framework

4 09 2008

以C++重寫Borland VCL Framework一直是我的夢想

所以我開始這個計畫,就是實現一個與VCL很相似的Win32 GUI Framework

目前都還在起步階段

我設計的這個framework暫時稱作Compact GUI Library (CGL)

目前的framework程式碼 在此下載

支援GNU C++,MS VC++,Borland C++ Compiler

整個framework的變數命名都盡量與VCL相近

說明白一點,就是我要用純C++重寫Borland VCL。

不想再看到任何Object Pascal的影子!

到底CGL與VCL有多相近呢?

一個典型的CGL 程序的代碼範例如下:

#include "cgl.hpp"

class TForm1:public TForm{
    public:
        TButton *btn,*btn2;
        TForm1(char *_ClassName):TForm(_ClassName)
        {
            ;
        }
        void Init()
        {
            btn = new TButton;
            btn->AttachTo(this->Handle);
            btn->OnMouseClick = TMEM(TForm1,clickbutton);
            btn->Height = 10;
            btn2 = new TButton;
            btn2->AttachTo(this->Handle);
        }
        ~TForm1()
        {
            delete btn;
        }
        int clickbutton(void * Sender)
        {
            ShowMessage("Button Clicked!");
            Caption = "Google !";
            Canvas->MoveTo(0,0);
            Canvas->LineTo(350,350);
            Canvas->Brush->Style = bsSolid;
            Canvas->Rectangle(0,0,400,400);
            Canvas->Font->Size = 24;
            Canvas->Font->Name = "新細明體";
            Canvas->Font->Underline = true;
            Canvas->TextOut( 50,50 , "窗外有藍天,視野寬廣無限。" );
            TBitmap *bmp = new TBitmap(200,200);
            bmp->Canvas->Brush->Color = TColor(120,235,160);
            bmp->Canvas->FillRect(TRect(0,0,200,200));
            bmp->Canvas->Brush->Style = bsClear;
            bmp->Canvas->Font->Italic = true;
            bmp->Canvas->Font->Size = 16;
            bmp->Canvas->TextOut(0,0,"CodeGear C++Builder");
            ::BitBlt( Canvas->Handle() ,0,0,200,200,bmp->Canvas->Handle(),0,0,SRCCOPY);
            delete bmp;
            return 0;
        }
};

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
    Application = new TAPPLICATION;
    Application->Init(hInstance,hPrevInstance);

    try{
        TForm1 *win;
        win = new TForm1("Form1");
        win->Create();
        win->Init();
        win->Width = 600;
        win->Height = 200;
    }catch( Exception &exception ){
        Application->ShowException(&exception);
    }
    catch (...)
    {
        try
        {
            throw Exception("");
        }
        catch (Exception &exception)
        {
            Application->ShowException(&exception);
        }
    }

    int ret = Application->Run();
    delete Application;
    return ret;
}