MSMQ on Windows Mobile 5.0


Did you know there is a new version of MSMQ for Mobile 5.0? The distribution package is available as an aditional download from here:

http://msdn.microsoft.com/mobility/windowsmobile/downloads/default.aspx

 

And finally its available through CF 2.0 on Windows Mobile 5.0.

 

Installing MSMQ requires the cab file from the redistribution download: msmq.arm.cab. Drop it on the device and run the cab to extract the driver and admin tools.

Next go and change the device name to something unique on the network (Start | Settings -> System Tab -> About ->Devic ID tab). Then go to the \windows directory and run VisAdm.exe. This provides a somewhat graphical front end to the old command line tool msmqadm.exe.

MSMQ is installed after the cab is run, but its not configured. VisAdm takes various string commands to run against the command line app. It looks a bit like this:

 

Click on the Shortcuts button to see a list of pre-populated commands and select:

1> Install   (No output on success)

2> Register (a GUID is displayed, or if its already registered then you get a warning)

 

Now soft reset the device and re-run VisAdm. This time run Verify and Status to check all is working ok.

 

Right we are ready to write some code.

 

My first (and only) app simply uses a local queue to post a message and pull the same message back out of the local queue:

 

...

using System.Messaging;

namespace TestMSMQ

{

public partial class Form1 : Form

{

private void Form1_Load(object sender, EventArgs e)

{

if (!MessageQueue.Exists(@".\private$\MyQueue"))

MessageQueue.Create(@".\private$\MyQueue");

}

 

private void button1_Click(object sender, EventArgs e)

{

MessageQueue myQueue = new MessageQueue(@".\private$\MyQueue");

myQueue.Send(this.textBox1.Text);

myQueue.Close();

}

 

private void button2_Click(object sender, EventArgs e)

{

MessageQueue myQueue = new MessageQueue(@".\private$\MyQueue");

((XmlMessageFormatter)myQueue.Formatter).TargetTypes = new Type[] { typeof(string) };

try

{

Message myMessage = myQueue.Receive(new TimeSpan(0));

textBox2.Text += (string)myMessage.Body + "\r\n";

}

catch (MessageQueueException mqe)

{

MessageBox.Show("No Message");

}

finally

{

myQueue.Close();

}

}

}

}

 

Grab the whole thing from here.

There are a couple of things worth pointing out:

1>    When retrieving a message from the queue the type needs to be handed to the MessageQueue class. Only string is supported at the moment.

2>    It is possible to use off device queues. To do this the queue name needs to be specified as a formal name:  "FormatName:Direct=OS:MyMachine\private$\MyDesktopQueue"

3>    This version of MSMQ was meant to support an HTTP transport. Unfortunately there is a bug that causes HTTP transport to fail. I believe the product team are working on this and hope to have a public fix soon. Watch this space.

 

Next I need to do something meaningful with MSMQ and a couple of devicesโ€ฆ but thatโ€™s for another post.

 

 

Marcus


Comments (39)

  1. MSMQ has been available on Windows CE and Windows Mobile for a while now. It was quite interesting, but…

  2. phil says:

    Where did you get that version of visadm ? It’s not in the cab file. It looks like the old 2003 version. The new version (you have to build it yourself) that comes w/ the Mobile 5 sdk doesn’t look like this one. BTAIM, when I do the install on a Mobile 2005 / hx2495, no registry settings get created ๐Ÿ™

  3. marcpe says:

    The VisADM.exe is definately in the CAB file. Did you check the download from here:http://msdn.microsoft.com/mobility/windowsmobile/downloads/default.aspx

    VisADM.exe is installed into the windows directory on the device.

    There is also a version of this app in the SDK that looks a lot different, but you dont have to use this version. I’m not sure what the differences are beyond the look and feel.

    Marcus

  4. Any issues with running this on a smartphone running mobile 5 apart from the obvious interface changes?

  5. Phil Fuhlman says:

    Marcus, You’re right, the CAB file does include "VISADM.EXE" and executing the CAB file puts the "VISADM.EXE" into the Windows folder which isn’t where I expected it to be compared to previous CE MSMQ ‘installs’ ๐Ÿ˜‰

    Next confusion(1): immediately after executing the CAB file (ActiveSync is running, ‘clean’ iPaq hx2495) and closing it’s ‘success’ window (and I can see the files in the Windows folder), from my Win2k Pro/Sp4 PC I launch VS2005 / Remote Tools / Remote Registry Editor and I do *not* see HKLMSoftwareMicrosoftMSMQ key. I disconnect and restart the device a few times and like majic, the HKLMSoftwareMicrosoftMSMQ key *is* there, but I have not run VISADM.EXE yet. I run VS2005 / Remote Tools / Remote Process Viewer and check both device.exe and services.exe and do not see the MSMQD.DLL listed for either.

    Next confusion(2): Then after running Mark Ihimoyan’s CF2 CE MSMQ, relaunch VS2005 / Remote Tools / Remote Process Viewer and MSMQD.DLL is showing up under DEVICE.EXE, not SERVICES.EXE.

    Again, any info is appreciated!

  6. marcpe says:

    John,

    Not that I’ve seen. I ran the same sample with a slightly modified UI – buttons moved to Menu items etc. and it all worked fine.

    I must admit I tend to stick with PPC when trying stuff out but only becuse its easier to get arround and there is a bit more space for my bad UI’s ๐Ÿ™‚

    Marcus

  7. marcpe says:

    Phil,

    hmmm. I cant see why the reg key would magically get created without some code somewhere getting run. I dont have an hp2495, but I will try a repro on my universal and see I get.

    Marcus

  8. Nino.Mobile says:

    TGIF!  (sort of..  I’ll be working through the weekend yet again..*sigh*).   Oh yeah,…

  9. MartinSlater says:

    Hi, I stumbled across your blog while trying to figure out why I can’t install MSMQ on a WM5 iPAQ 2490 (I’m moving our app from WM2003). Got all the recommended downloads and run VISADM. Install and register ok, soft reboot and back to VISADM. Verify looks ok but shows nothing in Application DataVolatile, status shows ‘Operation failed. Error code c00e000b’. Installing the *same* msmq.ARM.CAB on the VS2005 Emulator works fine. I’m missing something.

    Can you enlighten me?

    Thanks, Martin

    PS exactly the same happens on an XDA Exec.

  10. Hi,

    I have installed as u said in your article. With the latest cab available at MS site. LINK:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=cdfd2bb2-fa13-4062-b8d1-4406ccddb5fd&DisplayLang=en

    After Install and register, I soft-reboot my device (Treo 700W) and then verified as u said. Its shows…

    Computer name "Treo"

    MSMQ daemon intalled.

    NETREG daemon intalled.

    MSMQ configured.

    Default Quota:256

    Port:1801

    Ping Port:3527……

    ……….

    ………………..

    BUT when I click on Status button given in VisAdm, it shows following error "Operation failed. Error Code c00e000b".

    After running my test application it gives error "Message Queue Service is not available."

    Can u suggest what /where I missed out?

    Thanks in your anticipation,

    Rakesh Ranjan,

    Iselin, NJ, USA.

  11. Jason Wang says:

    Hi , you should do like this  ๐Ÿ™‚

    http://blogs.msdn.com/ihimmar/archive/2004/06/14/154911.aspx

    the necessary step in PocketPC:

    IntPtr handle = ActivateDevice(@"DriversBuiltInMSMQD", 0);

    CloseHandle(handle);

  12. max says:

    Hi!

    has anyone ever tried this on the Emulator in VisualStudio 2005? (Installation in Workgroup mode -> only private queues)

    Installing works, local queue send&recieve (on both Em.&PC) too, but to the machine that runs the Emulator and back – no connection available. TCP/IP Works, can ping the Emulator, but not send to remote queue either from Em.>PC nor PC>Em.!

    All diffrent namings tried(to create MessageQueue object)FormatName:DIRECT=OS:MachineNamePrivate$QueueName ,FormatName:DIRECT=TCP:IPAddressPrivate$QueueName,MachineNamePrivate$QueueName).

    on PDA I get "the queue does not exist or you do not have sufficient permissions to perform the operation"

    on PC I can create MessageQueue object with direct:TCP… but all attributes of it show:

    "The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted."

    System.Runtime.InteropServices.ExternalException {System.Messaging.MessageQueueException}

    sending messages succeeds but on PDA nothing arrives.

    Intranet in company, all ports open, no router/firewall.

    What could be wrong??

    Thanks a lot for any help!

    Max, Singapore

  13. Zhamak says:

    Hi Marcus,

    Thanks for the details provided in your blog.

    It’s been very helpful.

    I have downloaded and installed MSMQ from

    the URL you have provided (http://msdn.microsoft.com/mobility/windowsmobile/downloads/default.aspx)

    and managed to install it on Windows mobile 5.0

    Smartphone and run a sample C++ application

    calling the functions defined in

    mq.h successfully.

    I was wondering if you know where I could find

    the header, libs and dlls that define the

    MSMQ COM interfaces (Mqoai.h, Mqoa.lib)?

    Mqoai.h/Mqoa.lib which are referenced in

    MSMQ msdn documentation e.g. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemsmq/html/cerefmsmqmessage.asp.

    Thanks,

    — zhamak

  14. David says:

    Same problem here on running VISADM – error code c00e000b.  Several people here have posted this problem, but no-one has given a fix, unless I’m misreading the thread!!

  15. Warrenla says:

    This has helped a ton…  Took me forever to figure it out, but has it ever helped… Wondering if you have done anything with sending a message from a mobile device to a server running windows 2003 IIS with MSMQ on the server… or if someone knows of a cool link… I am thinking I could use TCP/IP…

    The mobile device will be craddled during the operation for now…

  16. I have the same error code c00e000b on my Dell Axin x51, HP iPaq 2490B, HP iPaq Rx 1950 ( All Windows Mobile 5.0 ). When I try to send a Message to a Windows XP queue and my iPaq is connected to activeSync it sends the message. When I try to send throught Wi-Fi it doesn’t work. I can ping both machines but I can’t send the message. I will check with my new HP iPaq HW 6940

  17. Norzagaray says:

    Like David Say, still we don´t have a fix or workaround to solve the problem of MSMQ on Windows Mobile 5.

    VISADM – error code c00e000b

    I tryed with ActiveDevice even with Mark Ihimoyan´s sample: http://blogs.msdn.com/ihimmar/archive/2004/06/14/154911.aspx

    And the behaivor is the same.

    I’m using a Symbol MC7090 with Windows Mobile 5.0 (OS 5.1.70)

  18. arvindbksc says:

    Hi!

    has anyone ever tried this on the Emulator in VisualStudio 2005? (Installation in Workgroup mode -> only private queues)

    Installing works, local queue send&recieve (on both Em.&PC) too, but to the machine that runs the Emulator and back – no connection available. TCP/IP Works, can ping the Emulator, but not send to remote queue either from Em.>PC nor PC>Em.!

    All diffrent namings tried(to create MessageQueue object)FormatName:DIRECT=OS:MachineNamePrivate$QueueName ,FormatName:DIRECT=TCP:IPAddressPrivate$QueueName,MachineNamePrivate$QueueName).

    on PDA I get "the queue does not exist or you do not have sufficient permissions to perform the operation"

    on PC I can create MessageQueue object with direct:TCP… but all attributes of it show:

    "The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted."

    System.Runtime.InteropServices.ExternalException {System.Messaging.MessageQueueException}

    sending messages succeeds but on PDA nothing arrives.

    Intranet in company, all ports open, no router/firewall.

    What could be wrong??

    Thanks a lot for any help!

    arvind,new delhi

  19. arvindbksc says:

    it setup runs correctly on pocket pc -windows mobile 5.0

    bit in status option shows  MSMQ_CE DISCONNECTED

    because of we are not able to send message to from device to desktop

    plz suggest

  20. Llevo un par de dias urgando en la versión de MSMQ para dispositivos móviles preparando una maravillosa

  21. The ActiveDevice method cannot run in User Mode, exec this code in WindowsStartUp and soft reset.

    Best regards,

    Unai Zorrilla Castro, MVP Compact Framework

  22. Yossi says:

    Norzagaray,

    I had the same problem with an i-Mate K-JAM.

    Creating a console application which did the following solved it immediately:

    int _tmain(int argc, _TCHAR* argv[])

    {

    // Based on http://www.developersdex.com/vb/message.asp?p=2916&r=4819100&page=2

    HANDLE handle = ActivateDevice(L”Drivers\BuiltIn\MSMQD”,0);

    HRESULT hr = GetLastError();

    if (handle!=NULL)

    {

    CloseHandle(handle);

    }

    wchar_t resultString[2000];

    wsprintf(resultString, L”The call to ActivateDevice returned %x.”, hr);

    MessageBoxW(NULL, resultString, L”MSMQ Activation”, MB_ICONINFORMATION);

    return 0;

    }

    On the emulator I got HRESULT=5 for an unsigned exe and HRESULT=924 for a signed exe (which I assume signified that MSMQ is already running).

    On the K-JAM I got HRESULT=0 and MSMQ started working.

    Hope this helps you too.

  23. Yossi says:

    Norzagaray,

    I had the same problem with an i-Mate K-JAM.

    Creating a console application which did the following solved it immediately:

    int _tmain(int argc, _TCHAR* argv[])

    {

    // Based on http://www.developersdex.com/vb/message.asp?p=2916&r=4819100&page=2

    HANDLE handle = ActivateDevice(L"Drivers\BuiltIn\MSMQD",0);

    HRESULT hr = GetLastError();

    if (handle!=NULL)

    {

    CloseHandle(handle);

    }

    wchar_t resultString[2000];

    wsprintf(resultString, L"The call to ActivateDevice returned %x.", hr);

    MessageBoxW(NULL, resultString, L"MSMQ Activation", MB_ICONINFORMATION);

    return 0;

    }

    On the emulator I got HRESULT=5 for an unsigned exe and HRESULT=924 for a signed exe (which I assume signified that MSMQ is already running).

    On the K-JAM I got HRESULT=0 and MSMQ started working.

    Hope this helps you too.

  24. vsciw says:

    Hi.

    Do you know if the problem with MSMQ using HTTP has been resolved in Windows Mobile 5?

    Ian.

  25. vsciw says:

    Hi.

    Has there been a fix supplied yet for using HTTP queues in MSMQ on Windows Mobile 5?

    Ian.

  26. Toner says:

    Hello i have tried to run MSMQ on processor ARM920T PXA27x (device model Unitech PA600) and also on processor Samsung 2442A (device model SPV  M3100) and didnt work. Same error like the others  "c00e000b", no ideas why. I also used a pert of code to make "device activation" but it didnt work either. Is there someone who resolve the problem ?? Or know where the problem is ??, it is depend on processor type ??

  27. Toner says:

    The solution is easy, you need to just get new .Net Compact Framework Redistributable SP1, and all your problems will dissapear. It will fix the problem with MSMQ and also problems with running .NET CF application on some of smartphones. Hope you will enjoy witch new version of .NET CF ๐Ÿ™‚

  28. I need to start investigating this technology as more and more of my customers are starting to introduce

  29. Phil says:

    Can anyone document the units for the ‘MSMQSimpleClientRetrySchedule’ registry setting???

  30. Phil says:

    Marcus, Can you share anything about using MSMQ with Windows CE in a dual homed scenario, ex. a device messaging with a server via both WiFi and GPRS?

  31. Louis says:

    To solve the c00e000b error, you must either install the Development Certificate from VS onto your PDA or sign the individual components of the msmq.arm.cab file with your own certificate (and install that certificate on the PDA).

  32. Anat says:

    Hello,

    I have I-mate Smartphone, with operation system: windows mobile 5.

    Iโ€™m trying for quite to install MSMQ, as following:  

    http://msdn2.microsoft.com/en-us/library/aa450030.aspx

    1. run MSMQ cab

    2. run visadm.exe

    -> run install

    -> run registry

    3. Soft reset

    4. run visadm.exe -> status

    5. get error

    I tried every thing, checked the forums but all say the same process.

    I need help, and it is urgent.

    Any one has any idea?

    Thanks ๐Ÿ™‚

  33. Well, Steve is off to a blazing start this month and I have to admit there is a lot of news and rumors

  34. Well, Steve is off to a blazing start this month and I have to admit there is a lot of news and rumors

  35. RM says:

    I also have no success in getting MSMQ running on WM 6.0. I consistently get error c00e000b. I have tried signing cab, shutting off security to the device via VS2008, upgrading CM to sp2, and everything else I can think of. This was not a problem on PPC2003 but these devices are no longer available. This is a major problem for me. Any suggestions?

Skip to main content