Running your first Application:

راندن اولين برنامه

 

Once you installed the SDK you can run your first application. For that do following:

وقتي كه SDK را اينستال كرديد مي توانيد اولين برنامه خود را برانيد, مطالب زير را انجام دهيد :

 

*  Go to Start -> Programs -> Symbian 6.1 SDKs -> Series 60 -> Documentation -> SDK Help:

*  به Start و Programs رفته و با انتخاب راه زير روي SDK كليك كنيد

 

 

 

*  Click on Series 60 -> Series 60 Examples -> Example Applications:

*  روي Example Applications كليك كنيد

 

 

 

 

*  Click on Hello World example and read about this example:

*  روي مثال  Hello World  كليك كنيد و در مورد اين مثال بخوانيد

 

 

 

How to run your application:

 

 

*  Click on Series 60 Examples -> Building and Running the SDK Examples and read how to build you application:

*  روي Build and Running the SDK examples كليك كنيد كه ببينيد چگونه پروژه تان را بسازيد و برنامه تان را برانيد

 

 

 

*  You can find the source code for Hello World application in following directory:

*  كد Hello World را در ديركتوري زير متوانيد پيدا كنيد

 

 

*  If you click on hello world directory you will find following directories:

*  اگر روي  Hello World كليك كنيد ديركتوريهاي زير را خواهيد ديد

 

 

*  Where group has the project files, inc has the include header files, sis the file to create the package to be transferred to a device and src directory contains the cpp files.
 ديركتوري گروه جايي است كه فايل پروژه شما وجود خواهد داشت ִ هدر فايل ها در ديركتوري اينك و سي پي پي فايل ها در سورس قرار خواهند گرفتִ سيس (اس آي اس ) جايي خواهد بود كه پاكژ خواهد بود كه از آن سيس درست خواهد شد و سيس را مي توانيد به دستگاههاي ديگر بفرستيد كه برنامه تان را در آنها اينستال كنيدִ

 

*  You need to go to the group directory to build the project so go to following directory:

*  شما بايد به ديركتوري گروه برويد كه پروژه تان را بسازيد, بنابراين به ديركتوري زير برويد:

 

 

 

 

*  Start a Dos Prompt and go to this directory it means go to C:\Symbian\6.1\Series60\Series60Ex\Helloworld\group where you have the helloworld project:

*  يك داس پرامپت باز كنيد و به ديركتوري زير برويد كه پروژه Hello World در آن مي باشد

 

 

*  Run bldmake bldfiles to create the build files:

*  دستور bldmake bldfiles را برونيد كه فايل هاي مورد احتياج را بسازد

 

*      bldmake bldfiles

 

*  If you get error like what we have below, it means your PATH is not setup correctly

*  اگر مانند صفحه زير Error گرفتيد معني آن اين است كه PATH پت شما درست نيست

 

 

*  To fix this problem change your EPOCROOT variable to \ by going into Start -> Settings -> Control Panel -> System and click on Environment Variables (for Windows 2000):

*  براي درست كردن اين ايراد بايد EPOCROOT خود را عوض كنيد و آنرا مساوي با باك سلش \ بگذاريدִ اين كار را شما بسته به سيستمتان معولا در Control Panel انجام ميدهيدִ

 

 

*  Click on EPOCROOT and change the value to backslash \ :

* روي  EPOCROOT كليك كنيد و آنرا مساوي با باك سلش \ بگذاريد

 

 

*  Now if you open a new Dos Prompt (OBS! New one) and write “bldmake bldfiles” this time it will work:

*  ايندفعه اگر يك داس پرامپت جديد (بايد جديد باشد نه قبلي ) باز كنيد و دستور قبلي را بنويسيد كار خواهد كرد

 

 

 

Now you have got a file called ABLD.BAT, which can be used to create your Visual C++ project or to compile your code:

حالا شما فايلي به نام ABLD.BAT بدست آورده ايد كه از آن ميتوانيد استفاده كنيد براي ساختن پروژه ويژوال سي پلاس پلاس يا كومپايل كردن فايلهايتانִ

 

Compiling the project:

 

*      abld build wins


This will create the Windows (emulator) related files.

با راندن دستور abld build wins شما ميتوانيد فايل هاي سي پلاس پلاس را كومپيل كنيد و برنامه را براي ويندوز WINS و تست كردن در اموليتور بسازيدִ

 

Note: If you want to create only DEBUG version you will write “abld build wins udeb” if you want to create only release version you will write “abld build wins urel”.

For target building it means if you want to create a binary file to flash into a file or create a SIS file you will build for thumb with “abld build thumb”.

 

توجه بفرماييد كه براي هر سيستمي (تست در ويندوز يا فلاش كردن روي تلفن ) دو ورژن ميتوانيد بسازيد يكي  DEBUG است كه با نوشتن دستور abld build wins udeb آنرا ميسازيدִ ديگري RELEASE است كه آنرا با دستور abld build wins urel مينويسيدִ دباگ هنگام تست استفاده ميشود كه ميتوانيد خط به خط كد را دنبال كنيدִ رليز زماني است كه كد آماده است و آماده فرستادن به تلفن و به بازار استִ اين دو دستور قبلي را شما زماني ميرانيد كه ميخواهيد كدتان را در كامپيوتر و روي ويندوز امتحان كنيدִ وقتي كدتان آماده فرستادن روي تلفن TARGET شد كه از طريق SIS يا اينكه فلش كردن (مانند سوزاندن برنامه به روي CD يا DVD است كه بجاي آن شما برنامه را روي تلفن ميفرستيد) ִ در اين صورت شما دستور abld build thumb مينويسيد كه فايل باينري درست ميشود كه شما ميتوانيد به تلفن خود يا دوستان بفرستيدִ

 

If you try this command you will get bellow errors because the epoc32 is not in the root directory:

اگر شما اين دستور را امتحان كنيد ايراد زير را خواهيد ديد كه سيستم فايلهاي مختلف را نميتواند پيدا كند

 

 

 

To make the epoc32 as your root you can do following substitution so that directory X: (for example) points to your Symbian directory under C:

براي اينكه epoc32 را root ديركتوري خود كنيد بايد يك دريو را سابستيتو كنيد با محل اينستال كردن برنامه سيمبيانتان (محل برنامه سيمبيان زير در كامپيوتر من است بسته دارد شما هنگام اينستال كردن چه ديركتوري را انتخاب كرديد)

 

*      subst x:  C:\Symbian\6.1\Series60

 

Note: You can add this command to a BAT file and run it each time your reboot your computer so that you don’t need to type it each time.

شما ميتوانيد اين دستور را در يك فايل BAT بگذاريد و آن را به Startup خود اضافه كنيد كه هر زمان كامپيوتر را روشن ميكنيد اين دستور رانده شودִ

 

Now from now going on you will use X: for creating your project or opening Microsoft Visual C++ project. Don’t use the C: anymore and go always from x:

از اين به بعد از دريو جديد (مثلا x: ) كه درست كرديد هميشه براي كومپيل كردن يا ساختن و باز كردن پروژه مايكروسافت خود استفاده كنيد و ديگر از c: استفاده نكنيد كه ايراد نگيريدִ

 

Now we go to directory X: and to the hello world project to compile all files, make sure to run the bldmake bldfiles too:

حالا به دريو X ميتوانيد برويد و در آنجا دستور هاي زير را انجام دهيد كه فايل هاي مختلف پروژه Hello World را كومپيل كنيدִ يادتان نرود كه bldmake bldfiles را اول برانيد كه ABLD.BAT به صورت درست و در X درست شودִ 

 

*       x:

*       cd Series60Ex

*       cd helloworld

*       cd group

*       bldmake bldfiles

*       abld build wins

 

You will see files getting compiled:

شما خواهيد ديد كه فايل هاي مختلف كومپايل ميشوند

 

 

Now you can start the emulator with following command:

حالا ميتوانيد اموليتور Emulator كه نمونه تلفن است ولي در ويندوز رانده ميشود را با دستور زير راه بياندازيد:

 

*      epoc

 

Once the emulator is started you can find the Hello World icon in the application list:

وقتي كه اموليتور راه افتاد (مدتي طول ميكشد بسته به سرعت كامپيوترتان ) شما ايكن Icon برنامه Hello World را در ليست برنامه ها خواهيد ديد

 

 

Note: If you follow the instruction in “Install SDK Tools” section to map a new drive and to use the right click feature and switching mechanism you won’t need to do steps above, as in those cases you go directly for example to m: or n: and don’t go to C: to get this problem.

 توجه فرماييد كه اگر توضيحاتي كه در قسمت Install SDK Tools داده شده دنبال كرديد كه به شما امكان ساختن پروژه و يا كومپيل را با Right Click كردن ميدهد ديگر احتياج نيست اطلاعات بالا را دنبال كنيدִ چون اون برنامه SWITCH كردن كه آنجا توضيح داده شده اينكار را به صورت اتوماتيك براي شما انجام ميدهدִ

 

If you get problem and it still doesn’t work, you need to debug the issue with your PATH but the best thing is to follow the instruction “Install SDK Tools” section which is easier and will setup your environment automatically, where you can switch from m: to n: and other drives. If you have only one SDK then you can switch to m: and work only on m: or so.

اگر بعد از كارهاي بالا هنوز سيستمتان كار نميكند و نميتوانيد كومپيل كنيد بايد PATH خود را كنترل كنيد تا سيستم را راه بيندازيدִ اگر در پايان نتوانستيد بهترين كار اين است كه توضيحات  Install SDK Tools  دنبال كنيد كه راحت تر است و به صورت اتوماتيك ميتوانيد بين دريو هايي مانند m: و n: سويچ كنيدִ

Creating Visual C++ Project:

 

Now you can create the Microsoft Visual C++ project and open the project and work with the code and change it. For doing that you need first to create the Microsoft workspace. Do following from your mapped drive (don’t do it from C: drive but from X: or m: n: that you created earlier):

حالا اگر بخواهيد كد را عوض كنيد و كمپيل كنيد و دوباره برانيد ميتوانيد پروژه  ميكروسافت ويژوال سي پلاس پلاس را درست كرده باز كنيد و پروژه خود را برانيدִ براي اينكار اول بايد به صورت زير فايل پروژه را بسازيدִ به ديركتوري زير برويد و دستور هاي زير را انجام دهيدִ توجه كنيد كه از C: نرويد بلكه از m: يا n: كه قبلا درست كرديدִ

 

        x:

        cd Series60Ex

        cd helloworld

        cd group

          abld makefile vc6

 

The command “abld makefile vc6” will create the Microsoft Visual C++ project for you.

با انجام دستور abld makefile vc6 پروژه ويژوال ستوديد (ويژوال سي پلاس پلاس ) درست ميشود

 

Start your Visual C++ application.

Go to File -> Open Workspace and choose your mapped drive (X:, m:, n: etc. but not c) and click on Epoc32\Build:

برنامه ويژوال سي پلاس سي پلاس خود را راه بياندازيدִ قسمت File -> Open Workspace را انتخاب كنيد و از طريق ديركتوري X: (يا m: يا n: نه c:) به قسمت epoc32\build برويد

 

 

 

From directory build find your hello world project, which is under Series60Ex, and choose the WINS version:

پروژه Hello World را كه براي ويندوز ساخته شده و زير ديركتوري WINS و زير Series60Ex ميباشد پيدا كنيدִ

 

 

 

Open the workspace, which has been created for you, it means “Helloword.dsw”:

پروژه Helloword.dsw كه ساخته شده است باز كنيد

 

 

If you click on FileView you will see list of all cpp and header files:

اگر روي FileView كليك كنيد ليست تمام سي پي پي فايل ها و هدر فايل ها را مي بينيد

 

 

 

You can build your project as usual with what you use to do in Visual C++ it means with F7 you build the project and with F5 you run the project in debug mode. You can find these options under build menu where F7 says “Build HellowWorld.app” and under Start Debug you can find F5:

حالا شما ميتوانيد پروژه را همانگونه كه عادت داريد در ويژوال ستوديو كار كنيد برانيدִ يعني با F7 شما فايل ها را كومپيل ميكنيد (قبلا شما ديديد چگونه اينكار را در داس پرامپت انجام دهيد)ִ با F5 شما برنامه را در حالت DEBUG ميرونيد كه ميتوانيد خط به خط كد را برانيد و ببينيد هر خط چه اتفاقي مي افتدִ اگر روي Build كليك كنيد امكانات مختلف موجود را ميبينيدִ

 

 

 

 

Press F7 to build the project. You should see zero errors:

دكمه F7 را فشار دهيد كه پروژه را بسازيدִ شما صفر ايراد خواهيد ديد

 

 

 

If you see some errors which says can’t find this or that file, most probably your path is wrong then try to debug the problem with your PATH or use the instruction in “Install SDK Tools” section to map drives m: or n: and open the Visual C++ project from directory m: in stead of x:

اگر ايراد ميگيريد كه اين فايل يا آن فايل پيدا نميشود مشكلي در PATH شما هستִ اگر نتوانستيد مشكل را پيدا كنيد شايد بهتر باشد كه روش Install SDK Tool دنبال كنيد كه ديركتوري m: را بسازيد و از آن استفاده كنيد بجاي X: وقتي كه پروژه را پيدا و باز ميكنيدִ

 

Once the project compiled fine and you got zero errors you can run the Emulator in debug mode so that you can step through the code line by line. For doing that you can for example click on “HelloWorldAppui.cpp” and put a breakpoint on switch(aCommand) (see below) by pressing F9 (breakpoint) when your mouse is on the line of switch statement:

 

وقتي كمپيل كرديد و ديگر ايراد نگرفتيد ميتوانيد برنامه را در حالت Debug برونيدִ براي اينكار بايد روي يك خط (معمولا نقطه شروع برنامه ) يك محل ايست Breakpoint بگذاريدִ اينكار را با فشار دادن دكمه F9 وقتي ماوس شما روي خط دلخواه است انجام ميدهيدִ مانند كد زير كه روي  خط اول SWITCH ما اين محل ايست را ميگذاريمִ اين فانكشون را شما در فايل HelloWorldAppui.cpp پيدا خواهيد كردִ

 

 

 

Now if you press F5 the emulator will start in debug mode and you will see all messages in the output window (open this window from View -> Output).

حالا بعد از گذاشتن نقطه ايست شما ميتوانيد با F5 برنامه و اموليتور را در حالت DEBUG راه بياندازيدִ تمام اطلاعات هنگام راه اندازي اموليتور را در ويندوز آت پوت ويژوال ستوديو خواهيد ديدִ اين ويندوز اگر باز نيست آنرا در قسمت View -> Output راه بياندازيد

 

First time you start the project it will ask you for the place of emulator, you should give the path to the epoc.exe in UDEB version. It means click on Browse button and find the epoc.exe in below directory:

 

اولين دفعه كه برنامه را راه مي اندازيد از شما جاي برنامه epoc.exe را مي پرسدִ بايستي آدرس محل epoc.exe را براي ورژون UDEB بهش بدهيدִ

 

 

\Epoc32\Release\wins\udeb\epoc.exe

 

 

 

Once the emulator is started click on Hello world icon and go to menu and choose one of the options, it will hit your breakpoint above and you can step through the code with F10 (go line by line) or F11 (step into code).

 

بعد از راه افتادن اموليتور (مدتي طول ميكشد بسته به سرعت كامپيوترتان ) ايكون Hello World را در ليست برنامه ها پيدا كنيد و روي آن كليك كنيدִ بعد از باز شدن اين برنامه اگر در قسمت Option دست چپ آن Test يا Exit را انتخاب كنيد برنامه شما شروع شده و در قسمتي كه نقطه ايست Breakpoint گذاشتيد مي ايستدִ حالا ميتوانيد كد را خط به خط برانيد از طريق دكمه F10 براي خط به خط رفتن يا F11 براي وارد شدن داخل هر فانكشينִ

 

Good Luck with your hacking

موفق باشيد با برنامه نويسي خود