Supongo que si, has de tener en cuenta que las clases tienen una estructura bastante compleja que el CallByNameEx ha de recorrer cada vez... tal vez podrías hacer algo para restar el tiempo que le cuesta al CBNEx encontrar la funcion...
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúPrivate c As Class1
sub Main()
set c = new Class1
end sub
Public Function GetFilevbspeed(ByRef s As String) As String
GetFilevbspeed = c.GetFile05(s)
End Function
' By Chris Lucas, cdl1051@earthlink.net, 20011204
' Thanks to Olaf for the class implementation concept
Option Explicit
Private Declare Function ArrPtr& Lib "msvbvm60.dll" Alias "VarPtr" (ptr() As Any)
Private Declare Sub RtlMoveMemory Lib "kernel32" (dst As Any, src As Any, ByVal nBytes&)
Private SafeArrayHeader(5) As Long
Private SafeArray() As Long
Private Sub Class_Initialize()
SafeArrayHeader(0) = 1 ' Number of dimensions
SafeArrayHeader(1) = 4 ' Bytes per element (long = 4)
SafeArrayHeader(4) = &H7FFFFFFF ' Array size
' Force SafeArray to use SafeArrayHeader as its own header
RtlMoveMemory ByVal ArrPtr(SafeArray), VarPtr(SafeArrayHeader(0)), 4
End Sub
Friend Function GetExtension06(sText As String) As String
Dim i&, SLen&, tmp1&, tmp2&
SafeArrayHeader(3) = StrPtr(sText)
SLen = LenB(sText) \ 2
If (SLen And 1) Then
If (SafeArray(SLen \ 2) And &HFFFF&) = &H2E& Then Exit Function
End If
For i = SLen \ 2 - 1 To 0 Step -1
tmp1 = SafeArray(i)
tmp2 = (tmp1 And &HFFFF0000)
If tmp2 = &H2E0000 Then GoTo HiWord
If tmp2 = &H5C0000 Then Exit Function
tmp2 = (tmp1 And &HFFFF&)
If tmp2 = &H2E& Then GoTo LoWord
If tmp2 = &H5C& Then Exit Function
Next i
Exit Function
HiWord:
GetExtension06 = RightB$(sText, SLen + SLen - i - i - i - i - 4)
Exit Function
LoWord:
GetExtension06 = RightB$(sText, SLen + SLen - i - i - i - i - 2)
End Function
Friend Function GetFile05(sText As String) As String
Dim i&, SLen&, tmp1&
SafeArrayHeader(3) = StrPtr(sText):
SLen = LenB(sText) \ 2
If (SLen And 1&) Then
If (SafeArray(SLen \ 2) And &HFFFF&) = &H5C& Then Exit Function
End If
For i = SLen \ 2 - 1 To 0 Step -1
tmp1 = SafeArray(i)
If (tmp1 And &HFFFF0000) = &H5C0000 Then GoTo HiWord
If (tmp1 And &HFFFF&) = &H5C& Then GoTo LoWord
Next i
HiWord:
GetFile05 = RightB$(sText, SLen + SLen - i - i - i - i - 4)
Exit Function
LoWord:
GetFile05 = RightB$(sText, SLen + SLen - i - i - i - i - 2)
End Function
Friend Function GetPath05(sText As String) As String
Dim i&, SLen&, tmp1&
SafeArrayHeader(3) = StrPtr(sText):
SLen = LenB(sText) \ 2
If (SLen And 1) Then
If (SafeArray(SLen \ 2) And &HFFFF&) = &H5C& Then
GetPath05 = sText
Exit Function
End If
End If
For i = SLen \ 2 - 1 To 0 Step -1
tmp1 = SafeArray(i)
If (tmp1 And &HFFFF0000) = &H5C0000 Then GoTo HiWord
If (tmp1 And &HFFFF&) = &H5C& Then GoTo LoWord
Next i
GetPath05 = sText
Exit Function
HiWord:
GetPath05 = LeftB$(sText, i + i + i + i + 4)
Exit Function
LoWord:
GetPath05 = LeftB$(sText, i + i + i + i + 2)
End Function
Private Sub Class_Terminate()
' Make SafeArray once again use its own header
' If this code doesn't run the IDE will crash
RtlMoveMemory ByVal ArrPtr(SafeArray), 0&, 4
End Sub
http://xbeat.net/vbspeed/c_GetFile.htm
Citar[Reglas] Subforo de análisis y diseño de malware.