Jump to content
NovaSmartTechnology

Tutorial #1: Vc++ 2005

Recommended Posts

Pengenalan Kepada Visual C++ 2005

Kita akan gunakan Visual C++ 2005 Express Edition (akan di tulis sebagai VC++ 2005 selepas ini) dalam tutorial kita sebab ia (percuma dan boleh di download dari laman web microsoft . Lihat bahagian "Muat Turun".

1) Apa dia Visual C++ 2005 Express Edition

Visual C++ 2005 adalah compiler terbaru daripada microsoft. Ia boleh digunakan untuk develop applicasi menggunakan bahasa pengaturcaraan C, C++ atau C++/CLI (.NET).

Berikut adalah limitation untuk "Express Edition" berbanding edisi lain (dari wikipedia)

* Limited to one CPU

* Lack of enterprise features support

* One GB memory limit for the buffer pool

* Databases have a 4 GB maximum size

* No Data mirroring and/or clustering

* No importing or exporting of table structures or table data

Selain itu, "Express Edition" juga tidak mempunyai GUI untuk development win32 seperti MFC dan ATL. Sesiapa yang berminat utk gunakan enablekan GUI untuk win32, sila ikuti langkah "5) Step untuk enable kan win32/native compilation"

2) Muat Turun

Dalam sesi ini, kita akan perlukan 3 software

Download 7-Zip (utk ISO extractor) dari

http://www.7-zip.org/

atau

WinRAR (utk ISO extractor) dari

http://www.rarlab.com/

Download Visual C++ 2005 ISO dari (IDE + compiler + MSDN)

http://msdn.microsoft.com/vstudio/express/support/install/

3) Pemasangan

1. Install 7-Zip

2. Extract vc.iso menggunakan 7-Zip

ExtractVC.jpg

3. Install VC++ 2005. Saya cadangkan anda pillih untul install MSDN (ia adalah help) since ia akan membantu anda dalam develop software dalam VC++2005 ini

4) Screen Pembukaan

Anda akan lihat screen di bawah apabile anda buka VC++ 2005 buat kali pertama.

OpeningScreen.jpg

(Optional)

5) Step untuk enable kan win32/native compilation

Download Microsoft Platform Software Development Kit (SDK) dari (Untuk develop native win32 application)

http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Sebaik sahaja selepas install VC++ 2005, kita dah boleh gunakannya untuk develop aplikasi menggunakan teknologi C++/CLI atau lebih dikenali sbagai ".NET". Dalam tutorial init, kita tidak akan gunakan win32. Tapi, mungkin sesetengah orang masih prefer menggunakan win32 atau "Native" kerana ia lebih laju portable ke lain-lain operating system contohnya Linux, MacOS, dll(dengan beberapa peraturan, eg: ISO C++, takder windows API, dll).

Untuk membolehkan kita compile ke win32, kita perlu melakukan beberapa pengubahsuaian.

* C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\corewin_express.vsprops

Asal:

corewin_express_vsprops_ori.jpg

Ubah Ke:

corewin_express_vsprops_mod.jpg

* c:\program files\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\AppSettings.htm

Asal:

AppSettings_ori.jpg

Ubah Ke:

AppSettings_mod.jpg

* Buka VC++ 2005, pada MENU, ambil "Tools -> Option"

* Masukkan path seperti berikut. Lihat gambar:

* Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin

psdkexec.jpg

* Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include

psdkinclude.jpg

* Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

psdklib.jpg

* Kemudian, download dan install WTL dari http://sourceforge.net/projects/wtl/

Share this post


Link to post
Share on other sites

sekarang tengah download PSDK ... bila siap pun tak tahu nih.. :D

Betul ke proses nie?

psdk.png

Betul ke fail WTL

Macamana nak install?

wtl.png

Edited by OngBok

Share this post


Link to post
Share on other sites

Saya sebenarnya x bercadang nk sambung cara nk install WTL nih. Tapi since ada request, saya sambung la sikit lagi, macam mana nak install WTL.

6) Langkah Pemasangan WTL

* Extract WTL ke mana-mana directory. Contohnya, saya pilih untuk extract WTL ke C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\wtl

wtl_dir.jpg

* Install WTL dengan double click pada ..\AppWiz\setup80x.js

wtl_setup.jpg

* Buka VC++ 2005, pada MENU, ambil "Tools -> Option"

* Masukkan path seperti berikut. Lihat gambar:

* Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\Atl

atlinclude.jpg

* Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\wtl\include

wtl_include.jpg

* Ubah fail C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl\atlwin.h

Asal:

altwin_h_ori.jpg

Ubah Ke:

altwin_h_mod.jpg

* Ubah fail C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl\atlbase.h

Asal:

atlbase_h_ori.jpg

Ubah Ke:

atlbase_h_mod.jpg

Untuk memudahkan copy-paste, sila lihat code di bawah:

    /*
    PVOID __stdcall __AllocStdCallThunk(VOID);
    VOID __stdcall __FreeStdCallThunk(PVOID);

    #define AllocStdCallThunk() __AllocStdCallThunk()
    #define FreeStdCallThunk(p) __FreeStdCallThunk(p)

    #pragma comment(lib, "atlthunk.lib")
    */
    #define AllocStdCallThunk() HeapAlloc(GetProcessHeap(), 0, sizeof(_stdcallthunk))
    #define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)

* Sekarang anda akan WTL wizard telah 100% dipasang

Asal:

general_wizard_ori.jpg

Sekarang:

wtl_wizard.jpg

* Sekarang, anda boleh mulakan project anda menggunakan WTL. Saya tak akan ajar macam mana untuk gunakan WTL (sbb saya hanya target beginners). Sila rujuk lain-lain website yang mempunyai tutorial WTL.

* Untuk pengetahuan orang baru dalam programming, applikasi WTL biasanya 50% lebih kecil daripada MFC & .NET dan lebih laju, kerana ia adalah native dan tidak bergantung pada external DLL.

Share this post


Link to post
Share on other sites

* Untuk pengetahuan orang baru dalam programming, applikasi WTL biasanya 50% lebih kecil daripada MFC & .NET dan lebih laju, kerana ia adalah native dan tidak bergantung pada external DLL.

wow. thanks for the tutorial and this info. tak tau lak.

Share this post


Link to post
Share on other sites

Nak tanya sikit nie. apa beza antara;

VC++ V6

VC++ 2005

VC++ .Net

bagi orang baru yang perlu tahu.

Terima kasih.

saya paste je la dr wikipedia:

Visual C++ 6.0

which includes MFC 6.0, was released in 1998, was (and still is) widely used for large and small projects

Visual C++ .NET 2002 (known also as Visual C++ 7.0)

which includes MFC 7.0, was released in 2002 with support for link time code generation and debugging runtime checks. This version also included managed extensions to the C++ language, as well as a new user interface (shared with Visual Basic and Visual C#), which is a primary reason why Visual C++ 6.0 is still in wide use.

Visual C++ .NET 2003 (known also as Visual C++ 7.1)

which includes MFC 7.1, was released in 2003 and was a major upgrade to Visual C++ .NET 2002.

Visual C++ 2005 (known also as Visual C++ 8.0)

which includes MFC 8.0, was released in November 2005. This version also introduced support for the C++/CLI language and OpenMP. It is currently the latest release.

adakah ianya lebih baik dari C++ builder ?

Susah nak bandingkan... tapi saya memang pernah guna kedua-duanya. Bagi saya, MS VC++ lebih user friendly berbanding Borland C++ Builder dan shorter learning curve.

Tapi, ada beberapa kelebihan C++ builder berbanding VC++

1] Boleh compile dalam Linux menggunakan Kylix

2] Lebih secured, dalam erti kata untuk di [biskut tawar].

WTL untuk VC++ adalah hampir sama dengan C++ Builder (kalau x pakai component) sebab kedua2nya template based

adakah ianya lebih baik dari C++ builder ? .. bolehkah compile winsock utk diguna dalam paltform DOS ???

Tak. Tapi ada beberapa alternative. Saya recommend gunakan:

http://sourceforge.net/projects/watt-32

Since ia BSD API compatible dan support 32 bit DOS.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...