SlideShare une entreprise Scribd logo
1  sur  179
陳寬達  ( 陳昇瑋 ) 講師、技術作家、共享軟體作者 http://www.iis.sinica.edu.tw/~ s wc /index_c.html Borland C ++ Builder 入門課程
Outlines ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Win32  開發環境 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
獨立的  4GB  位址空間- Windows 95/98  架構 0xFFFFFFFF ~ 0xC0000000 1 GB  區域。用於  VxD 、記憶體管理、系統程式碼,所有  Win32  處理程序共享。 0xBFFFFFFF ~ 0x80000000 1 GB  區域。用於記憶體對映檔案及  Win32 DLL ,所有  Win32  程序共享。 0x7FFFFFFF ~ 0x00400000 2143289344  位元組,約  2044 MB ,每個  Win32  處理程序私有區域。 0x003FFFFF ~ 0x00001000 4190208  位元組,約  4 MB ,放置  DOS  及  Win16  應用程式。 0x00000FFF ~ 0x00000000 4096  位元組,用於偵測不合法指標。
獨立的  4GB  位址空間- Windows NT  架構 2 GB  區域。用於作業系統、核心程式及驅動程式,應用程式無法存取。 0xFFFFFFFF ~ 0x80000000 0x7FFEFFFF ~ 0x00010000 2147352576  位元組,約  2047 MB ,每個  Win32  處理程序私有區域。 0x0000FFFF ~ 0x00000000 64 KB  區域。用於偵測不合法指標。 0x7FFFFFFF ~ 0x7FFF0000 64 KB  區域。用於偵測不合法指標。
多執行緒支援 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
何謂行程( process )? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
何謂執行緒( thread )? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
多執行緒程式 ,[object Object],[object Object],[object Object],[object Object]
多執行緒的優劣 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
執行緒的分類 ,[object Object],[object Object]
Win32 API ,[object Object],[object Object]
Win32 API ,[object Object]
DLL  釋名 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DLL  的重要性 ,[object Object],[object Object],[object Object]
DLL  的重要性 ,[object Object]
DLL  的運作特徵 ,[object Object],[object Object],[object Object],[object Object]
DLL  的載入方式 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
檢視  DLL  提供的函式 E:INNTystem32>dumpbin /exports user32.dll Microsoft (R) COFF Binary File Dumper Version 5.00.7022 Copyright (C) Microsoft Corp 1992-1997. All rights reserved. Dump of file user32.dll File Type: DLL Section contains the following Exports for USER32.dll 0 characteristics 336A2A2A time date stamp Sat May 03 01:53:46 1997 0.00 version 1 ordinal base 634  number of functions 634  number of names ordinal hint  name 1  0  ActivateKeyboardLayout  (00015B1A) 2  1  AdjustWindowRect  (0000D704) 3  2  AdjustWindowRectEx  (00007D8E) 4  3  AnyPopup  (00043ABB) 5  4  AppendMenuA  (00011F57) 6  5  AppendMenuW  (0002D7A4)
檢視  DLL  提供的資源
訊息驅動 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
處處皆訊息 ,[object Object]
訊息的傳遞方式 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
訊息處理機制 USER32.DLL 訊息迴圈 視窗函式 messages post messages send / post messages while ( GetMessage (&Msg, NULL, NULL, NULL)) { TranslateMessage (Msg); DispatchMessage (Msg); } switch (Msg.Message) { //  視窗建立時 case WM_CREATE: ...  //  按下滑鼠左鍵 case WM_LBUTTONDOWN: ...    //  按下按鍵時 case WM_KEYDOWN: ...  //  關閉視窗時 case WM_CLOSE: ... }
傳遞視窗訊息 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],typedef struct tagMSG { //  訊息結構 HWND  hwnd;  UINT  message; WPARAM wParam; LPARAM lParam; DWORD  time; POINT  pt; } MSG;
使用視窗訊息 ,[object Object],[object Object],procedure TForm1.Button1Click(Sender: TObject); var Wnd: HWND; begin if wnd = FindWindow(nil, ' 小算盤 ') then begin PostMessage (Wnd, WM_KEYDOWN, WPARAM('1'), 0); PostMessage (Wnd, WM_DESTROY, 0, 0); end; end; procedure TForm1.Button1Click(Sender: TObject); var Wnd: HWND;  begin if wnd = FindWindow(nil, ' 小算盤 ') then begin SendMessage (Wnd, WM_SETTEXT, 0, LPARAM(PChar(' 測試,測試’ ))); end; end;
行程、執行緒、訊息佇列及 訊息迴圈 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
行程、執行緒、訊息佇列及 訊息迴圈 行程 執行緒 訊息佇列 程式碼 視窗  C  視窗函式 訊息迴圈 視窗  C 視窗  D 視窗  D  視窗函式 取出 分派 執行緒 訊息佇列 程式碼 視窗  A  視窗函式 訊息迴圈 視窗  A 視窗  B 視窗  B  視窗函式 取出 分派 工作執行緒 程式碼
應用程式架構
開發工具的型態及演進 ,[object Object],[object Object],[object Object],[object Object],[object Object]
開發工具的型態及演進 ,[object Object],[object Object],[object Object]
Win32  開發工具的比較 ,[object Object]
C++Builder Overview ,[object Object],[object Object],[object Object],[object Object],[object Object]
The C++Builder Environment ,[object Object],[object Object],[object Object],[object Object]
Environment Configuration ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Component Palette ,[object Object],[object Object]
Object Inspector ,[object Object],[object Object]
Form Designer ,[object Object],[object Object],[object Object],[object Object],[object Object]
Code Editor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The simplest event-handler ,[object Object],[object Object],[object Object],void __fastcall TForm1::Button1Click(TObject *Sender) { Close(); }
Project, Unit and Forms ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The file types used by C++Builder ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CPP Project File #include <vcl.h> #pragma hdrstop USERES(&quot;Project1.res&quot;); USEFORM(&quot;Unit1.cpp&quot;, Form1); WINAPI  WinMain (HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TForm1), &Form1); Application-> Run() ; } catch (Exception &exception) { Application->ShowException(&exception); } return 0; }
Using the components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Visual & Non-Visual Components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Component Relations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Component Naming Convention
Our First C++Builder Program void __fastcall TForm1::Button1Click(TObject *Sender) { ShowMessage(&quot;Written by Kuan-Ta Chen&quot;); } void __fastcall TForm1::Button2Click(TObject *Sender) { Close(); }
What’s a form ? ,[object Object],[object Object],class  TForm1 : public TForm { __published: // IDE-managed Components TButton *Button1; TLabel *Label1; TButton *Button2; void __fastcall Button1Click(TObject *Sender); void __fastcall Button2Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); }; TForm1 *Form1;
What’s a form ? ,[object Object],[object Object],__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } void __fastcall TForm1::Button1Click(TObject *Sender) { ShowMessage(&quot;Written by Kuan-Ta Chen&quot;); } void __fastcall TForm1::Button2Click(TObject *Sender) { Close(); } Application->CreateForm(__classid(TForm1), &Form1);
Multi-Appearance of Forms ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],= =
Using the form ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Create Form On Demand ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],void __fastcall TForm1::Button1Click(TObject *Sender) { AboutBox->ShowModal(); } void __fastcall TForm1::Button1Click(TObject *Sender) { TAboutBox* box = new TAboutBox(this); box->ShowModal(); delete box; }
Modalless and Modal Form ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C++ Language ,[object Object],[object Object],[object Object],[object Object]
Programming Paradigm ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Procedural  Programming Paradigm ,[object Object],[object Object],[object Object],[object Object],[object Object]
ADT Programming Paradigm ,[object Object],[object Object],[object Object],[object Object]
Object-Oriented  Programming Paradigm ,[object Object],[object Object],[object Object],[object Object],[object Object]
物件導向程式設計 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
物件導向要素-封裝 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],個體 動作  C 變數  A 變數  B 動作  D 介面 被使用
物件導向要素-繼承 ,[object Object],泡泡龍 吃(水果) 身高 體重 噴(泡泡) 酷斯拉 吃(魚) 身高 體重 噴(熱氣) 繼承 繼承 姓名 生蛋 爬蟲類 吃 身高 體重 噴
物件導向要素-多型 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C++  的由來 ,[object Object]
如何看待  C++ ? ,[object Object],[object Object],[object Object],[object Object],[object Object]
強大複雜的  C++ ,[object Object],[object Object],如果你認為  C++  還不算太複雜,那麼請你解釋何謂  protected abstract virtual base pure virtual private destructor ,而你又會在何時需要它呢? Tom Cargill C++ Journal Fall 1990
強大複雜的  C++ ,[object Object]
C++  類別宣告 ,[object Object],[object Object],[object Object],[object Object],class  TMyClass { int a, b, c; TMyClass(<parameters>); //  建構函式 ~TMyClass(void); //  解構函式 void draw(); int draw(int x, int y, int z); };
C++  物件 ,[object Object],[object Object],[object Object],[object Object],void foo(void) { TCat cat;  //  在堆疊中建立  TCat  類別的  cat  物件 ,  進入  foo  時才建立 cat.Meow(); //  呼叫  cat  物件的  Meow()  方法 } TCat cat; //  在資料節區中建立  TCat  類別的  cat  物件 ,  程式啟動後即建立 void foo(void) { cat.Meow(); //  呼叫  cat  物件的  Meow()  方法 } void foo(void) { TButton* btn = new TButton(this);  //  在堆疊中建立  TButton  類別的  btn  物件 btn->Show(); //  呼叫  btn  物件的  Show()  方法 }
[object Object],[object Object],TMammal and child classes class  TMammal { private : AnsiString FName, FEyeColor; int  FAge; public : __fastcall  TMammal( void ); virtual   void   __fastcall  Speak( void ) = 0; }; class  TCat :  public  TMammal { virtual   void   __fastcall  Speak( void ) {ShowMessage(“I’m Cat”);} }; class   TDog  :  public  TMammal { virtual   void   __fastcall  Speak( void ) {ShowMessage(“I’m Dog”);} };
[object Object],[object Object],[object Object],The Power of Polymorphism void __fastcall TForm1::Button1Click(TObject *Sender) { TMammal* Mammal = new  TCat (); Mammal->Speak(); delete Mammal; } void __fastcall TForm1::Button2Click(TObject *Sender) { TMammal* Mammal = new  TDog (); Mammal->Speak(); delete Mammal; }
C++ Enhancement for BCB ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Added Keywords ,[object Object],[object Object],[object Object]
Properties ,[object Object],[object Object],[object Object],[object Object],class TMyClass { private: TColor FColor; TColor __fastcall GetColor( void ); public:  __fastcall TMyClass( void ); __property TColor Color = { read = FColor, write = SetColor }; };
DFM resources ,[object Object],[object Object],# include <vclcl.h> #pragma hdrstop #include &quot;Unit1.h&quot; //--------------------------------------------------------- #pragma resource &quot;*.dfm”  // <- binding DFM resources TForm1 *Form1; //--------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { }
AnsiString Class and Variant ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],void __fastcall TForm1::Button1Click(TObject *Sender) { Variant x; x = 13; edtTest->Text = IntToStr( x + 12 ); x = &quot;Hello, world&quot;; ShowMessage( x ); }
Set ,[object Object],[object Object],typedef Set <char, 'A','Z'> UPPERCASESet; UPPERCASESet s;
Open Array ,[object Object],ShowMessage(Format(&quot;%s %d&quot;,  OPENARRAY (TVarRec, (&quot;Hello&quot;,    123))));
Traditional Methods for Error Handling ,[object Object],if ((pBuffer = malloc(1000)) == NULL) { /* error processing code here; */ } if ((fp = fopen(“data.txt”, “r”)) == NULL) { /* error processing code here; */ }
Handling VCL Exception ,[object Object],try { edtTotal->Text = IntToStr( StrToInt( edtOp1->Text ) / StrToInt( edtOp2->Text ) ); } catch ( EDivByZero& ) { ShowMessage( &quot;Cannot divide by zero&quot; ); } catch ( EConvertError& ) { ShowMessage( &quot;Error during conversion&quot; ); }
Unhandled VCL Exceptions ,[object Object],WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TForm1), &Form1); Application->Run(); } catch  ( Exception  &exception) { Application->ShowException(&exception); } return 0; }
Throwing exceptions ,[object Object],[object Object],try { if (numItems == 0 ) throw EDivByZero( &quot;Cannot divide by zero&quot; );  // ^ throw your own exception else edtAvg->Text = FloatToStr( sum / numItems ); } catch ( EDivByZero& ) { edtAvg->Text = FloatToStr( 0.0 ); throw; // <- re-throw the same exception }
Creating Custom Exception Class ,[object Object],class EInvalidBalance : public Exception { public: virtual __fastcall EInvalidBalance( String msg ) : Exception( msg ) {}; };
VCL  元件瀏覽 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
程式實作-自動發信 void __fastcall TForm1::Label1Click(TObject *Sender) { ShellExecute(Handle, &quot;open&quot;, &quot;mailto:kuan@ilife.cx&quot;, NULL,   NULL, SW_SHOW); }
程式實作-影像載入 void __fastcall TForm1::Label1Click(TObject *Sender) { if (OpenPictureDialog1->Execute()) Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); }
Typecasting VCL objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
程式實作-動態建立元件 void __fastcall TForm1::ButtonClick(TObject *Sender) { Edit1->Text = Edit1->Text +   AnsiString(dynamic_cast<TComponent*>(Sender)->Tag); }
程式實作-操作字串陣列 void __fastcall TForm1::Button1Click(TObject *Sender) { AnsiString S; if (InputQuery(Application->Title, &quot; 請輸入字串 &quot;, S)) ListBox1->Items->Add(S); }
程式實作- TCanvas  畫布
程式實作- MDI  應用程式 void __fastcall TMainForm::mnuNewClick(TObject *Sender) { if (OpenDialog1->Execute()) { TTextForm* frm = new TTextForm(this); frm->Caption = OpenDialog1->FileName; frm->Memo1->Lines->LoadFromFile(OpenDialog1->FileName); frm->Show(); } }
程式實作 – 資料排序
程式實作 –  Other Possibilities ,[object Object],[object Object],[object Object],[object Object]
VCL  的多重面貌 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  的原始碼面貌 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  的編譯後單元面貌 ,[object Object],[object Object]
VCL  的類別及元件面貌 ,[object Object],[object Object],[object Object]
VCL  的執行檔面貌 ,[object Object],這是一個什麼事都沒做的  console mode  程式: 大小只有  16K ,因為它只用到  RTL  的  System  單元,與  VCL  完全無關。 而這個呢,是一個什麼事都沒做,但包含一個  form  的  VCL  程式: 292864  位元組減掉  16384  位元組等於  276480  位元組,多出來的這些就是  VCL  機械碼。 ,[object Object],[object Object]
VCL  的  RunTime  Package  面貌 ,[object Object],[object Object],[object Object],[object Object]
VCL  的  Run-Time Package  面貌 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  的  Run-Time Package  面貌 ,[object Object],[object Object]
VCL  的  Run-Time Package  面貌
學習  VCL  類別架構 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
學習  VCL  類別架構 ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  核心類別 ,[object Object]
VCL  核心類別- TObject ,[object Object],[object Object],[object Object],[object Object]
VCL  核心類別- TObject ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  核心類別- TObject ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  核心類別- TObject ,[object Object],[object Object],[object Object],void foo(void) { TCat cat;  //  在堆疊中建立  TCat  類別的  cat  物件 ,  進入  foo  時才建立 cat.Meow(); //  呼叫  cat  物件的  Meow()  方法 } TCat cat; //  在資料節區中建立  TCat  類別的  cat  物件 ,  程式啟動後即建立 void foo(void) { cat.Meow(); //  呼叫  cat  物件的  Meow()  方法 } void foo(void) { TButton* btn = new TButton(this);  //  在累堆中建立  TButton  類別的  btn  物件 btn->Show(); //  呼叫  btn  物件的  Show()  方法 delete btn; }
VCL  核心類別- TObject ,[object Object],[object Object],TCCalendar = class(TCustomGrid) private ...  procedure WMSize(var Message: TWMSize); message WM_SIZE; end;
VCL  核心類別- TPersistent ,[object Object],[object Object],[object Object],[object Object]
VCL  核心類別- TPersistent ,[object Object],[object Object],[object Object],[object Object],[object Object],TPersistent = class(TObject) protected ... procedure AssignTo(Dest: TPersistent); virtual; public ... procedure Assign(Source: TPersistent); virtual; end;
VCL  核心類別- TPersistent ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  核心類別- TPersistent ,[object Object],[object Object],{ TPersistent abstract class } {$M+} TPersistent = class(TObject) ... end; {$M-}
VCL  核心類別- TComponent ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  控制項類別 ,[object Object]
VCL  控制項類別 ,[object Object]
VCL  控制項類別- TControl ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  控制項類別- TWinControl ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  控制項類別- TGraphicControl ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  控制項類別- TCustomControl ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  控制項類別分類 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  控制項類別分類 ,[object Object],:hwnd -c project1 Handle  Class WinProc TID Module 03071A  IME 77E952BA ED 00000000 030724  TForm1 00254477 ED 00010100 050732  TStaticText 011B0FAE ED 00000000 050730  TPanel 011B0FBB ED 00010000 03072E  TButton 011B0FC8 ED 00000000 030718  TApplication 011B0FEF ED 0100:0000
VCL  控制項類別分類 ,[object Object]
VCL  控制項的擁有關係 ,[object Object],[object Object],任何不具視窗的  TControl  元件都必須以一個  TWinControl  元件為  parent  元件,也就是被一個  TWinControl  元件包含,它才能夠出現在畫面上。
VCL  控制項的擁有關係 ,[object Object],[object Object]
VCL  程式運作類別 ,[object Object]
VCL  程式運作類別- TForm ,[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  程式運作類別- TApplication ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
VCL  RAD  支援類別 ,[object Object]
VCL  RAD  支援類別
TStream ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TFiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Creating Database Application ,[object Object],[object Object],[object Object],[object Object],[object Object]
Connecting to Database in C++Builder ,[object Object]
Using the Database Explorer ,[object Object],[object Object],[object Object]
Using the Database Desktop ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using Database Wizards ,[object Object],[object Object],[object Object],[object Object],[object Object]
Creating a Database Form -  Step by Step ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TTable and TDataSource ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Understanding Fields ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Field Property Editor ,[object Object],[object Object],[object Object]
Creating Calculated Fields ,[object Object],[object Object]
Manipulating the DataSets ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data Navigating ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Limiting Record Sets ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Search for Records ,[object Object],[object Object],[object Object],tblBook->SetKey(); tblBook->FieldByName('State')->AsString = “CA”; tblBook->FieldByName('City')->AsString = “Santa Barbara”; tblBook->GotoKey(); TLocateOptions SearchOptions; SearchOptions = SearchOptions << loPartialKey; LocateSuccess = CustTable->Locate(&quot;Company&quot;,    &quot;Professional Divers, Ltd.&quot;, SearchOptions);
Bookmarking Records void DoSomething (const TTable *Tbl) { TBookmark Bookmark; Bookmark = Tbl->GetBookmark(); //Allocate memory and assign a value Tbl->DisableControls(); // Turn off display of records in data controls try { Tbl->First(); // Go to first record in table while (!Tbl->Eof) // Iterate through each record in table { // Do your processing here ... Tbl->Next(); } } catch(...) { Tbl->GotoBookmark(Bookmark); Tbl->EnableControls(); // Turn on display of records in data controls,  Tbl->FreeBookmark(Bookmark); // Deallocate memory for the bookmark } }
善用除錯工具,縮短開發時間 ,[object Object],[object Object],[object Object],[object Object]
資源保固機制 ,[object Object],[object Object],GetMem(p, 100); try ... //  儘情使用  p finally FreeMem(p); end; try ...  Exit; //  離開此  procedure  或  function finally ... //  善後工作 end;
例外處理機制 ,[object Object],[object Object],GetMem(pBuffer, 1000); if (pBuffer = nil) then begin /* error processing code here; */ end; //  取得  x,  計算  x  的倒數 if x = 0 then begin /* error processing code here; */ end;
例外處理機制 ,[object Object],[object Object],try edtTotal.Text := IntToStr( StrToInt( edtOp1.Text ) / StrToInt( edtOp2.Text ) ); except on EDivByZero do ShowMessage( ' Cannot divide by zero ' ); on EConvertError do ShowMessage( ' Error during conversion ' ); end;
例外處理機制 ,[object Object],[object Object],try if numItems = 0 then raise EDivByZero.Create( ' Cannot divide by zero ' ) // ^ throw your own exception else edtAvg.Text := FloatToStr( sum / numItems ); except edtAvg.Text := FloatToStr(0.0); raise; // <- re-throw the same exception end;
例外處理機制 ,[object Object],[object Object],EInvalidBalance = class(Exception); raise EInvalidBalance.Create( 'Invalid Number');
例外處理機制 ,[object Object],[object Object],[object Object]
Assert  程序 ,[object Object],[object Object],procedure TForm1.SetID(Id: Integer); begin Assert((id) >=  ID_MIN  and (id <=  ID_MAX )); ... //  正常處理 end; Assertion failed: test, file filename, line linenum
Assert  程序 ,[object Object],[object Object],[object Object],void __fastcall TForm1::SetID(int id) { char *p = malloc(100); assert(p != NULL); ... };
OutputDebugString  除錯字串 ,[object Object],[object Object],[object Object],[object Object]
OutputDebugString  除錯字串 ,[object Object]
系統層級除錯器- SoftICE ,[object Object]
系統層級除錯器- SoftICE ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
系統層級除錯器- SoftICE
系統層級除錯器- SoftICE
Summary ,[object Object],[object Object],[object Object]
實作與理論 ,[object Object],[object Object],[object Object]
實作與理論 ,[object Object],[object Object],它們都是實作,可是理論都在裡頭。
實作與理論 ,[object Object],[object Object]
實作與理論 ,[object Object],[object Object],[object Object],[object Object]
參考書目 -  C / C++ Programming ,[object Object],[object Object],[object Object]
參考書目-  Delphi / C++Builder ,[object Object],[object Object],[object Object],[object Object],[object Object]
參考書目 -  Windows Programming ,[object Object],[object Object],[object Object],[object Object]
參考書目-  OOA / OOD / OOP ,[object Object],[object Object],[object Object],[object Object]
參考書目-  Practical Programming  ,[object Object],[object Object],[object Object]
參考書目-  工具書 ,[object Object],[object Object]
Delphi  深度歷險 ,[object Object]
Delphi  深度論壇 ,[object Object]
C++Builder  深度歷險 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C++Builder  進階課程 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
THE END 有緣再見! http://www.iis.sinica.edu.tw/~cychen/index_c.html

Contenu connexe

Tendances

04 이벤트처리
04 이벤트처리04 이벤트처리
04 이벤트처리
jaypi Ko
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
Doncho Minkov
 

Tendances (20)

C sharp
C sharpC sharp
C sharp
 
App inventor 教學講義 chapter4
App inventor 教學講義 chapter4App inventor 教學講義 chapter4
App inventor 教學講義 chapter4
 
Container based android
Container based androidContainer based android
Container based android
 
系統程式 -- 第 9 章
系統程式 -- 第 9 章系統程式 -- 第 9 章
系統程式 -- 第 9 章
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Many
 
Czy powinniśmy się przejmować Core Web Vitals?
Czy powinniśmy się przejmować Core Web Vitals?Czy powinniśmy się przejmować Core Web Vitals?
Czy powinniśmy się przejmować Core Web Vitals?
 
系統程式 -- 第 2 章
系統程式 -- 第 2 章系統程式 -- 第 2 章
系統程式 -- 第 2 章
 
Windows programming ppt
Windows programming pptWindows programming ppt
Windows programming ppt
 
04 이벤트처리
04 이벤트처리04 이벤트처리
04 이벤트처리
 
Valgrind tutorial
Valgrind tutorialValgrind tutorial
Valgrind tutorial
 
App inventor 3
App inventor 3App inventor 3
App inventor 3
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
FISL XIV - The ELF File Format and the Linux Loader
FISL XIV - The ELF File Format and the Linux LoaderFISL XIV - The ELF File Format and the Linux Loader
FISL XIV - The ELF File Format and the Linux Loader
 
C#.NET
C#.NETC#.NET
C#.NET
 
Vulkan 1.1 Reference Guide
Vulkan 1.1 Reference GuideVulkan 1.1 Reference Guide
Vulkan 1.1 Reference Guide
 
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
Introduction to kotlin for android app development   gdg ahmedabad dev fest 2017Introduction to kotlin for android app development   gdg ahmedabad dev fest 2017
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
 
C # (C Sharp).pptx
C # (C Sharp).pptxC # (C Sharp).pptx
C # (C Sharp).pptx
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
 
03 첫번째프로그램
03 첫번째프로그램03 첫번째프로그램
03 첫번째프로그램
 
Windowforms controls c#
Windowforms controls c#Windowforms controls c#
Windowforms controls c#
 

En vedette

Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop
Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop
Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop
YKLee3434
 
Research Skills I Learned in UIUC from Pi-Cheng Hsiu
Research Skills I Learned in UIUC from Pi-Cheng HsiuResearch Skills I Learned in UIUC from Pi-Cheng Hsiu
Research Skills I Learned in UIUC from Pi-Cheng Hsiu
Sheng-Wei (Kuan-Ta) Chen
 

En vedette (20)

一位程式人 PI 在中研院
一位程式人 PI 在中研院一位程式人 PI 在中研院
一位程式人 PI 在中研院
 
網路購書大數據– 給出版者的洞察分析
網路購書大數據– 給出版者的洞察分析網路購書大數據– 給出版者的洞察分析
網路購書大數據– 給出版者的洞察分析
 
Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4
 
Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop
Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop
Photoshop 的色階與曲線調整 Levels and curve Adjustment in Photoshop
 
Image and image component 影像與影像元件
Image and image component 影像與影像元件Image and image component 影像與影像元件
Image and image component 影像與影像元件
 
程式人雜誌 -- 2013 年 2 月號
程式人雜誌 -- 2013 年 2 月號程式人雜誌 -- 2013 年 2 月號
程式人雜誌 -- 2013 年 2 月號
 
Web 2.0世代的資安議題
Web 2.0世代的資安議題Web 2.0世代的資安議題
Web 2.0世代的資安議題
 
20150911 [社團事務] 跑酷社創社審查
20150911 [社團事務] 跑酷社創社審查20150911 [社團事務] 跑酷社創社審查
20150911 [社團事務] 跑酷社創社審查
 
線上遊戲與雲端運算
線上遊戲與雲端運算線上遊戲與雲端運算
線上遊戲與雲端運算
 
從鍵盤走向社會 @KCG
從鍵盤走向社會 @KCG從鍵盤走向社會 @KCG
從鍵盤走向社會 @KCG
 
20160802 那些年,關於大學的那些事...
20160802 那些年,關於大學的那些事...20160802 那些年,關於大學的那些事...
20160802 那些年,關於大學的那些事...
 
20161211 給社團人的一封信
20161211 給社團人的一封信20161211 給社團人的一封信
20161211 給社團人的一封信
 
20150104各類型社團文件的製作,上傳以及活動舉辦的說明與操作
20150104各類型社團文件的製作,上傳以及活動舉辦的說明與操作20150104各類型社團文件的製作,上傳以及活動舉辦的說明與操作
20150104各類型社團文件的製作,上傳以及活動舉辦的說明與操作
 
Research Skills I Learned in UIUC from Pi-Cheng Hsiu
Research Skills I Learned in UIUC from Pi-Cheng HsiuResearch Skills I Learned in UIUC from Pi-Cheng Hsiu
Research Skills I Learned in UIUC from Pi-Cheng Hsiu
 
Inside VCL
Inside VCLInside VCL
Inside VCL
 
資料科學家未曾公開之資安研究事件簿
資料科學家未曾公開之資安研究事件簿資料科學家未曾公開之資安研究事件簿
資料科學家未曾公開之資安研究事件簿
 
Crowdsourcing beyond Mechanical Turk: Building Crowdmining Services for Your ...
Crowdsourcing beyond Mechanical Turk: Building Crowdmining Services for Your ...Crowdsourcing beyond Mechanical Turk: Building Crowdmining Services for Your ...
Crowdsourcing beyond Mechanical Turk: Building Crowdmining Services for Your ...
 
20160829 夢想,Loading...
20160829 夢想,Loading...20160829 夢想,Loading...
20160829 夢想,Loading...
 
一位年輕探索者的建議
一位年輕探索者的建議一位年輕探索者的建議
一位年輕探索者的建議
 
Network and Multimedia QoE Management
Network and Multimedia QoE ManagementNetwork and Multimedia QoE Management
Network and Multimedia QoE Management
 

Similaire à Borland C++Builder 入門課程

Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發
Chui-Wen Chiu
 
Introduction To Direct Show
Introduction To Direct ShowIntroduction To Direct Show
Introduction To Direct Show
guestce3937
 
Introduction To Direct Show
Introduction To  Direct ShowIntroduction To  Direct Show
Introduction To Direct Show
guestce3937
 
Windows Mobile 6 遊戲開發入門
Windows Mobile 6 遊戲開發入門Windows Mobile 6 遊戲開發入門
Windows Mobile 6 遊戲開發入門
Chui-Wen Chiu
 
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Gelis Wu
 
Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享
Liyao Chen
 
TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式
TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式
TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式
Will Huang
 
Silverlight 2.0 完全新手學堂,基礎入門 10 大招
Silverlight 2.0 完全新手學堂,基礎入門 10 大招Silverlight 2.0 完全新手學堂,基礎入門 10 大招
Silverlight 2.0 完全新手學堂,基礎入門 10 大招
Chui-Wen Chiu
 
Baidu LSP and DISQL for Log Analysis
Baidu LSP and DISQL for Log AnalysisBaidu LSP and DISQL for Log Analysis
Baidu LSP and DISQL for Log Analysis
Xiaoming Chen
 
深入研究 Windows 系統服務 效能調校與故障排除
深入研究 Windows 系統服務    效能調校與故障排除深入研究 Windows 系統服務    效能調校與故障排除
深入研究 Windows 系統服務 效能調校與故障排除
5045033
 

Similaire à Borland C++Builder 入門課程 (20)

Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發
 
Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發
 
MFC tips for single document
MFC tips for single documentMFC tips for single document
MFC tips for single document
 
Introduction To Direct Show
Introduction To Direct ShowIntroduction To Direct Show
Introduction To Direct Show
 
Introduction To Direct Show
Introduction To  Direct ShowIntroduction To  Direct Show
Introduction To Direct Show
 
Windows Mobile 6 遊戲開發入門
Windows Mobile 6 遊戲開發入門Windows Mobile 6 遊戲開發入門
Windows Mobile 6 遊戲開發入門
 
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
 
Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享Windows 8 apps dev.整理及分享
Windows 8 apps dev.整理及分享
 
Android应用开发 - 沈大海
Android应用开发 - 沈大海Android应用开发 - 沈大海
Android应用开发 - 沈大海
 
TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式
TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式
TypeScript 開發實戰:開發即時互動的 html5 websocket 聊天室應用程式
 
HTML+COIMOTION 開發跨平台 app
HTML+COIMOTION 開發跨平台 appHTML+COIMOTION 開發跨平台 app
HTML+COIMOTION 開發跨平台 app
 
Silverlight 2.0 完全新手學堂,基礎入門 10 大招
Silverlight 2.0 完全新手學堂,基礎入門 10 大招Silverlight 2.0 完全新手學堂,基礎入門 10 大招
Silverlight 2.0 完全新手學堂,基礎入門 10 大招
 
Baidu LSP and DISQL for Log Analysis
Baidu LSP and DISQL for Log AnalysisBaidu LSP and DISQL for Log Analysis
Baidu LSP and DISQL for Log Analysis
 
教學投影片01_Vb2005
教學投影片01_Vb2005教學投影片01_Vb2005
教學投影片01_Vb2005
 
C+
C+C+
C+
 
C#
C#C#
C#
 
系統程式 -- 第 1 章
系統程式 -- 第 1 章系統程式 -- 第 1 章
系統程式 -- 第 1 章
 
深入研究 Windows 系統服務 效能調校與故障排除
深入研究 Windows 系統服務    效能調校與故障排除深入研究 Windows 系統服務    效能調校與故障排除
深入研究 Windows 系統服務 效能調校與故障排除
 
Android 智慧型手機程式設計
Android 智慧型手機程式設計Android 智慧型手機程式設計
Android 智慧型手機程式設計
 
Jobforcompal
JobforcompalJobforcompal
Jobforcompal
 

Plus de Sheng-Wei (Kuan-Ta) Chen

人工智慧在台灣: 產業轉型的契機與挑戰
人工智慧在台灣: 產業轉型的契機與挑戰人工智慧在台灣: 產業轉型的契機與挑戰
人工智慧在台灣: 產業轉型的契機與挑戰
Sheng-Wei (Kuan-Ta) Chen
 
從大數據走向人工智慧
從大數據走向人工智慧從大數據走向人工智慧
從大數據走向人工智慧
Sheng-Wei (Kuan-Ta) Chen
 

Plus de Sheng-Wei (Kuan-Ta) Chen (8)

人工智慧在台灣: 產業轉型的契機與挑戰
人工智慧在台灣: 產業轉型的契機與挑戰人工智慧在台灣: 產業轉型的契機與挑戰
人工智慧在台灣: 產業轉型的契機與挑戰
 
台灣人工智慧學校介紹
台灣人工智慧學校介紹台灣人工智慧學校介紹
台灣人工智慧學校介紹
 
聰明公益資訊平台
聰明公益資訊平台聰明公益資訊平台
聰明公益資訊平台
 
從 Project Theta 到台灣人工智慧學校
從 Project Theta 到台灣人工智慧學校從 Project Theta 到台灣人工智慧學校
從 Project Theta 到台灣人工智慧學校
 
從大數據走向人工智慧
從大數據走向人工智慧從大數據走向人工智慧
從大數據走向人工智慧
 
資料科學如何幫我們更瞭解捐款人?
資料科學如何幫我們更瞭解捐款人?資料科學如何幫我們更瞭解捐款人?
資料科學如何幫我們更瞭解捐款人?
 
計算社會科學初探- 當電腦科學家遇上社會科學
計算社會科學初探-當電腦科學家遇上社會科學計算社會科學初探-當電腦科學家遇上社會科學
計算社會科學初探- 當電腦科學家遇上社會科學
 
當學術研究者遇見線上遊戲
當學術研究者遇見線上遊戲當學術研究者遇見線上遊戲
當學術研究者遇見線上遊戲
 

Dernier

1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂
1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂
1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂
PUAXINYEEMoe
 
10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习
10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习
10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习
PUAXINYEEMoe
 
法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个
法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个
法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个
michaelell902
 

Dernier (9)

1.🎉成绩单,你的成绩! 💡🔥每个人都有自己的成绩单,它记录着我们努力的成果。但有时候,看着这些数字,却发现它们好像在嘲笑我?别担心,让我来告诉你们怎么改...
1.🎉成绩单,你的成绩! 💡🔥每个人都有自己的成绩单,它记录着我们努力的成果。但有时候,看着这些数字,却发现它们好像在嘲笑我?别担心,让我来告诉你们怎么改...1.🎉成绩单,你的成绩! 💡🔥每个人都有自己的成绩单,它记录着我们努力的成果。但有时候,看着这些数字,却发现它们好像在嘲笑我?别担心,让我来告诉你们怎么改...
1.🎉成绩单,你的成绩! 💡🔥每个人都有自己的成绩单,它记录着我们努力的成果。但有时候,看着这些数字,却发现它们好像在嘲笑我?别担心,让我来告诉你们怎么改...
 
啟思中國語文 - 中二 單元一 - 孟嘗君列傳 - 記敍的方法和人稱1.pptx
啟思中國語文 - 中二 單元一 - 孟嘗君列傳 - 記敍的方法和人稱1.pptx啟思中國語文 - 中二 單元一 - 孟嘗君列傳 - 記敍的方法和人稱1.pptx
啟思中國語文 - 中二 單元一 - 孟嘗君列傳 - 記敍的方法和人稱1.pptx
 
1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂
1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂
1.1.3急救你必须懂四年级设计与工艺练习活页练习单元一四年级设计与工艺急救你必须懂
 
Math Chapter3-教學PPT第03單元形體關係、體積與表面積Grade Six
Math Chapter3-教學PPT第03單元形體關係、體積與表面積Grade SixMath Chapter3-教學PPT第03單元形體關係、體積與表面積Grade Six
Math Chapter3-教學PPT第03單元形體關係、體積與表面積Grade Six
 
taibif_資料標準概念介紹_20240509_20240509_20340509.pdf
taibif_資料標準概念介紹_20240509_20240509_20340509.pdftaibif_資料標準概念介紹_20240509_20240509_20340509.pdf
taibif_資料標準概念介紹_20240509_20240509_20340509.pdf
 
taibif_開放資料流程-清理資料01-通則_20240509_20240509.pdf
taibif_開放資料流程-清理資料01-通則_20240509_20240509.pdftaibif_開放資料流程-清理資料01-通則_20240509_20240509.pdf
taibif_開放資料流程-清理資料01-通則_20240509_20240509.pdf
 
1.🎉“黑客”如何修改成绩?🤔🎉 在这个信息爆炸的时代,我们经常会看到各种作弊手段。但是你知道吗?有一种作弊方式可能比你想象中更巧妙:它就是——黑客![单...
1.🎉“黑客”如何修改成绩?🤔🎉 在这个信息爆炸的时代,我们经常会看到各种作弊手段。但是你知道吗?有一种作弊方式可能比你想象中更巧妙:它就是——黑客![单...1.🎉“黑客”如何修改成绩?🤔🎉 在这个信息爆炸的时代,我们经常会看到各种作弊手段。但是你知道吗?有一种作弊方式可能比你想象中更巧妙:它就是——黑客![单...
1.🎉“黑客”如何修改成绩?🤔🎉 在这个信息爆炸的时代,我们经常会看到各种作弊手段。但是你知道吗?有一种作弊方式可能比你想象中更巧妙:它就是——黑客![单...
 
10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习
10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习
10.2.1 马来西亚各州名称的由来六年级历史单元练习马来西亚各州名称的由来练习
 
法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个
法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个
法国蒙彼利埃国家高等建筑学院毕业证制作/德语歌德B1证书/加拿大新斯科舍省农业学院文凭加急制作一个
 

Borland C++Builder 入門課程

  • 1. 陳寬達 ( 陳昇瑋 ) 講師、技術作家、共享軟體作者 http://www.iis.sinica.edu.tw/~ s wc /index_c.html Borland C ++ Builder 入門課程
  • 2.
  • 3.
  • 4. 獨立的 4GB 位址空間- Windows 95/98 架構 0xFFFFFFFF ~ 0xC0000000 1 GB 區域。用於 VxD 、記憶體管理、系統程式碼,所有 Win32 處理程序共享。 0xBFFFFFFF ~ 0x80000000 1 GB 區域。用於記憶體對映檔案及 Win32 DLL ,所有 Win32 程序共享。 0x7FFFFFFF ~ 0x00400000 2143289344 位元組,約 2044 MB ,每個 Win32 處理程序私有區域。 0x003FFFFF ~ 0x00001000 4190208 位元組,約 4 MB ,放置 DOS 及 Win16 應用程式。 0x00000FFF ~ 0x00000000 4096 位元組,用於偵測不合法指標。
  • 5. 獨立的 4GB 位址空間- Windows NT 架構 2 GB 區域。用於作業系統、核心程式及驅動程式,應用程式無法存取。 0xFFFFFFFF ~ 0x80000000 0x7FFEFFFF ~ 0x00010000 2147352576 位元組,約 2047 MB ,每個 Win32 處理程序私有區域。 0x0000FFFF ~ 0x00000000 64 KB 區域。用於偵測不合法指標。 0x7FFFFFFF ~ 0x7FFF0000 64 KB 區域。用於偵測不合法指標。
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. 檢視 DLL 提供的函式 E:INNTystem32>dumpbin /exports user32.dll Microsoft (R) COFF Binary File Dumper Version 5.00.7022 Copyright (C) Microsoft Corp 1992-1997. All rights reserved. Dump of file user32.dll File Type: DLL Section contains the following Exports for USER32.dll 0 characteristics 336A2A2A time date stamp Sat May 03 01:53:46 1997 0.00 version 1 ordinal base 634 number of functions 634 number of names ordinal hint name 1 0 ActivateKeyboardLayout (00015B1A) 2 1 AdjustWindowRect (0000D704) 3 2 AdjustWindowRectEx (00007D8E) 4 3 AnyPopup (00043ABB) 5 4 AppendMenuA (00011F57) 6 5 AppendMenuW (0002D7A4)
  • 20. 檢視 DLL 提供的資源
  • 21.
  • 22.
  • 23.
  • 24. 訊息處理機制 USER32.DLL 訊息迴圈 視窗函式 messages post messages send / post messages while ( GetMessage (&Msg, NULL, NULL, NULL)) { TranslateMessage (Msg); DispatchMessage (Msg); } switch (Msg.Message) { // 視窗建立時 case WM_CREATE: ... // 按下滑鼠左鍵 case WM_LBUTTONDOWN: ... // 按下按鍵時 case WM_KEYDOWN: ... // 關閉視窗時 case WM_CLOSE: ... }
  • 25.
  • 26.
  • 27.
  • 28. 行程、執行緒、訊息佇列及 訊息迴圈 行程 執行緒 訊息佇列 程式碼 視窗 C 視窗函式 訊息迴圈 視窗 C 視窗 D 視窗 D 視窗函式 取出 分派 執行緒 訊息佇列 程式碼 視窗 A 視窗函式 訊息迴圈 視窗 A 視窗 B 視窗 B 視窗函式 取出 分派 工作執行緒 程式碼
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43. CPP Project File #include <vcl.h> #pragma hdrstop USERES(&quot;Project1.res&quot;); USEFORM(&quot;Unit1.cpp&quot;, Form1); WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TForm1), &Form1); Application-> Run() ; } catch (Exception &exception) { Application->ShowException(&exception); } return 0; }
  • 44.
  • 45.
  • 46.
  • 48. Our First C++Builder Program void __fastcall TForm1::Button1Click(TObject *Sender) { ShowMessage(&quot;Written by Kuan-Ta Chen&quot;); } void __fastcall TForm1::Button2Click(TObject *Sender) { Close(); }
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85. 程式實作-自動發信 void __fastcall TForm1::Label1Click(TObject *Sender) { ShellExecute(Handle, &quot;open&quot;, &quot;mailto:kuan@ilife.cx&quot;, NULL, NULL, SW_SHOW); }
  • 86. 程式實作-影像載入 void __fastcall TForm1::Label1Click(TObject *Sender) { if (OpenPictureDialog1->Execute()) Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); }
  • 87.
  • 88. 程式實作-動態建立元件 void __fastcall TForm1::ButtonClick(TObject *Sender) { Edit1->Text = Edit1->Text + AnsiString(dynamic_cast<TComponent*>(Sender)->Tag); }
  • 89. 程式實作-操作字串陣列 void __fastcall TForm1::Button1Click(TObject *Sender) { AnsiString S; if (InputQuery(Application->Title, &quot; 請輸入字串 &quot;, S)) ListBox1->Items->Add(S); }
  • 91. 程式實作- MDI 應用程式 void __fastcall TMainForm::mnuNewClick(TObject *Sender) { if (OpenDialog1->Execute()) { TTextForm* frm = new TTextForm(this); frm->Caption = OpenDialog1->FileName; frm->Memo1->Lines->LoadFromFile(OpenDialog1->FileName); frm->Show(); } }
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102. VCL 的 Run-Time Package 面貌
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131. VCL RAD 支援類別
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148. Bookmarking Records void DoSomething (const TTable *Tbl) { TBookmark Bookmark; Bookmark = Tbl->GetBookmark(); //Allocate memory and assign a value Tbl->DisableControls(); // Turn off display of records in data controls try { Tbl->First(); // Go to first record in table while (!Tbl->Eof) // Iterate through each record in table { // Do your processing here ... Tbl->Next(); } } catch(...) { Tbl->GotoBookmark(Bookmark); Tbl->EnableControls(); // Turn on display of records in data controls, Tbl->FreeBookmark(Bookmark); // Deallocate memory for the bookmark } }
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179. THE END 有緣再見! http://www.iis.sinica.edu.tw/~cychen/index_c.html