Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Visual Basic

See Related Forum Messages: Follow the Links Below to View Complete Thread

I have a program that is trigger capable and sends a message like the following to the MSMQ, in a single line format:

<?xml version="1.0" encoding="UTF-16"?>
<header type="changedocstatus" timestamp="12/19/2003 12:49:31 AM" server="NEWDEMO"/>
<changedocstatus document="CrankArmAxle.PRT" previous_project="sample" new_project="sample" user="pdmwadmin" previous_value="Design" new_value="Release"/>

My program should:
1. Retrive the msg.
2. output the following:
- Previous Project=Samle
-New Project= Sample

I can get the Msg from the Queue fine but it does not load as an XML document using the MSXML2.0 . I haven't used this before. Any pointers will be appreicated. All I need is a way to extract those three informations.

Help For MSMQ

i need help to use MSMQ into VB language
how can i write in a private queue?
how can i read a queue?
how can i delete a message from a queue?

best regards

is there an MTS in Windows2K?

if yes, how would you start using it? i have tried using an mts on a WinNT server and Win9x workstations, my problem is when i used the same installer (WinNT Option Pack) on my Win2K server, it wont install. (NOT 4 HIGHER VERSION OF WINNT).

My point: i want to start building an application using ASP and COM. I know the details on COM and ASP.

From what I've learned I should use IIS to manage my ASP (is my terminology correct?). I have created DLL, UI, and SP (SQL Server7.0). I was able to run my application on my desktop. Now, how do I implement this on an intranet?


Has anyone used MSMQ from VB yet ? I need to implement Asynchronus communication in a COM architecture.

Any Ideas where to start with MSMQ ?

Im sending a message usung MSMQ. I wish however to send a file in the Queue, is there a way to do this ? (I am currently also passing a recordset in the queue)


MSMQ Example
Can some one give the requirments how to run MSMQ and a sample example for the same.


Hi People,

I'm hav a desperate need to set up message queuing in vb6 and can't find any sample code to work from. The only code I have found is:

Private Sub Command1_Click()

Dim qi As New MSMQQueueInfo
Dim q As MSMQQueue
Dim qObj As New MSMQMessage

qi.PathName = "" 'this machine and que exists


qObj.Label = "Test 1"
qObj.Body = "Hello World!"
End Sub

This just returns an error regarding MSMQ being installed in worgroup mode. Does anybody have any experience with this and could supply something I can work from or even a few decent links? Google didn't save me this time ;)



anyone know how to views public and private MSMQ's with vb?

Com+ And Msmq
This may not be the right place for this question, but I have a com+ object running on several machines. It is called from an asp program using the GetObject via a message queue in MSMQ. This system is straight forward and runs on windows 2000 and one windows xp machine with default settings. I recently had a hard drive crash and when I rebuilt this operation fails on my newly installed xp os. It is giving no system error messages. Just the one i have coded into the asp to alert me to the fact that the object hasn't been created. Does anyone have any idea what could cause this and how to fix it.

Wht Is MSMQ?
Can anybody tell me wht is full form of MSMQ and how it can be used in VB6?.........

Has anybody heard of MSMQ transaction monitors? I want to use the triggers and rules facility of MSMQ. I am able to post new message to the queue, but I am unable to comprehend how to use the trigger and rule options. Can anybody atleast give me a sniff?


How do I maintain transactions through MSMQ? I want to call a exe as soon as my queue receives a message. This is on using MSMQ as a synschronous communication media.


How can I send a message(a xml file) with MSMQ whose message body length is &gt; 4
MB. Can anyone help ASAP.


MSMQ And Triggers
One of the more neglected IPC technologies in Windows is Message Queuing. While in an AD domain you can do some fancy stuff with relay servers and such, it's quite possible to make use of MSMQ queues within a Workgroup LAN or just locally within one machine. Simple private local machine queues are all I need here. With WinXP the MSMQ facility is at version 3.0 and quite robust, though even NT 4.0 supported it, as did Win9x to a more limited extent.

MSMQ is an optional Windows component. If you don't have it in place just use Add/Remove Programs to install it. Prior to WinXP MSMQ Triggers is a separate download. Once these are in place you'll have two additional Services running on your machine. Queues and Triggers can be administered via the Computer Management MMC snap-in under Services and Applications.

MSMQ Basics

Without going into the subject too deeply, a sending program creates and sends messages to a queue. These messages are held in sequence until processed. Queues can be persisted to disk so that messages are even retained in those queues across a reboot. Receivers process messages from the queues and optionally return results back to the sender via reply queues. Each message can designate its individual reply queue, and this lets one receiver (or queue service application) handle messages inserted into its queue by multiple senders (or requestors).

Since a message has several properties that can be used for identification (Label: a 0 to 250 Unicode character String, CorrelationID: a 20 byte Byte Array, and AppSpecific: a Long) it is even possible to have a single queue that is serviced by multiple readers. Each reader "walks through" the queue peeking messages looking for ones that it handles.

Receivers can process queues synchronously or asynchronously, and the MSMQ COM objects make this easy in VB programs.

Messages also have a Body property that contains the primary payload. The Body value is a Variant when using the MSMQ COM objects, and you can put in a String, Integer, Long, etc. or even an Object (any persistent COM object that supports IDispatch and IPersist). One could also manually serialize an Object into a PropertyBag and pass it's Contents property as a Body. Sadly, there is no direct support for VB's UDTs.


The point of writing this is that I searched all over but couldn't find any real detail on how MSMQ Triggers work.

Well that's not entirely true. But what I couldn't find was how the heck a Trigger's Rule Action works when set to "Invoke standalone executable."

So here's the scoop, based on some experimentation:

When a new message is inserted into the queue that meets the criteria specified in the Rule Condition, the EXE specified by the Rule is run. The EXE then does "whatever" such as processing queue messages. When the EXE chooses to (such as no additional messages left to process) it terminates. This "wakes up" the Rule again, which waits for new messages and when it sees one it runs the EXE again.

The process is slightly more involved but in principle that's about it.

A queue can have multiple Triggers and Triggers can have multiple Rules set up, and the Rules can examine various queue Properties to decide whether to fire off one or more EXEs. Rules can also invoke COM components but that's not what I was interested in at the time, and it's another story though quite similar.

I was worried that the Trigger Rule would fire for each message inserted, and start the EXE once for each one. Not very efficient! Fortunately things don't work that way.


I have a situation where another (non-Windows) platform no longer has vendor support for some specialized processing. This vendor does offer Windows versions of their software, which basically consists of callable standard DLLs that accept parameters, process them against a database, and return results. The internals of these things are in some sort of interpreted Cobol! The DLLs hook into that via some proprietary interop scheme I don't even want to think about.

The old platform doesn't do DCOM, doesn't do WinRPC, etc. What it does do is support application program calls into a service library that can remap the calls into request/response transactions over a TCP connection.

So I can write a small socket service in VB that will run as a Windows Service using NTSVC.ocx or SRVANY.exe to accept the requests and send them to a queue. As responses come back via a reply queue I can return them back to the other platform over the TCP connection. Since the "calling" platform will include a correlation value in its request I can simply return that value back with the reply... which lets requests and replies overlap in time, i.e. the requests do not require synchronous processing.

Using queues and triggers gives me a nice way to decouple the application code from the socket service, which becomes a small and easily maintained program. The individual service applications become fairly small isolated programs running in their own processes as well. A new service application is easily installed by disabling its Trigger, replacing the program, and enabling the Trigger again. Even better than placing the application logic into COM libraries called by the socket service!

Each service application can process messages for one or more request types which I indicate by the message's Label property, in turned based on a Request Type field in the TCP message from the old platform making requests. By writing these to use a long timeout reading the queue they can quietly terminate after a period of no work to do. The Trigger wil restart them upon demand.

By using the message's AppSpecific property to pass the socket index of the caller I can handle multiple TCP connections from one or more external platforms.

I can also add new services by creating a new EXE to handle them and adding a new Rule to the Trigger, and I never have to modify the socket service program.

A rough diagram is included below.


For those who haven't tried playing with MSMQ I've attached a tiny demo.

There is a VB6 program "QReader" that will create a test queue and listen for messages, displaying those it finds. If it doesn't see any messages for 30 seconds it gives you a chance to delete the queue, a cleanup option for when you're through.

Once QReader has been started (creating the queue) you can run the VB6 "QWriter" program. QWriter lets you enter Label and Body string values, which it uses to create a message and insert it into the test queue.

After running QReader once to create the queue, you can run QWriter even when QReader isn't running. When you do subsequently run QReader it will pick up those "offline" messages.

These will run "triggerless" or you can set up a Trigger on the queue to automatically start QReader when appropriate messages (as defined by a Rule) are inserted.

Note that these were written for MSMQ 3.0 so they'll only run on WinXP or later but can be modifed to run on Win2K or NT 4.0, though not Win9x.

Need Information About MSMQ
Hello Frends;

I search for some information and sample about MSMQ how does it work and it will be great if the infromation is in german.

Links or docīs thanks for all

happy christmas


(we he snow and its very cold -13°)

MSMQ Included???
Apparently, NT4 SP6 does not include MSMQ, or at least, i can not find it.

Also, is there a MSMQ download for Win2k (Non Server)? for development?

I can not seem to find info on either on MS's site..

Problem Using MSMQ
We have a COM+ Application residing on a Win2k server that has queueing enabled. When I call the component from my app using MSMQ everything is cool AS LONG AS no errors occur in the method invoked. If there are any errors that occur in the method, even though the On Error GoTo picks it up, the call is repeated several times. For example, the method is Print. You call Print, and it Prints. But if it encounters an error in updating one of the records, MSMQ keeps retrying the method call, therefore printing several copies (it never ends up stopping). I have tried using On Error Resume Next with no luck. It is completing the transaction at the end of the method (it is not calling SetAbort, it is definitely SetComplete).

How can I stop MSMQ from retrying? Or any other solution...

WMI MSMQ Problem.

I use MSMQ on win2000 systems and I want to monitor the queues.
I use WMI for this task. The only problem is that when I ask a complete list of (private)queues, I miss some queues!

Has anyone had this problem before?



(PS I use this WQL: "SELECT * FROM Win32_PerfRawData_MSMQ_MSMQQueue")

MSMQ Newbie
Hey guys,
I am new to MSMQ and have a basic question. When I create a queue using MSMQ by specifying for example a path as: .MyQueue, where is the physical location of the queue? or does one even get created on my machine that I can see? How about the messages within it... can I browse to it? Thanks...

MSMQ Question
My program opens and reads messages from a Private Queue I have created. After reading the messages, I would like to purge the queue from within VB but I get a No access error. I can go and manually purge the Queue so I have permission. I am using Windows XP and VB 6. I am able to read the messages fine.

Option Explicit

Private Declare Function MQPurgeQueue Lib "mqrt.dll" (ByVal hQueue As Long) As Long
Private Const MQ_OK = 0

Const MQ_DENY_NONE = 0

Const Timeout = 20 ' 20 ms timeout

Dim msmqInfo As MSMQQueueInfo
Dim Queue As MSMQQueue
Dim retval As Boolean
Dim Result As String

sub main()

Set msmqInfo = New MSMQQueueInfo

msmqInfo.PathName ="Mycomputer" & "Private$MyPrivateQueue"

Set Queue = msmqInfo.Open(MQ_PEEK_ACCESS, MQ_DENY_NONE)

Result = MQPurgeQueue(Queue.Handle)

If Result <> MQ_OK Then
MsgBox "error" & Result
End If

End Sub

Sleeping MSMQ ??
Do msmq queues go into sleep mode or dormant state if not used for some time. ??
I am facing a problem wherein the queues are taking longer to do any activity if not accesssed for a long time .

Can any1 help ?

MSMQ Initalizing
I am facing some problem because of object initialization with MSMQ or some other MSMQ initializing like connection to machine having queues. I am not able to figure out the eact problem.

Because of this I face some problem with doing operations the first time or after some time gap with queues.

could anyone help

MSMQ..Which Type Lib?
Does anyone know which type lib to reference when using the Microsoft Message Queue objects??

MSMQ Research

Im currently trying to do some research on using MSMQ and was wondering if anyone knew of any good sites and/or books on the subject?


Problem With Msmq In Vb6
Does anyone know what would cause a program written as a service in vb6 to stop receiving messages from an msmq message queue after an extended period of running smoothly. Usually this means that it will not work in the morning after being on overnight.

Receiving messages are handled by using the Arrived (and ArrivedError) events. The program will work again just by reconnecting to queue but it shouldn't disconnect in the first place.

Any help would be appreciated. Thanks

MSMQ Getting Started

I am just getting stared with MSMQ in VB.

How do I know if MSMQ is intalled on my machine?

If it is, which objects should I select in menu Project > References


MSMQ Security
Hi There,

Anybody knows how to change security permissions for the whole Msmq Enterprise?

I know that there is an API, MQSetQueueSecurity, that set the Q security but is there a way to change the Enterprise security permissions?


Que Needed On MSMQ
I am using MSMQ for asychronous communication. I want to know whether I can queue an exe using MSMQ. The exe will perform a DB operation. Please help.

MSMQ Vs A Database
Can MSMQ detect an active connection to a client and then automatically send a message to that client? Or does MSMQ only hold messages until a client makes a request?

If MSMQ only holds messages, then why not use a database instead?

MSMQ Reply Queues
Hi all.

In an MSMQ application, is it necessary to have a private reply queue for every messages? Will it be a good idea to delete the reply queue after receiving the reply?

Furthermore, any links to MSMQ, except MSDN, will be very much appreciated.

thanks in advance.

MSMQ OpenQueue Method
If I want to read queue on another machine in the same domain, how do I specify 'queuepathname' parameter in the openqueue method?

I have tried IP/path, machine_name/path etc... no luck...

FYI... protocol is TCP



MSMQ - Disaster Recovery
hi guys,

i sent 100 msg ques in my system.
then i retrieve all 100 m
when i recieve the 100 msgs from queue, Unfortunately my MSMQ crashed. First 60 msgs only i recieved.
Now i need to recieve the rest of 40 msgs.

Any body know about Disaster Recovery in MSMQ.

pls help me.


Message Queue (MSMQ)

anybody used that thing, i just started reading about it and it looks pretty crazy...

anybody could give me a brief info on HOW and WHY would one want to use it? example maybe...


MSMQ General Question
My supervisor was told we should use MSMQ to have about 38 pc's send files and messages to a central computer. I don't know anything about this process. Can anyone give me a few links that explain what MSMQ is and what it is capable of Or any good books on the subject.


Problem Reading From MSMQ
I am writing a VB program to get message fm MSMqueue.

I have installed MSMQ dependent on my NT Workstation and when i try to read using a object of MSMQQueueInfo class from a queue which is on some other system then i get the error "The Queue is not registered in the DS". Whereas It shows me all the queues in case i create the object of MSMQQuery class.

How do i register the queue in my system

Don't worry ! Be Happy !!!!

Change Permissions On MSMQ.MSMQQueueInfo
i am using MSMQ.MSMQQueueInfo to create QUEUS on the server!
how can i set permissions like adding a SYSTEM to the permissions and giving it the right permisisons?
thnaks in advance

Change MSMQ Queue Security With VB
I found the msdn code to create a msmq queue in vb.
Set qi = CreateObject("MSMQ.MSMQQueueInfo")
qi.PathName = ".PRIVATE$ est"
qi.Label = "test"
Call qi.Create

But I don't find a code to change the security access of this queue. I want to set to "Full Control" for "All user".

Please, I need help :)

Calculating Total No Of Messages In MSMQ Using Vb 6.0

We hv one point of sale application called "Active Retail" which uses MSDE as a backend and vb6.0 as a front end.
The application generates messages for each transaction and updates to our remote server.
My question is "is there any way to calculate total no of pending messages from MSMQ in the local system using vb6.0"
your response is highly appreciated.


How To Tell The Message Count Of A Queue (MSMQ 2.0)
I have a simple question: Can my VB6 app tell the number of messages sitting in an MSMQ 2.0 queue?

* From what I was able to find on MSDN there is no way to read the size of a queue in MSMQ 2.0.
* The reference docs do identify the "MQMgmtGetInfo" function, that is capable of returning the size of a message queue (see This function is supposedly available only in MSMQ 3.0
* However, I've found non-Microsoft references (i.e. results of Google searches) stating that this function is available in all versions of MSMQ, though these references only admit to the existence of C++ bindings for it (no VB).

This VB6 app runs on MS Win2K.


Can We Automate Msmq Trigger Creation Using Vb 6.0?
Our application uses MSMQ Private queues, with MSMQ Trigger Rule attached to that. And when ever the implementers create the MSMQ Trigger manually from services & applications(compmgmt.msc), they commit errors. Automating the MSMQ Trigger Rule creation & attaching it to a private queue will greatly help in avoiding the manual errors.

Guide me if there is a way to automate MSMQ Trigger Rule creation using VB 6.0.

Pramod Kumar Gujjeti

MSMQ Message Recieving Problem
When I browse the MSMQ explorer during my MSMQ application running. The error message "The Message Queues Service is not available" when the Reciever try to receive a message from the queue.
Can anyone help me?
Thank you for help in advanced


MSMQ Cursor Error + PeekNext() - Problem
Hello there,

i have developed an extension for the surveillance-tool "ServersAlive" as a COM-component. With this module, i want to analyze a Microsoft Message Queue. I want to check whether there are messages in the queue which are older than a specified date (dtBorder in the source code below). It works fine so far, but there are still 2 problems:

1) If the cursor already points to the last message in queue an i perform a call of PeekNext(), the function should usually return "Nothing", shouldn't it? However, using the enquiry "While Not oQueue.PeekNext Is Nothing", i always get an error. By setting a timeout i can continue, but this way is not too smart, is it? Is there perhaps an eligible break condition?

2) If an other module processes messages and removes them from the queue while my checks are running, i always get a cursor error. How can I prevent that? How can i catch this error?? Or do i even have to lock the queue while checking? Is that possible? Perhaps there are more than one possibilities...

The relevat code of the Function:

Dim oQueue As MSMQ.MSMQQueue
Dim oQueueInfo As MSMQ.MSMQQueueInfo
Dim oQueueMessage As MSMQ.MSMQMessage

Set oQueueInfo = New MSMQ.MSMQQueueInfo
oQueueInfo.FormatName = sMSMQName

Set oQueue = oQueueInfo.Open(MQ_PEEK_ACCESS, MQ_DENY_NONE)

Set oQueueMessage = oQueue.Peek(0, 0, 2500, 0)
If Not oQueueMessage Is Nothing Then
If oQueueMessage.ArrivedTime < dtBorder Then
iCount = iCount + 1
End If

Set oQueueMessage = oQueue.PeekCurrent(0, 0, 2500, 0)

While Not oQueue.PeekNext(0, 0, 2500, 0) Is Nothing
Set oQueueMessage = oQueue.PeekCurrent(0, 0, 2500, 0)
If oQueueMessage.ArrivedTime < dtBorder Then
iCount = iCount + 1
End If
End If

If iCount > 0 Then
sa_docheck = False
sa_result = CStr(iCount) & " message(s) not processed in time ( older than " & sEntryAge & " hour(s) ) "
sa_result = "All files processed in time . . . "
End If

It would be very nice if anyone could help me. I'm searching a solution for days now.

Best Regards

Custom Database Viewer Will Open In Windows XP But Not Windows 2000 Operating System

I have a VB 6.0 program that was created in Windows XP that allows people to view microsoft access data in a custom form using ADO technology. In order for this to work I have code that will check the users system folder to see if MSBIND.dll is in there. IF it isn't then it will install it as it is needed to view the data. The program works fine in Windows XP but now I have tested it out in Windows 200 and I get databinding errors.

I use the system function "GetWindowsDirectory" and when I check to see where msbind.dll is being stored it says C:WINNTSystem32MSBind.dll

I guess my question is, is this where I should be putting my msbind.dll? If so and the dll is not my problem, does anyone know of any problems that could be encountered by a Windows 2000 machine but not a Windows XP machine?

Thank you

Windows Media Player Issue (windows Update Break??)
Hello, I developed a program a couple of weeks ago that worked perfectly.. and I tried to run it again after upgrading to sp2 and various other windows updates.. and now I keep getting a fatal error. I have narrowed the problem down to windows media player.. and recreated it with this.. and only this in a form:

Private Sub Command1_Click()
WindowsMediaPlayer.URL = "C:EZinkBrand.wmv"
End Sub

Here is a screen shot of what happens after I press Command1:

Any ideas? I just copy and past the above code in a new form.. and change the name of windowsmediaplayer1 to windowsmediaplayer.. and that is it..
I am using vb6, I am using windows xp pro sp2 (windows media player 10.. was using 9 and got the same error)


Problem Running VB6 Application In Windows XP & Windows 2003 Server
I have installed a program written in VB6 and Crystal Reports 8.

When I run the program in Windows XP Professional, once a while I encounter "Illegal Operation" for SslstBar.ocx, Ssdw3a32.ocx and Ssdw3b32.ocx.

When I run the program in Windows 2003 server (program and database in the server), frequently my program seems like hang and I can only close my program using "Endtask".

I need to your help to resolve the above problem soonest possible.

Thank you very much.

Have a nice day.

Please Help Me To Implement RunAs In Windows Service On Windows 2003 Server ...
Hello to all Forum Members;

Currently I'm working on a Monitoring Service which is intended to monitor the status of configured Applications and other Windows Services and restart if any of those are found not running. It works smooth with Windows Services; however I'm facing some problems while making the Service to start the third party Applications that have Database backend via ODBC or ADO.

I register my Windows Service as "Interactive with Desktop" under "LocalSystem" account on Windows 2003 Server. If I configure an Application such as Notepad or similar then there is no problem; but if there any application that has Database backend then the problem starts! These applications are not getting started properly. One of such applications is VoIPSwitch which says that it failed to connect to Database as either database drivers are not found or database does not exists! Both reasons are wrong as I can start the same application with the double click on same Executable file; it's just my Windows Service that's not able to start the application.

I received a suggestion to implement the RunAs for starting such applications with User Name and Password passed to it. So, for my quick testing I quickly searched for RunAs code module and found two examples on Planet Source Code, one of which I'm currently implementing in my code, too. You can download it for your reference from following URL:

When I implemented it in my Monitoring Service and checked my Service Log (which I have coded to be written to ServiceLog.log file; this is not Windows Event Log), I got to see the error as returned by RunAs code: Access Denied!

I specified the same User Name and Password that I give while logging to my Windows 2003 Server (on which this Service is running) for RunAs and still I'm getting this error! The interesting thing is ... when I executed the RunAs VB code (the link above points to the same code) on the same Server by double-click it's icon and then with same User Name and Password, then it started the specified application without any problem! I feel there is no problem in the RunAs code; but it's the Windows Service (which is under Local System account) is not getting permission from Windows 2003 Server!

Am I missing something here? What's going wrong? Why Access Denied error is giving by Windows 2003 when Service attempts to start the application? I'm absolutely clueless right now; please give me some suggestion/solution to resolve this error!

Waiting for your valuable reply ...



How Can I Write VB Code To Get Windows Path And Associate An Extension With Windows?
Hi, hope someone can help me with this. I want to know the codes that I can use in VB 6 to get the path to Windows folder. As you know some people might not install their Windows in C:Windows.
One more thing, I want to know the codes that I can use in VB 6 to associate an extension with Windows. For example, all the *.bos files should be opened with my program whenever users double-click them. So if you know please reply to this thread.

Thanks in advance,

Windows Vista And Windows Media Player Sound Problems?
I have an VB6.0 application which interacts with WMP control with no problems. Basically, I can play video or mp3 files through my application and can even adjust the sound levels via the "Wmplayer1.settings.volume" property.

Now, my friend recently installed Windows Vista and then installed my application and indicates the sound is no longer heard through my application anymore. If he plays a song directly using Windows Media Player (ie: outside of my application) then the sound can be heard fine.

So .... does Windows Vista interact with Windows Media Player in differrent ways when handling audio/sounds now? Does anyone know why playing a song using a WMP object in VB6.0 no longer allows sound anymore?

** Can someone else verify whether sound in Windows Vista can be heard when VB6.0 is used to interact with a WMP control?

Thanks for an insight you can provide me since I do not have Windows Vista and I am trying to determine if any compatibility problems need to be addressed .....

Edited by - uncletr on 4/7/2007 3:43:20 PM

Copyright Đ 2005-08, All rights reserved