I put the wait window there just to keep the example short. It could have been a "*!* Do something here" comment.
The problem I have is oMSMQEvent = create("msmq.msmqevent") creates an empty object, and then oFoxEvents = create("FoxEvent") throws an error. I just recently started trying to use the "IMPLEMENTS" designation.
I've been trying to get this to work for 3 days now. I've read everything I can find online, plowed through my old FoxPro books (MS Office Automation, What's New in 9, MegaFox, ...). The download for MSMQ/VFP from MSDN does everything EXCEPT I can't get the MSMQEvents to work.
I'm desperate.
>You can't have ANY UI in a VFP COM component. That means WAIT WINDOW, MESSAGEBOX, ?, ??, and Forms will not work. You will have to output the test results to a text file or cursor.
>Does that help?
>
>>Hello Everyone,
>>
>>Can anyone get this to work? If I can get past this code I'll be able to finish the rest (I think) myself.
>>
>>Thanks in advance...
>>
>>
>>CLEAR
>>
>>PUBLIC oComUtil, oFoxEvent, oMSMQEvent
>>
>>* Setup up event handler to receive the messages
>>oMSMQEvent = create("msmq.msmqevent")
>>oComUtil = create("vfpcom.comutil")
>>oFoxEvents = create("FoxEvent")
>>
>>? EVENTHANDLER(oMSMQEvent,oFoxEvent)
>>
>>
>>DEFINE CLASS FoxEvent AS custom OLEPUBLIC
>> IMPLEMENTS FoxEvents IN "MSMQ.Msmqevent"
>>
>> Procedure FoxEvents_Arrived(oQueue,Cursor)
>> WAIT WINDOW "Message Arrived" TIMEOUT 1
>> ENDPROC
>>
>> Procedure FoxEvents_ArrivedError(Queue,ErrorCode,Cursor)
>> WAIT WINDOW "Message Arrived Error" TIMEOUT 1
>> ENDPROC
>>
>>ENDDEFINE
>>