How To Write First Generic Win32 App. In Visual Studio 6.0 ( VC 98 ) : ---------------------------------------------------------------------- 01) Start Visual C++ IDE. 02) Click On "File\New" Menu Item. A "New" Dialog Box Will Appear. 03) From Its "Projects" Tab Select "Win32 Application". 04) On Right Side, In "Project Name" Edit Box, Type Project Name. 05) Then There Is "Location" Edit Box. Location Means "Where You Want To Put Your Project". So Either Type Path Of Desired Location Folder Or Browse To Location Folder By Clicking On Adjacent Browse Button. 06) Keep Both "Create New Workspace" Radio Button & "Win32" Check Box, ( From "Platforms:" Group Box ) Checked. 07) Click "Ok" To Proceed. 08) Now "Win32 Application Wizard" Appears With Its "Step 1 Of 1". Click "An empty project" Radio Button And Press "Finish" Button. 09) Now You Will Get "New Project Information" Dialog. Press "Ok" To Proceed. 10) Uptill Now Title Bar Of VC++ IDE Was Showing "Microsoft Visual C++" As Its Title. After Above Step, It Will Start Showing Name Of Your Project Too. 11) If Your IDE Shows "Workspace" Window On Left Side Of IDE, Close It To Make More Space. 12) Now Again Click On "File\New" Menu Item ( As Was Done In Step 2 ). A "New" Dialog Box Will Appear. But In Step 2, This Dialog Box Appeared With "Projects" Tab, Now It Will Appear With "Files" Tab With Types Of Files In It. 13) Select "Text File" Type. 14) On Right Side, See, Whether "Add To Project" Check Box Is Checked Or Not. If Not Checked, Then Check It. 15) In "File Name" Edit Box, Type Desired File Name And Give It ".c" Extension Explicitly. If You Were Selected File Type As "C++ Source File" In Step 13, Then There Would Be No Need To Give Any Extension Explicitly, Because That File Type By Default Has ".cpp" Extension. But Here We Want To Give ".c" Extension And There Is No Such File Type, Hence We Selected "Text File" As File Type And Given ".c" Extension Explicitly. NOTE : By The Way, As Every "C" Program Is "CPP" Program, We May ------ Select "C++ Source File" As File Type In Step 13, & Proceed As Usual To Write Our "C" Program In C++ Source File Without Giving Any Explicit Extension Because We Already Have ".cpp" Extension By Default. 16) A Window With Your File Name Will Appear Inside The IDE Where You Start Typing The Win32 Generic Application's Code And Save It. 17) Now Go To "Build" Menu Of IDE And Follow One Of The Following Ways a) First Click On "Compile" Menu, Then On "Build" Menu And Finally On "Execute" Menu To Run The Application. b) First Click On "Rebuild All" Menu And Then On "Execute" Menu To Run The Application. NOTE : Difference Between Two Ways Is That, In "a", The "Compile" ------ Menu Compiles One Source Files At A Time. Means If We Have Many Source Files, Then We Have To Open & Compile Each Of Them To Object File. Then "Build" Menu Links All Object Files To Required Libraries And Will Create Final Exe File Which Will Be Executed By "Execute" Menu. While Way "b" Compiles All Source & Resource Files "At Once" To Their Object Files And Also Links Them With Libraries To Create Final Exe Which iS Then Executed By "Execute" Menu. 18) After 7 th Step, A Directory Of Our Project Name Is Created At Our Chosen Location And After 17 th Step, A Subdirectory Named "Debug" Is Created Under Above Directory. This "Debug" Directory Contains Our Exe File. Note That Exe File Has The Name Of Project And Not Of Any File In The Project. NOTE : This "Debug" Subdirectory Gets Created Automatically Because ------ Our Project's "Active Configuration" Is By Default "Debug". Another Such Configuration Is "Release". If This Is Chosen Then Instead Of "Debug" Subdirectory We Would Have "Release" Subdirectory And Our Exe Would Be Inside It. Actually Whether To Set Active Configuration To "Debug" Or To "Release" Depends Upon Stage Of Program Development. Means If Program Is Under Development, We Should Set It To "Debug" i.e. Which Is By Default Set. But If We Think That Our Program Is Ready For Deployment, We Should Set It To "Release". To Do Above Setting, Go To The Menu "Build" And Select "Set Active Configuration" Menu Item Where You Will Found That "Debug" Is Set "By Default". 19) You Can Execute\Run The Application By One Of The Following 4 Ways a) Click On "Build" Menu's "Execute" Menu Item. NOTE : Here Remember One Thing. Though You Are Execuing Your App ------ This Option Lets You To Go To "Debug\Release" Directory From Your Project's Directory. In Other Words, Though Your Executing Exe Is In "Debug" ( Or "Release" ), Your "Working Directory" Is Still Your "Project's Directory" And Not The "Debug" ( Or "Release" ) Directory. This Is Important. Because If You Write Code To Open A File Without Giving Path And Just Giving File Name In Pair Of Double-Quotes, Then Such File MUST BE KEPT IN WORKING DIRECTORY AND NOT IN "DEBUG" ( OR "RELEASE" ) DIRECTORY. b) Open "My Computer" Or "Explorer", Navigate To Your Project's "Debug" ( Or "Release" ) Directory And Double Click On Your Project's Exe. NOTE : Your Exe Is In "Debug" ( Or "Release" ), You Brought ------ Yourself Here By Navigation And Thus It Is Your So Called "Working Directory".Now If You Write Code To Open A File Without Giving Path And Just Giving File Name In Pair Of Double-Quotes, Then Such File MUST BE KEPT IN WORKING DIRECTORY MEANS IN "DEBUG" ( OR "RELEASE" ) DIRECTORY. c) Go To "Start\Run", Browse To Navigate Your Exe's Path And When Found Press "Ok" Button Of "Run" Dialog Box. NOTE : Usually To Pass Command Line Arguments To A GUI Program, ------ User Goes To "Command Prompt". But "Run" Dialog Is Yet Another Place To Give Command Line Arguments To Program Without Going To "Command Prompt". d) As Usual Start "Command Prompt", Go To The Path Of Project's Exe By One Or More "CD" Commands, Type Exe's Name And Press Enter To Execute It. *** The NOTE Under "b" Is Applicable As It Is To "c" And "d" Ways. ======================================================================= ======================================================================= How To Write First Generic Win32 App. In Visual Studio 2003 ( VC 7 ) : ---------------------------------------------------------------------- *** Many Of Concepts And Logics Explained Above Is Applicable For This Topic As Whenever And Wherever Needed. 01) Start Visual Studio .Net 2003 IDE. 02) Go To "File\New" Menu And Click On "Project" Option. "New Project" Dialog Box Will Appear. 03) From Left Panel "Project Types" Click On The Hive Of "Visual C++ Projects" Which Will Show Suboptions. Out Of Those Options, Select Tab Select "Win32". The Raght Panel Will Show Available Templates". Out Of Them Select "Win32 Project". 04) In The "Name" Edit Box Below, Type Project Name. 05) There Is "Location" Edit Box. Either Type Path Of Desired Location Folder Or Browse To Location Folder By Clicking On Adjacent Browse Button. 06) Click "Ok" To Proceed. 07) Now "Win32 Application Wizard" Appears Displaying "Overview" And "Application Settings" In Left Panel. Out Of Them Click On The "Application Settings" Which Will Show Many Things In Right Panel. From "Application Type", Select "Windows Application" Type. From "Application Options" Check On "Empty project" Check Box. Keep All Other Things As Default And Press "Finish" Button. 08) Uptill Now Title Bar Of VC++ IDE Was Showing "Microsoft Visual C++ [design]" As Its Title. After Above Step, It Will Start Showing Name Of Your Project Too. 09) If Your IDE Shows "Solution Explorer" Window On Right Side Of IDE, Close It To Make More Space. 10) Now Click On "File\Add New Item" Menu Which Shows "Add New Item" Dialog Box Will Appear With Right And Left Panels. 11) From Left Panel Of "Categories", Select "Visual C++" Category And From Corrosponding Right Panel Of "Templates", Select "Text File" As Template. 12) In The "Name" Edit Box Below, Type File Name With ".c" Extension Explicitly. The Logic Of "NOTE" In Step 15 Of Visual Studio 6.0 Section iS Also Applicable Here. 13) There Is "Location" Edit Box. Ensure That The Location Path Is Corrosponding To Your Project's Directory. 14) Click "Open" To Proceed. 15) This Will Show A Text Editor Window With Your File Name On Its Left Top. 16) Start Typing The Win32 Generic Application's Code And Save It. 17, 18 & 19) These Three Step Are Same As Respective Steps In Visual Studio 6.0 Section. IMPORTANT NOTES : In The "return()" Statement Of WinMain(), msg.wParam ----------------- Must Be Typecasted To (int) Type To Avoid Warning. ======================================================================= ======================================================================= How To Write First Generic Win32 App. In Visual Studio 2005 ( VC 8 ) : ---------------------------------------------------------------------- *** Many Of Concepts And Logics Explained In Above Two Sections Is Also Applicable For This Topic Whenever And Wherever Needed. 01) To 09) Steps Are Same To Corrosponding Steps Of Visual Studio 2003. 10) Instead Of "File\Add New Item" Menu Like In Visual Studio 2003, Click "Project\Add New Item". 11) To 16) Steps Are Same To Corrosponding Steps Of Visual Studio 2003. 17) From "Build" Menu, Select "Configuration Manager" And See Whether "Active Solution Platform" Is "Win32". This Time Don't Select The "Debug" Active Solution Configuration. But Select "Release". Because The "Debug" Exe May Report Error For MSVCR80D.DLL File. IMPORTANT NOTES : 1) Important Note In Visual Studio 2003 Section Is ----------------- Applicable Here Too. 2) No Need Of "#define UNICODE" Statement In Source Code As All Strings By Default Considered UNICODE. 3) Along With "Debug" ( Or "Release" ) Directory, There Is Yet One More Project's Name Subdirectory Inside Our Project's Directory. The "Outer" One Is Used To Keep "Solution Files" While The "Inner" Is Used To Keep Project Files, Source Files etc. This Inner Subdirectory Also Contains Its Own "Debug" ( Or "Release" ) Directory. ======================================================================= =======================================================================