42Gears Speaks
5Apr/102

Writing “Hello World” program for Windows Phone 7

Windows Phone 7 (WP7) is a cool new mobile platform from Microsoft. Developers can use Silverlight, XNA Framework and of course .NET compact framework for developing applications for WP7.

What do you need

To get started, download and install the following tools on your Windows 7 or Vista PC.

http://www.microsoft.com/downloads/details.aspx?FamilyId=2338b5d1-79d8-46af-b828-380b0f854203&displaylang=en

Installation includes Visual Studio 2010, Expression Blend, Windows Phone Emulator, XNA Game studio along with all the documentation required for writing your next great app.

Note that if Visual Studio 2010 Professional or above is already installed on the PC then only an Add-in for Windows Phone development is installed rather than complete installation of Visual Studio 2010 Express Edition.

To familiarize with the development environment its better to first develop a simple Silverlight application.

Create Hello World Project in SilverLight

1. Launch Visual Studio and Select File -> New Project command.
2. Select SilverLight for Windows Phone as template and Windows Phone Application as project type.
3. Specify HelloWorld as project name and Click OK button.
4. Wizard will create all the necessary files as the foundation for our HelloWorld application.

What Wizard generates

Most important files are generated by the wizard are:
1. MainPage.xaml : Default page with some UI element.
2. App.xaml : This file is used to declare shared application resources like colors, brushes, fonts and various style objects. The code-behind file app.xaml.cs is used to handle global application level events like Application_Startup, Application_Exit and Application_UnhandledException.

Building the Project
Since this is the first application built with the newly installed dev environment, its good to build the default project to rule out any installation problems. Right-click on the Solution in the Solution Explorer and Select Build command.

The build is successful if you will see the following message in the output window.

"========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped =========="

All is good at this stage. Go to Windows Explorer and browse to .\HelloWorld\HelloWorld\Bin\Debug folder and you will find HelloWorld.xap which is your actual compiled and compressed Silverlight application.

Lets enhance the program by adding "Hello World" functionality :) .

Adding Hello World Stuff

1. Select "My Application" text block in the design view or in XAML view and change it to say, "42Gears".
2. Select "page title" text block and change it to "Hello World".

Build the project and a new HelloWorld.xap file will be generated.

Running Hello World Program

Now you are ready to launch the application. Press F5 to start debugging or Ctrl-F5 to Start without debugging. Windows Phone 7 emulator will be launched and HelloWorld.xap will be deployed and your first application will start running on the emulator.

For the first time it will take sometime for the emulator to start. Once its running, you can hit F5 or Ctrl-F5 to quickly deploy and run your application.

Well.. thats all for the HelloWorld application for Windows Phone 7. Future posts will involve more advanced topics. Stay tuned!

Go to Home


2Jan/100

Manage your Mobile Software IT Assets with SureSAM

42Gears is developing a Software Asset Management (SAM) tool to help companies manage, allocate and audit software applications installed on their Windows Mobile handheld devices. More information about SureSAM is available here.

Go to Home


24Dec/090

Locking down WM 6.5 devices with SureLock

Latest WM 6.5 user interface is remarkably different than the earlier versions. Especially the location of Start menu button and the Start menu (Honeycomb look) itself. Latest version of SureLock Studio handles these differences nicely. SureLock now fully supports WM 6.5 devices. Check out the latest release.

Go to Home


26Nov/090

Feature Checklist of Mobile Device Management tools

Mobile Device Management (MDM) refers to the approaches or solutions used by companies to remotely manage their mobile devices (PDAs, Smartphones, Laptops, Netbooks). Variety of devices involved pose a big challenge for anyone who intends to implement a Mobile Device Management Solution. In fact, a single solution may never fully satisfy the all the requirements. Hybrid solutions (multiple solutions from different vendors doing complimentary tasks) is a common approach that is used to solve this problem.

Here is a checklist of features that a typical Mobile Device Management solution should have:

* Remotely initiated Software Installation
* Remotely initiated Software Un-installation
* Device Inventory tracking (Including Firmware versions and information about various hardware components)
* Software Inventory tracking (Including OS versions and versions of installed third-party applications)
* Backup and Restore of critical business data
* Control user access to certain approved applications and features only
* Physical Device Tracking with GPS (View the device location on a map)
* Remote locking in case of attempts for unauthorized access
* Remote Wipe in case of attempts for unauthorized access
* Remote Control for administrative purposes (Remotely view device screen and perform user actions like mouse clicks or stylus taps).
* Device Health Check (Alerts and manual detection of issues)
* Gather Device Data for Audit purposes (e.g. Call Log Information, Information regarding SMS and Network usage etc.)
* Capability to send Alerts and Messages to mobile users
* Generate Reports

All of the above features can be further classified into various sub-features. That makes it really hard for any one solution to solve the Mobile Device Management problem. 42Gears is also attempting to solve this problem by developing multiple tools such as SureLock Studio, AirLink and WipeMyDevice.

42Gears develops mobile device management tools for enterprises. Read more information about our products here.

Go to Home


24Nov/092

Can Microsoft get back its Mojo with Windows Mobile 7?

There have been speculations as to whether Microsoft will remain an important player in the mobile phone market with their Windows Mobile operating system. Numerous news articles and blog posts have “declared” the imminent death of Windows Mobile. This article lists a few reasons why these speculations might not eventually turn out to be true.

It is generally agreed that Windows Mobile has problems. We can compare it to Windows Vista which was not accepted very well by the market. Microsoft came back with Windows 7 which has turned out to be successful even after Vista’s debacle. They have learned from the problems and fixed them in Windows 7. Though the desktop and mobile platforms belong to different worlds, we must recognize the approach Microsoft took. The point is; Microsoft can certainly fix what is currently broken in Windows Mobile.

Microsoft rules desktop OS market with over 90% market share and it will make sense if Microsoft uses it to their advantage in mobile space as well.

Windows Mobile also rules the rugged handheld device market. Companies have tried various alternatives, including free “Linux” and failed. They went back to using Windows Mobile based devices for their day-to-day business activities related to mobility. For anything more than email access, companies still prefer Windows Mobile.

Windows Mobile is built on a solid platform. People have been cribbing about its “bad” and outdated “look and feel”. But this “look and feel” was a well-thought-of decision when Windows Mobile or Pocket PC (as it was called earlier) was designed. Microsoft did not want anyone to put any effort in learning how to use their new operating system. Infact, almost no learning was required if you already knew how to use Windows on the PC. They added a Start button on Windows Mobile taskbar!

WM 7 screenshots are available on the internet like here. Not sure if they are true, but if they are real, then surely MS is up to something great. The release has been delayed and MS had to release a stop-gap WM 6.5 version which has received fairly good reviews. WM 6.5 might hold-off the attack till WM 7 starts the counter attack.

iPhone and new devices running Android have tasted initial success by having a nice “look and feel” and jazziness. Their next challenge would be to get better integrated with the desktop environment, where Windows has complete domination. You think its going to be easy! Nope. That is where they will struggle. Microsoft has already solved that problem; the only thing they have to do is to “modernize” the look and feel of their operating system (WM) and they will be good.

It remains to be seen if Microsoft will really get their Mojo back with the release of WM 7. Until then let’s see what the industry analysts write about Microsoft’s departure from the mobile arena.

42Gears develops mobile device management tools for enterprises. Read more information about our products here.


9Nov/090

Introducing AirLink Manager – A Mobile Device Management Tool

Companies are increasingly using mobile devices for variety of purposes such as for providing email access to employees or for running business applications. One of the biggest challenges faced by IT departments is to manage these devices when they are out in the field in the hands of the users. It's just too costly (in terms of time and money) to physically bring the devices to the IT people for maintenance or troubleshooting.

Solution to the above problem is to use a Remote Mobile Device Management (RMDM) tool like AirLink Manager. AirLink currently supports only Windows Mobile devices. It consists of two components: AirAgent which runs on the mobile devices and is responsible for performing jobs sent by the AirLink Manager, a desktop tool operated by the IT Admin.

AirLink Features:

* Remote Software Distribution (CAB Installation)
* Remote Program Execution
* File Transfer
* Device Health Check (Memory, Battery etc.)
* Messaging (Directly push messages to end-users)
* Remote Reset
* Device tracking with GPS (Upcoming...)
* Remote Wipe (Upcoming...)
* Remote Control (Upcoming...)

We have planned a lot more features in the future releases of AirLink. Check out the preview release.

Go to Home


11Oct/090

Simulating key presses in your program with keybd_event function

Out of need or curiosity you might want to know how to send key presses from your native application. The core of the solution involves calling keybd_event() function which has the following prototype.

VOID keybd_event(BYTE bVk, BYTE bScan, DWORD dwFlags, DWORD dwExtraInfo);

bVk is the virtual-key code of the character. bScan is the hardware scan code. dwFlags is an important field. If KEYEVENTF_KEYUP is specified in dwFlags field, the key is being released. If not specified, the key is being pressed.

Here is a function which simulates pressing of alphanumeric characters. See winuser.h for all available virtual key codes.

void SendStringKeys(char* pszChars)
{
while (*pszChars != NULL)
{
if ( (*pszChars >= 'A') && (*pszChars <= 'Z') )
keybd_event(VK_SHIFT, 0, KEYEVENTF_SILENT, 0);

keybd_event(toupper(*pszChars), 0, KEYEVENTF_SILENT, 0);
keybd_event(toupper(*pszChars), 0, KEYEVENTF_KEYUP|KEYEVENTF_SILENT, 0);

if ( (*pszChars >= 'A') && (*pszChars <= 'Z') )
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP|KEYEVENTF_SILENT, 0);

pszChars++;
}
}

And here is an example of how to call SendStringKeys function.

int _tmain(int argc, _TCHAR* argv[])
{
SendStringKeys("Hello World.");
return 0;
}

Go to Home


3Oct/090

[Article Posted] Businesses! Are your mobile devices working for you?

Read the full article here.

Go to Home


26Sep/090

Debugging CeRAPIInvoke Calls

RAPI (Remote API) dlls are loaded by rapiclnt.exe on the Windows Mobile device when CeRapiInvoke API is called by the desktop application. CeRapiInvoke is a general-purpose API to remotely execute a function on a Windows Mobile device that is connected to the desktop over ActiveSync.

To debug your RAPI dll, do the following.

1. Launch Visual Studio and Open the RAPI dll project (.sln, .vcproj) in debug mode.

2. Go to Debug Menu and click on Attach to process menu item.

3. On the transport screen (see below), change the transport selection to Smart Device.
rapiclnt.exe running on the device

Attach to rapiclnt.exe on the device

Attach to rapiclnt.exe on the device

4. On the above screen, select rapiclnt.exe and click on Attach button. This step makes rapiclnt.exe and all modules loaded by it debuggable as long as debugging information is available to the debugger.

5. Now locate the function that you want to debug in source files and insert the breakpoint (or use DebugBreak function) at an appropriate location. You will see the inactive breakpoint icon. It means this module is not currently loaded. Thats okay as we know we have not yet called the function from the desktop application. When the function is eventually called, it will result in loading of the RAPI dll by rapiclnt.exe.

6. Now start the desktop side application. As CeRapiInvoke API is called, breakpoints will become active and you will see the control breaking at the first breakpoint.

From here onwards you can just debug the dll as you would debug normal applications.

Note: If you want debug both desktop application and RAPI dll, you should open the two projects in separate instances of Visual Studio IDE.

Go to Home


26Sep/090

Create full screen application in .Net CF

Applications can use the screen real estate to their benefit by running in full screen mode. If you are developing your application in .NET CF, there are 2 ways to make it full screen.

In Code
Put the following code into your form's Load() method like below.

private void Form1_Load(object sender, EventArgs e)
{
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}

In Designer View
Set FormBorderStyle to None and WindowState property to Maximized.

FullScreen in SureLock Studio
SureLock Studio has an option to set an "approved" application to run in full screen mode. This does not mean that SureLock will launch it in fullscreen mode, instead this option instructs SureLock to not interfere with application making itself fullscreen. A well-behaved fullscreen application should provide a way for the user to minimize or exit.

If your application is full screen and you don't specify this in SureLock Studio then you will see the windows taskbar popping at the top. This is an undesired behavior and can be easily avoided by setting "This is a full screen application" option.

Go to Home