The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: ActiveX control Message Properties


  • Subject: Re: ActiveX control Message Properties
  • From: Mark Harrison \(Yahoo!\)
  • Date: Sun, 25 Jan 2004 14:03:00 +0000

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
Michael,Please see the code stuff (at the bottom of this message), which is
how I do it..As you'll see, I use a lexical parse of the header, which I
pass to the function as a string, rather than using a specific
property/method of the OCX:Regards,Mark----- Original Message ----- From:
Michael McSharryTo: <A href="mailto:xAP_developer@xxxxxxx";>xAP_developer@xxxxxxx</A>Sent:
Sunday, January 25, 2004 6:27 AMSubject: [xAP_developer] ActiveX control
Message PropertiesI'm using Patrick's ActiveX control for xAP with
success.&nbsp; I am able to setthe properties for the message source
and target, but when I receive amessage and place it in message structure I
am not able to retrieve thesource and target properties.&nbsp; I am
able to use the available methods tocompare these fields and it will return
matches when they occur, but when Ilook at the property directly it always
returns a null string.&nbsp; Is this bydesign or is there so
mething else that needs to be setup before readingthese
properties?=========== CODE FRAGMENT STARTS =============Attribute VB_Name
= "clsXapMessage"Attribute VB_GlobalNameSpace = FalseAttribute
VB_Creatable = TrueAttribute VB_PredeclaredId = FalseAttribute VB_Exposed =
FalseOption ExplicitPrivate sHeaderKeyword As StringPrivate lVersion As
LongPrivate lHopCount As LongPrivate sUniqueIdentifier As StringPrivate
sClass As StringPrivate sSource As StringPrivate sTarget As StringPublic
Sub ProcessMessage(sRawMessage As String)&nbsp;&nbsp;&nbsp; On
Error GoTo ProcessMessage_Error&nbsp;&nbsp;&nbsp; Dim
sCurrentMessage As String&nbsp;&nbsp;&nbsp; Dim
lCurrentDelimiterPossition As Long&nbsp;&nbsp;&nbsp; Dim
objMyMessageBlock As clsMessageBlock&nbsp;&nbsp;&nbsp; Dim
objMyKeyValuePair As clsKeyValuePair&nbsp;&nbsp;&nbsp; Dim
sCurrentKeyValuePair As String&nbsp;&nbsp;&nbsp; Dim
sCurrentEqualsPosition As Long&nbsp;&nbsp
;&nbsp; Dim sCurrentBangPosition As Long&nbsp;&nbsp;&nbsp;
Dim sMyKeyWord As String&nbsp;&nbsp;&nbsp; Dim sMyValue As
String&nbsp;&nbsp;&nbsp; Dim bMyIsHex As
Boolean&nbsp;&nbsp;&nbsp; Dim lHeaderID As
Long&nbsp;&nbsp;&nbsp; Dim lCntr1 As
Long&nbsp;&nbsp;&nbsp; Dim lCntr2 As
Long&nbsp;&nbsp;&nbsp; If sRawMessage = ""
Then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Exit Sub&nbsp;&nbsp;&nbsp; End If&nbsp;&nbsp;&nbsp;
sCurrentMessage = sRawMessage&nbsp;&nbsp;&nbsp; 'Start decoding
the header&nbsp;&nbsp;&nbsp; ChangeStatus "Decoding xAP
message..."&nbsp;&nbsp;&nbsp; lCurrentDelimiterPossition =
InStr(1, sCurrentMessage, "{")&nbsp;&nbsp;&nbsp;
sHeaderKeyword = Mid(sCurrentMessage, 1, lCurrentDelimiterPossition -
1)&nbsp;&nbsp;&nbsp; If Mid(sHeaderKeyword,
Len(sHeaderKeyword), 1) = Chr$(10
)
Then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'Some messages don't have the line feed before the first
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'so
need to check it it is there and then remove
it&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sHeaderKeyword = Mid(sHeaderKeyword, 1, Len(sHeaderKeyword) -
1)&nbsp;&nbsp;&nbsp; End If&nbsp;&nbsp;&nbsp; If
Not (UCase(sHeaderKeyword) = UCase("xap-Header"))
Then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'Don't log
heartbeats&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ChangeStatus
""&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Exit Sub&nbsp;&nbsp;&nbsp; End If&nbsp;&nbsp;&nbsp;
sCurrentMessage = Mid(sCurrentMessage, lCurrentDelimiterPossition +
2,Len(sCurrentMessage))&nbsp;&nbsp;&nbsp;
lCurrentDelimiterPossition = InStr(1, s
CurrentMessage, Chr$(10))&nbsp;&nbsp;&nbsp; lVersion =
CLng(Mid(sCurrentMessage, 3, lCurrentDelimiterPossition -
3))&nbsp;&nbsp;&nbsp; sCurrentMessage = Mid(sCurrentMessage,
lCurrentDelimiterPossition +
1,Len(sCurrentMessage))&nbsp;&nbsp;&nbsp;
lCurrentDelimiterPossition = InStr(1, sCurrentMessage,
Chr$(10))&nbsp;&nbsp;&nbsp; lHopCount =
CLng(Mid(sCurrentMessage, 5, lCurrentDelimiterPossition
-5))&nbsp;&nbsp;&nbsp; sCurrentMessage = Mid(sCurrentMessage,
lCurrentDelimiterPossition +
1,Len(sCurrentMessage))&nbsp;&nbsp;&nbsp;
lCurrentDelimiterPossition = InStr(1, sCurrentMessage,
Chr$(10))&nbsp;&nbsp;&nbsp; sUniqueIdentifier =
Mid(sCurrentMessage, 5, lCurrentDelimiterPossition
-5)&nbsp;&nbsp;&nbsp; sCurrentMessage = Mid(sCurrentMessage,
lCurrentDelimiterPossition +
1,Len(sCurrentMessage))&nbsp;&nbsp;&nbsp;
lCurrentDelimiterPossition = InStr(1, sCurrentMessage,
Chr$(10))&nbsp;&nbsp;&nbsp; sClas
s = Mid(sCurrentMessage, 7, lCurrentDelimiterPossition -
7)&nbsp;&nbsp;&nbsp; sCurrentMessage = Mid(sCurrentMessage,
lCurrentDelimiterPossition +
1,Len(sCurrentMessage))&nbsp;&nbsp;&nbsp;
lCurrentDelimiterPossition = InStr(1, sCurrentMessage,
Chr$(10))&nbsp;&nbsp;&nbsp; sSource = Mid(sCurrentMessage, 8,
lCurrentDelimiterPossition - 8)&nbsp;&nbsp;&nbsp;
sCurrentMessage = Mid(sCurrentMessage, lCurrentDelimiterPossition +
1,Len(sCurrentMessage))&nbsp;&nbsp;&nbsp;
lCurrentDelimiterPossition = InStr(1, sCurrentMessage,
"}")&nbsp;&nbsp;&nbsp; If Not
lCurrentDelimiterPossition = 1
Then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'Target is
optional&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sTarget = Mid(sCurrentMessage, 8, lCurrentDelimiterPossition -
9)&nbsp;&nbsp;&nbsp; End If




xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.