How to Make Your Own Windows Mobile Programs - Guide 1 - Windows Mobile Programming

First i want to say you some basic thinks. I just came with the idea of learning to make windows mobile programs.. I think it is very cool and easy..So i decided to create guides to help you get you started. In these guides i will explain you step by step how to make windows mobile programs.. If you keep reading this article i want to tell you that in some guides i will have some comments/tips at the end of the article and they will be very important so i believe that is good for you to read them.. And just to know our Programming Language will be Visual Basic because it is the best.
Also because i had make a lot of effort to write all these guides for you, in case you have Adblock just Disable at bukisa.com .. By this way you are helping me very much.. I would appreciate it See screenshot :
http://i47.tinypic.com/33xh2yr.jpg
In order to follow all this guides and make your windows mobile programs you must have some specific things:
1. A PC running Microsoft Windows Xp, Vista or 7 because we will work with a program called Visual studio which works only for windows versions
2. Of course you must have a windows mobile phone with windows mobile 6 or 6.5 .
3. Visual Studio 2008 (You can use the Express Edition which is free for most lessons, but note that I am using the Professional edition when following along in the guides so it is better that you have the profesional one edition because things will be different version to version. Note that visual studio 2008 profesional edition is the best version. Visual studio 2010 doesn't have the feature to make windows mobile programms..)
http://i48.tinypic.com/2itotpf.jpg
4. In order to connect you device to the pc you must have active sync if you are using windows xp ( Download Microsoft ActiveSync 4.5 Here  ) or windows mobile device center ( Download Windows Mobile Device Center 6.1 Here ) if you are using windows vista or 7.
http://i46.tinypic.com/bio702.jpg
5. In order to install some applications on your windows mobile you must get install NET Framework 3.5 on your windows mobile.. Download it here
6. A desire to learn.
Comments/Tips
1. If you want to upgrade your windows mobile OS to windows mobile 6 or 6.5 see this article i had made
2. When you install visual studio professional edition in order to make windows mobile programs you must Download this . From this page download the Windows Mobile 6 Professional SDK Refresh.msi  After downloading it install it..
When you finish installing this Download this too  . Download the Windows Mobile 6.5 Professional Developer Tool Kit (USA).msi or whatever language you want.. Install this too and you are ready !
3. In order to synhronize your device to the computer you must go to your mobile at start--> settings --> connections--> usb to pc and there choose the second option Serial synchronisation mode.. And then connect your phone to your pc with the usb cable..
That's it
If you want to continue be sure that you have all that things i said.
In every guide i will give you a link for the next one..


 
Choosing a Programming Language for Windows Mobile Development
There are several approaches which can be taken when developing applications for Windows Mobile devices. In this topic, we'll look at the various options but just to know we will work with Visual basic as it is the best for this case ( So if you want want just go to the guide 3) .It is better for you to be a little familiar with those programming languages so i suggest you better learn the basics with tutorials on youtube or an ebook for programming in the programming language you would like to learn.
Visual C++
http://i50.tinypic.com/15hzjop.jpg
Visual C++ is known as a "native" development language, as it talks directly to the hardware for the Windows Mobile device, with no intervening layers (unlike Visual C#, for example). Programming using C++ can be challenging, as it is not a trivial language to learn. Any errors in a C++ program, for example, accessing memory that has been freed, or forgetting to free memory, can potentially crash the entire device.
The advantages of using Visual C++ are execution speed, application size and flexibility. Applications written in C++ run very quickly and consume minimal resources: fast-action games are good examples of programs that benefit from C++. Furthermore, the ability to access low-level system components means that using C++ is the only way to create a Today or Home screen plug-in.
Visual C++ applications can interact with the Windows Mobile device by calling the Win32 APIs (Application Program Interface functions). These APIs are functions that perform particular actions, such as playing a sound or drawing a button on the screen. There are thousands of these APIs (Windows Mobile supports a subset of the complete "desktop" Windows set of Win32 APIs).
If you have experience developing for Windows using Visual C++, you will not find the transition to Windows Mobile particularly jarring. You should read the sections covering installing and using the tools, and then the topic Making use of Device-Specific Features which will highlight the unique abilities of Windows Mobile devices.
To begin a Visual C++ application, start Visual Studio, and select File, New, Project and select Smart Device under the Visual C++ node.If you are new to both programming and Windows Mobile, it may be a good idea to begin with Visual C#, and then transition to Visual C++.
Visual C# and Visual Basic
Visual C# and Visual Basic .NET are "managed" development languages. Not only are they relatively easy to learn, but they support the .NET Compact Framework - a library of classes that perform a lot of frequently used programming tasks, to greatly simplify application development.
The development tools for C# and Visual Basic .NET include a fully what-you-see-is-what-you-get user interface designer. You can drag and drop buttons and other controls directly onto your application's window (called a "form" in managed programming), and then double-click to access the underlying code. This approach makes creating an application's user interface extremely fast and easy.
If you have experience developing applications for Windows using Visual C#, the transition should be relatively painless. The Compact Framework is a subset of the .NET Framework, so some functionality may require a slight reworking of your code.
To begin a Visual C# or Visual Basic .NET application, start Visual Studio, and select File, New, Project and select Smart Device under the relevant language node.
Client-side JScript
The web browser included with Windows Mobile devices - Internet Explorer Mobile - supports JScript. JScript is a superset of the language most commonly known as JavaScript. JScript programs are plain text files that are executed by the web browser. They can be embedded in an HTML page, or stored in separate files.
A JScript application is executed inside the web browser, and uses the web browser's window for input and output. It is possible to make use of AJAX programming techniques to provide a degree of user interaction, and to communicate with a remote server. Due to the nature of JScript, applications cannot access local data other than through cookies, which will introduce some limitations.
No developer tools other than a text editor are required to create a JScript application. The program may be stored locally, or accessed from a Web Server.
ASP.NET
While JScript is a client-side solution to writing Internet-style applications, ASP.NET is a server-side solution. With ASP.NET, you can write applications in C# or Visual Basic .NET that reside on a Web Server, and perform complex processing, including creating user interface controls, and accessing databases. ASP.NET isolates the device characteristics from the application, making it straightforward to run one application on many difference device-types.

Create and Run a Simple Windows Application In Managed Code  
In this walkthrough you will create, build and run a simple Hello World application in Visual Basic. What we are trying to do is just to make an aplication which will say a message Hello World and then you can just Quit this application. ( Note that this is a very simple program but if you want to learn visual basic you must start form the easy one first.) . In order to do this you need all the things i said at the Guide 1. Here is a screenshot on what we will try to do now..
http://i48.tinypic.com/2e0pgme.jpg
How to Create a Windows Application project
Step 1: Open Visual studio 2008 and on the File menu, point to New, and then select Project.
http://i49.tinypic.com/2crxbh1.jpg
Step 2:  In the Project Types pane go to Other languages--> Visual basic. Then click on the Smart Device branch. In the Name box, name the project something unique to indicate the application's purpose. In the Location box, enter the directory in which you want to save your project, or click the Browse button to navigate to it. Then select Smart Device Project. Hit ok.
 http://i49.tinypic.com/34yqi45.jpg
Step 3: Select Windows Mobile 6 Professional SDK project type. And be sure you have selected .NET Compact Framework Version 3.5. In the Templates pane, choose Device Application and then hit ok.
 http://i49.tinypic.com/160pvu0.jpg
The Windows Forms Designer opens, showing Form1 of the project you created.
How to build the application
Step 1: In the Windows Forms Designer, click on the MainMenu1 control in order to start editing the menu. Click in the menu area on the form where it says "Type Here" and type "Quit" and press Enter. You may need to scroll the form down in order to view the menu area.
Step 2: Double-click on the word "Quit" to go to the event handler for the menu option.  
http://i46.tinypic.com/15s2b8i.jpg
Step 3: Add the following code to handle the event:        
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click        
Application.Exit()      
End Sub  
Right now it should be like this :  
http://i47.tinypic.com/29os80n.jpg
Step 4: Add the following code to the Form1 class to display "Hello World":        
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint          
' Create string to draw.        
Dim drawString As [String] = "Hello World"         
' Create font and brush.        
Dim drawFont As New Font("Arial", 10, FontStyle.Regular)        
Dim drawBrush As New SolidBrush(Color.Black)          
' Create point for upper-left corner of drawing.        
Dim x As Single = 10.0F        
Dim y As Single = 10.0F          
' Draw string to screen.        
e.Graphics.DrawString(drawString, drawFont, drawBrush, x, y)        
End Sub    
And now it should be like this :
http://i49.tinypic.com/17r5oz.jpg
Now we have the source code we want. And our application is basically ready.
Comments/Tips
1. At step 4 on how to build the application you can see this:  ' . When a line starts with an apostrophe that means that this is a comment . If you want you can just delete this green letters.   
2. If you would like to change the name of the application ( so not to be Form 1 but whatever you want ) at the tab that you see that virtual mobile click anywhere on the virtual mobile and at the right down properties change the one that says Text: Form1 to Text: Whatever your name want to be.. See screenshot here ( it is a big image so i give you a link )
3. You can see if you have an error ( something wrong in your source code ) if you click Error list. If you have an error double click it and It will show you where is the error. Try to to fix it.
http://i49.tinypic.com/1535eus.jpg
The next guide explains how to make this code an application.


Read more: http://www.bukisa.com/articles/303821_how-to-make-your-own-windows-mobile-programms-guide-3#ixzz0yhyUFMGx
 
 
 
How to test your application
In this guide we will see how to see the programm that we made at Guide 3on an emulator or directly to our device without installing something ( like a portable ).
Step 1: From the Solution Configurations dropdown, located in the toolbar, select Debug or just press f5.
Step 2: From the Target Device dropdown, located in the toolbar, select Windows Mobile 6 Classic Emulator ( By this we will run an emulator with windows mobile 6. If you want to run your aplication at an emulator with windows mobile 6.5 select Windows Mobile 6.5 Professional Portrait QVGA emulator ) . Also if you want to test it directly to your device select the option Windows Mobile 6 Proffesional Device ( the device must be connected to the Pc with a usb cable and be synchronized )
http://i49.tinypic.com/jj9u9c.jpg
Step 3: The executable and any other needed files will be transferred to the emulator/device. It may take a minute or so to transfer the files. And then you will see your Hello world application.  Here is the result:
http://i48.tinypic.com/2e0pgme.jpg
To stop debugging, you can exit your application or select Stop Debugging(Shift+F5) from the Debug menu. When you close the emulator, you are given the option to save the emulator state. By saving the state, you can decrease the emulator start up time the next time you launch the emulator.  
Comments/Tips
1.  In case you want to say something different from Hello world like:
Hello World
My name is Leon
I am a user on Bukisa.com
You would see a problem.. This problem
http://i48.tinypic.com/2jg1h5k.jpg
What you want to say doesn't go the next line. But we will fix this.
In order to add a new line you must write this + vbNewLine. At what is following will be shown to this line. See screenshot and you will understand.
http://i45.tinypic.com/23lnz90.jpg
And the result will be this :
http://i48.tinypic.com/vifv5s.jpg
If you want to add 2 lines just write + vbNewLine + vbNewLine
I don't believe that this was difficult. Now on the next guide we will see how to make this application a cab file in order to install it to our device.
 
How to create a cab file in order to install it to your device Part 1 of 3
Step 1: Right click on Solution 'HelloWorld' ( 1 project ). Click add--> New project
http://i50.tinypic.com/2rfai49.jpg
Step 2: Scrol down, expand other Project Types and go to Setup an Deployment. Change the name ( yours choise) . Select Smart Device Cab project and hit ok.
http://i45.tinypic.com/2r3knli.jpg
Step 3: This is what will you see...   Click on the Hello. Change the Manufacturer to what you like and also the ProductName to what you like.
http://i50.tinypic.com/sy195f.jpg
Step 4: If you would like to add an icon to your cab file you can do this if you go again to the virtual phone scroll down to the right down properties. You will see an Icon to choose so browse for your icon. See screenshot
Some good sites that have icons is Icon archive and Icons pedia
Step 5: Double click at My Project andat the Icon,  browze for your icon again.
http://i46.tinypic.com/24v2uzc.jpg
http://i50.tinypic.com/fy1jj9.jpg
http://i46.tinypic.com/ic24xs.jpg
Step 6: Press the Assembly Information and there you can add whataver you want.. They are not so important.. Then press ok
http://i46.tinypic.com/2vdpg08.jpg
http://i50.tinypic.com/atuh3b.jpg
You just did the 1/3 parts in order to make the cab file. The second part is on the next guide. 

How to create a cab file in order to install it to your device Part 2 of 3
Step 7: Right click on the Hello and click add--> Project output . Be sure to have all things that is in the screenshot selected. And click ok.  
Step 8: You will see this
http://i50.tinypic.com/35iafmf.jpg
Right click on the Detected Dependencies and click Refresh Dependencies
http://i46.tinypic.com/t7jzg8.jpg
Step 9: Right click on file system on Target Machine --> Add Special Folder --> Programs Folder.  
http://i48.tinypic.com/2uomous.jpg
Step 10: Then right click on the white space and select create New shortcut
http://i50.tinypic.com/10qjszk.jpg
Step 11: Select the File System on Target Machine and then the application folder. Select the primary output from Helloworld ( active) ant hit ok.
http://i46.tinypic.com/jsdfsn.jpg
http://i46.tinypic.com/a31mow.jpg
Step 12: You will notice that a shortcut has been created . Rename it in what you want
http://i49.tinypic.com/nlwhlz.jpg
Step 13: Select the file system on target machine.   Select the Hello ant then click the registry button.
http://i45.tinypic.com/2q1b250.jpg
http://i46.tinypic.com/25z73id.jpg
Step 14: You will notice that
http://i46.tinypic.com/14l7m80.jpg
Right click on HKEY_LOCAL_MACHINE and select New key. Rename it to Software. Right click on Software and click new key. Rename it to your product name . Right click on the product name and select new key. Rename it to your desired name of the application.  
http://i47.tinypic.com/j0cllu.jpg
http://i50.tinypic.com/6pyly1.jpg
Step 15: Right click as shown on the screenshot ant click new--> String Value
http://i46.tinypic.com/34r8tno.jpg
Step 16: Rename it at Version and then on the value change it to value 1.0
http://i45.tinypic.com/2cemct1.jpg
You just did the 2/3 parts in order to make the cab file. The third part is on the next guide.


Read more: http://www.bukisa.com/articles/304293_how-to-make-your-own-windows-mobile-programs-guide-6#ixzz0yhz3Dmnx
 
How to create a cab file in order to install it to your device Part 3 of 3
Basically we have done.. Our cab is ready.. All that we have to do right now is just right click on Hello and press Build
http://i45.tinypic.com/24qps0y.jpg
You will see the message Built succesful.. Then go to Documents\Visual Studio 2008\Projects\Hello\SmartDeviceCab1\Debug. The cab file is what we wanted. ( Note the directory maybe different if you have selected other names.. And there are 3 files. The cab is what we want. So if you want you can install it to your deveice and test it.  
Comments/Tips
1. This cab file you can rename it as you wish. 
2. If you want to test this cab at an emulator. Press debug and select your desired emulator.. When the emulator is open press file and configure as shown at the screenshot.
http://i45.tinypic.com/5n2p1t.jpg
Select the folder that you have the cab file. And press ok.
http://i45.tinypic.com/e17sle.jpg
Then if you go to your emulator at the storage card you will see the cab file ( if you understand,  the folder that you will configure will be then shown at the storage card . For example if i configure a folder with songs and then go to the emulator, the storage card will be full of songs).
http://i46.tinypic.com/hu2gzq.jpg
Install if you want your application and you can see that it is ok..
http://i49.tinypic.com/2604q5v.jpg
http://i48.tinypic.com/2e0pgme.jpg
(The screenshot is not the right one but i just wanted to show you that the application works )
You can also run it from the programm files.
http://i50.tinypic.com/1zydjyx.jpg


Read more: http://www.bukisa.com/articles/304423_how-to-make-your-own-windows-mobile-programs-guide-7#ixzz0yhzMOVuT
 
Learn to make your own windows mobile programs !!!
Developing applications for Windows Mobile Devices seems very easy at a first glance. Your first ‘Hello, World’ application will probably take less than five minutes to create, deploy and run on a Windows Mobile Device. However, developing a real world application that can target many different devices, is secure, runs fast and is battery friendly is something else. Even though Windows Mobile Devices are small devices with limited resources, especially compared to modern desktop computers, they are still extremely powerful. To create real powerful applications for these types of devices is probably harder then developing desktop applications. You must learn how to deal with device limitations, User Interface restrictions, battery powered operation, occasional connectivity and many, many more things.
In those 7 guides i teached you how to create a simple application and make it a cab file.. I understanded that in order to create a real world application is not such simple. You must really know C# and visual basic in order to make them..  And also that you can't find a guide on the net step by step on how to create a real world application. So i will not provide you with other guides..
I wil just give you some useful links in order to continue your own if you want  :
http://techtips.timlaytonllc.com/  --> You will find many things about windows mobile development
http://www.dotnetfordevices.com/articles/50.html --> Here you will find some good videos
http://msdn.microsoft.com/en-us/library/bb158725.aspx --> Programming Techniques for Windows Mobile
Basically this was my sources.. If you really want to learn programming languages i believe that the better way is to buy books.

article source:http://www.bukisa.com/articles/305176_how-to-make-your-own-windows-mobile-programs