I build MapiRule sample in Visual Studio 2005 for Windows Mobile
6 Professional Emulator. After the cab file was installed in the
WM6 Emulator, SMS messages were sent from Cellular Emulator with
"zzz" in the message. NO response from the MapiRule.dll has been
observed so far after many tries. Instead All SMS messages have
been received by the default SMS inbox. Does anybody have similar

Further trace shows that DllGetClassObject() has NEVER been called.



Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator

Zero Dai - MSFT

Hi Peter,

It is most likely that you didn't install the right certificate to test the sample code.

After installing SDKSamplePrivDeveloper certificate shipped with the SDK, your problem can be solved.


Zero Dai - MSFT

Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator


I try to run the mapirule sample code from SDK 6 in the WM6 Emulator, but it doesn't seem to work.

Steps I did:

1) Signed it with SamplePrivDeveloper.pfx

2) Build solution

3) Deploy solution

When I send a sms with "zzz" from the Cellular Emulator, it is still the same pop-up box. Is there anything I miss out Thanks.

Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator


Hi peter321, I am facing a similar problem as u. I did the below:

1. Build using VS2005 -> was Ok

2. Deploy says Deploy succeeded, but then i get msg saying

Program to Debug

A non-executable project cannot be started directly. Please set a command to use to start debugging this project. Do u wish to continue

2a. If i click Yes, then i get the error mssg "Unable to start program %CSIDL_PROGRAM_FILES%\MapiRule\MapiRule.dll "

2b. If i click No. then everything stopss

3. I also tried copying the MapiRule.dll from the Debug folder to the Mobile as well as the PC's Windows folder. But nothing worked.

4. I tried manually adding the Registry changes also, nothing worked.

The code also does not seem to do anything to the registry.

5. I also did the certificate signing part.

Please advice,,,

Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator


ok.. I cracked one thing... The Deploy is also working fine now ..

The Problem was the path of the "Remote Executable" which must be set through Project->Properties to "\Windows\tmail.exe" since tmail.exe is the application related to SMS.

Now my problem is common to most .. Its Still not Detecting mssgs with zzz string Smile .. nor is it creating any Registry Keys...

Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator


ok people .. Smile .. Its ALLL finally working for me

Just follow the Below & see if it works .. & btw .. i am using VS2005 Mapirule code.

1. Refer this link to include the relevant certificate & getting it signed Instead of the TestCert_Privileged.pfx. that they have imported here .. use SDKSamplePrivDeveloper.pfx from the tools folder

2. The above link also mentions the path to be set for the Remote Executable.

3. Simply follow the below setps here on ..

1.Compile the Mapirule Dll using VS2005

2.Copy the Dll to the Windows Directory(directory of PC for testing on Emulator).

3. Create the two registry entries.Since this is a COM Dll

1.) Standard COM registration - HKEY_CLASSES_ROOT\CLSID\<clsid>

a. create a registry entry(KEY) of the <CSLID> under CLSID

b. create a regisry entyr(KEY) InProcServer32 under the <clsid>

c. Write mapirule.dll in the data field for the Default value

2.) MAPI Inbox - HKEY_LOCAL_MACHINE\Software\Microsoft\Inbox\Svc\SMS\Rules\<clsid>

a. Add a DWORD value with Name as <clsid> and value as 1

IMP:: here <clsid> is the value {3A ...} which can be taken from the Mapirule code itself.

4.Check whether the CLSID in the dll and in the registry are same

5.Restart the device once.

6.Send a sms as with zzz .. it will definitely trap

Even on device, simply paste the Mapirule.dll into the device's Windows folder, & manually change the device's registry as above & it will surely work!

Gud Luck.

Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator


I made the MapiRule sample working on WM6 Emulator a while ago, but forgot to follow up to post an update. The main cause of my initial failure was not signing the dll with the SDKSamplePrivDeveloper certificate. The registry can be updated automatically by running regsvrce.exe on the MapiRule.dll though. The dll has to be copied into the window directory as well.

Thanks for all the responses.

Re: Device Emulator General MapiRule sample doesn't work in WM6 Emulator


Hi Peter,

Thought you cud help in my problem of writing a code like Mapirule for making Calendar Rules.

In other words, I am trying to write rules for "poutlook calender.exe" on the same lines as MapiRule, so that whenever the calendar application on my PPC is launched, I am able to detect that & do the necessary.

So like how MapiRule implemented the IMailRuleClient which is derived from IUnknown class, i used the IItem interface for detecting calendar application. In fact my code is ditto of MapiRule with only changes in Interface names, CLSIDs & IID_XXX names.

Do you think thats the right way to go for writing rules for any appliction in general

In my calendar code i have used new CLSID (like the CLSID used in MapiRule) as well as tried using published CLSID of IItem, but somehow it does not seem to be working like MapiRule.

My Doubts are:

1. What is the registry path for registring Calendar Rules

2. Which interface must i use IItem IAppointment or any other class

3. How to get the CLSID of the corresponding class

4. My code does not seem to go beyond DLLMain , it is not reaching DLLGetClassObject like MapiRule.

5. Which is the function called when calendar application is launched (Like the ProcessMessage in MapiRule)

Please help.. really appreciate it..