Skip to main content

Posts

Showing posts from March, 2009

Get Application Execution path in .NET

Desktop Application System.Windows.Forms.Application.StartupPath Windows Mobile Application C# You should import using System.Reflection by using System.Reflection; Assembly asm = Assembly.GetExecutingAssembly( ); String path = ""; path= System.IO.Path.GetDirectoryName (asm.GetName().CodeBase);

How to Access Internet through Windows Mobile Emulator

To Access the web through your mobile emulater First of all you have to install Microsoft ActiveSync.  Link :  http://www.microsoft.com/windowsmobile/en-us/help/synchronize/activesync-download.mspx  Then close all running Mobile Emulators.  Then run ActiveSync. (you can run it also using taskbar icon)     Then Goto File Menu --> Connection Settings, and change settings as  Then Open Visual Studio, In there goto Tools --> Device Emulator manager and select the pertivular emulator.                 In Device Emulator Go to Action Menu and Select Connect. And cradle. Now you can see Microsft Active Sync status changing to connected.. .. now go to the web using your emulator.

Disable Windows Mobile Clock Access

To restrict windows mobile key access they are main two methods.  You can replace the clock.exe in the window folder by empty application.  You can change some registry values to prevent opening the clock. I will show how we can use C# to do it -----------------------------------------------------------------------------------  using Microsoft.Win32;   // import  Microsoft.Win32 top of the class file  Dissable the clock RegistryKey hklm = Registry.LocalMachine; hklm = hklm.OpenSubKey(@"\Software\Microsoft\Clock\", true); System.Byte[] offValue = new byte[1]; offValue[0] = 0x30; hklm.SetValue("AppState", offValue); Enable the clock  RegistryKey hklm = Registry.LocalMachine;  hklm = hklm.OpenSubKey(@"\Software\Microsoft\Clock\", true); System.Byte[] offValue = new byte[1]; offValue[0] = 0x11; hklm.SetValue("AppState", offValue);

Get and Compare the Control

Some of the time we need to know what kind ok control are we dealing with. This simple example mimics how to know what is our control. As an example say we want to go through the form’s controls and show a message if there were a text box. foreach ( Control n in this .Controls) { String tp =  "System.Windows.Forms.TextBox";     if (n.GetType().ToString() == tp ){           // Do something     } }