
Windows Mobile, which is the fifth, and sixth, differs by far from the most convenient ringtone installation system. By the way, we past Palm Treo 650 to us was even more nightmarish, but it's not about him. Not only are we not allowed to put a melody on a group, so also all ringtones should be in the \ Windows \ Rings folder. Yes, you can change through the registry, but this is ugly, and the problem with groups does not solve.
What to do?At first, I turned my attention to something called
PhotoContactsPro , which even mobile-review.com recommended in some of the articles as a good utility for setting ringtones on groups. But here's a bad luck, this utility provides a whole shell for the phone, which I, for example, don’t need for nothing (and it also costs money). When this shell is turned off, the assignment of melodies to the group, of course, is disabled.
')
Further, suddenly found the utility
ToneManager . The utility is good: small, free, does exactly what you need - hangs melodies in groups in Pocket Outlook. But it works with exactly one folder (\ Windows \ Rings by default) and, unpleasantly, it does not know how to save its settings. And to save the settings for such a program is extremely important, since everything that it does is put down melodies to contacts, I mean new contacts go through the forest until you start it again. The author happily wrote in the release “sorry, we will be saved in the next versions!”, But there is still no next version.
Worn out with the search, I decided that this problem was an excellent reason to touch the Compact Framework and make my own utility.
The author of the article is wdk , but he, due to his karma, cannot publish the material. If you liked the article, then help a good author to correct his karma and start writing useful articles.
It turned out this:
What does it do?In principle, everything is clear from the screenshot. You can choose a melody for a contact, for a group, for all contacts, you can wipe the global Windows ringtone with your melody (in Settings-> Private-> Phone). You can choose melodies from wherever, including from a memory card. Melodies are put on the list, the priority increases to the bottom.
Works in WM5, WM6, tested on QVGA, VGA. WM Smartphone does not want to work because of a couple of controls, there is something to think about. The program also refused to work on the WM2003 emulator.
Actually program:
werder.nm.ru/wToneManager_Installer.CABHow does it work?Pulling contacts turned out to be very easy if you know about the build of
Microsoft.WindowsMobile.PocketOutlook . Create a Pocket Outlook session and, voila, everything you need is there:
OutlookSession session = new OutlookSession();
ContactCollection contacts = session.Contacts.Items;
//
foreach (Contact c in contacts)
{
cbContacts.Items.Add(GetContactString(c));
}
//
foreach (Contact c in contacts)
{
string [] curCats = c.Categories.Split( ',' );
foreach ( string cat in curCats)
if (!cbGroups.Items.Contains(cat) && ! String .IsNullOrEmpty(cat.Trim()))
cbGroups.Items.Add(cat);
}
// , ,
// Pocket Oulook ,
// foreach
for ( int i = 0; i < contacts.Count; i++)
{
Contact c = contacts[i];
c.RingTone = item.Tone;
c.Update();
}
* This source code was highlighted with Source Code Highlighter .
C playing melodies all the more interesting. There are many ways to play a melody (wav, mp3, wma) in WM, and only one of them is good. But first things first. Method one is the standard PlaySound function from
winmm.dll . Needless to say that it can only play wav? Therefore, we look in MSDN and find a great way -
aygshell.dll library! And mp3 is able to play, and the possibility of synchronous / asynchronous playback ... But here's a bad luck, it’s only in WM6, and the owners of devices on WM5 are mass, and I don’t want to offend them. Looking further. On the Internet, there are many tips to use the new
SoundPlayer class from CF3.5. I was ready to move to the third framework for the sake of this magical class, but what a surprise, this class refuses to play mp3, which is very strange.
At this point, trying to play a melody with standard means got tired of it, and the thought appeared to use something third-party. First, the choice fell on the
FMOD library. Impressed by the abundance of opportunities, a small wrapper was quickly written, it seemed to work and it was wonderful. Until, while testing, a melody in the wma format was randomly chosen. For unknown reasons, the WinOD FMOD version decisively refuses to play wma, although the developer claims the possibility.
What remains? He always stood modestly nearby and waited for attention to him. Of course, this is
Windows Media Player !
Connecting it is very simple - click Add Reference in the studio and find the% windir% \ System32 \ wmp.dll file. Do not be afraid of the large size of this file, for our project will be attached to another library, Interop.WMPLib.dll, much smaller.
It was much easier to play a melody in WMPLib than in the same FMOD:
WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer();
// , ,
wmp.settings.setMode( "Loop" , false );
wmp.settings.volume = 100;
//
wmp.URL = (cbTone.SelectedItem as ListItem).Value;
wmp.controls.play();
* This source code was highlighted with Source Code Highlighter .
As you can see, everything is extremely simple! By the way, WMPLib turned out to be a very powerful library, a lot of events, playlists and many, many other things, but this is a topic for a separate article, and not just one.
That's all, thank you for your attention, try, unsubscribe!
