Page 1
Page 2
Page 3
Hello MSMQ World
To create your first MSMQ application, start eMbedded
Visual Basic. Select the Windows CE for PocketPC project and click OK. Although
it is not required for developing your application, IntelliSense makes writing
your Visual Basic application much easier. The pop-up reference to a COM object's
functions and the typing completion features makes writing MSMQ applications easier.
To enable this support in your application, select Project -> References from
the eVB menu bar. A list of available objects that can be referenced in your application
is shown. You will need to add the MSMQ component to this list by clicking the
Browse button. Find the file MsmqCOM.tlb file that is located under the
Typelib directory of the downloaded source code.

We'll
start this application by writing some code to send a message. To make things
easy, we'll create just a local queue on our PocketPC and send a message to it.
On the application form, add a text box (Text1) and a button (Command1).

Add
the following code for the Send button's click event:
Private
Sub Send_Click()
Dim qinfo As MSMQQueueInfo
Dim q As MSMQQueue
Dim
m As MSMQMessage
' Create objects
Set qinfo = CreateObject("CE_MSMQ.MSMQQueueInfo")
Set m = CreateObject("CE_MSMQ.MSMQMessage")
' Create and open local
queue for sending
qinfo.PathName = ".\private$\HelloWorld"
qinfo.Create
Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
' Send message
m.Label
= Text1.Text
m.Body = Text1.Text
m.Send q
' Close queue
q.Close
End
Sub
Previous Page
Next Page