Estuve viendo la aplicación, no hay problemas para mostrar el ultimo comentario, pero se van sumando otros inconvenientes, por ejemplo el paginado también hay que saber cuantas paginas se muestran para consultar la ultima que es donde esta el ultimo comentario, yo creo que para que el programa se realmente cumpla una utilidad deverias mostrar una alerta cuando alguien publico un post o alguien hizo un comentario, distingamos un post de un comentario, el post es el hilo principal tal como te lo muestra el rss y el comentario es lo que le sigue hecho por los demás usuarios.
Entonces si el primer ítem del rss cambia es porque alguien hizo un post, hay deverias mostrar un msg o ventana con la información y con un solo click te abra el navegador en dicho post, y si hay un comentario también un msg y con un click abris en dicho post, no se si me entiendes cual es mi pensamiento. pero es un punto de vista.
bueno te dejo el codigo para ver el ultimo comentario del post (Eso si, solo toma en cuenta la primera pagina, después cualquier cosa vemos eso)
Fíjate que modifique la función ahora se llama GetLastComent y tiene cuatro parámetros el primero es la url del post (osea ucLblitem2(Index).Tag) los otros cuatro parámetros son de tipo ByRef en los que carga el la URL con el ancla, Autor, Fecha, y comentario., si la funcion devuelve true es porque hay almenos hay un comentario, y salio todo bien.
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
Private Sub Form_Load()
Dim sUrl As String
Dim sUrlComentario As String
Dim sAutor As String
Dim sFechaComentario As String
Dim sMensage As String
Me.AutoRedraw = True
sUrl = "http://forum.planetnoize.com/index.php?p=/discussion/62/sigue-caido-peruhardware-y-forosperu/p2"
If GetLastComent(sUrl, sUrlComentario, sAutor, sFechaComentario, sMensage) Then
Me.Print "Url: " & sUrlComentario
Me.Print "Autor: " & sAutor
Me.Print "Fecha: " & sFechaComentario
Me.Print "Mensage: " & vbCrLf
Me.Print sMensage
Else
Me.Print "No hay comentarios en el post, solo el mensage original."
End If
'ShellExecute Me.hwnd, vbNullString, sUrlComentario, vbNullString, "C:\", SW_SHOWNORMAL
End Sub
Private Function GetLastComent(ByVal sUrl As String, ByRef sUrlComment As String, ByRef sAutor As String, ByRef sDateComment As String, ByRef sMessage As String) As Boolean
On Error Resume Next
Dim m_Inet As Object
Dim HtmlDOC As Object
Dim iLast As Integer
Dim Element As Variant
Dim sLastAnchor As String
Dim i As Integer
Set m_Inet = CreateObject("MSXML2.ServerXMLHTTP")
m_Inet.open "GET", sUrl, False
m_Inet.send
If m_Inet.Status = 200 Then
Set HtmlDOC = CreateObject("htmlfile_FullWindowEmbed")
HtmlDOC.body.innerhtml = m_Inet.responsetext 'StrConv(m_Inet.responseBody, vbUnicode)
iLast = HtmlDOC.anchors.length - 1
For i = iLast To 0 Step -1
If InStr(HtmlDOC.anchors.Item(i).href, "#") > 0 Then
sLastAnchor = Mid$(HtmlDOC.anchors.Item(i).href, InStr(HtmlDOC.anchors.Item(i).href, "#") + 1)
Exit For
End If
Next
If sLastAnchor <> "" Then sUrlComment = sUrl & "#" & sLastAnchor
For Each Element In HtmlDOC.getElementById(sLastAnchor).All
Select Case Element.className
Case "Message"
sMessage = Element.innertext
Case "DateCreated"
sDateComment = Element.innertext
Case "Author"
sAutor = Element.innertext
End Select
Next
End If
GetLastComent = Err.Number = 0
End Function