M
Mikael Nilsson
I've got what I think a mysterious error. On most clients the below function
WebLogin works perfectly, when stepping through the code line by line the
function mMain.GetRequest are executed. But in some cases this function is
never executed instead the next function in the module (function
RelativeToPhysicalPath) are executed although this function is never called
from the function WebLogin!
When execution is paused on the line
arrLoginInfo = mMain.GetRequest(mGlobal.m_strWebSiteAddress &
"client_login_withgroups.asp?user=" & strUserName & "&pwd=" & strPassword)
arrLoginInfo = Split(arrLoginInfo, ";")
I can see that all variables have their correct values. When the execution
reaches the line "strPhysical = strRelative" in function
"RelativeToPhysicalPath" PowerPoint crashes with the standard error
"Microsoft Office PowerPoint has encountered a problem and needs to close.
We are sorry for the inconvenience." The installed version is Office 2003
with all updates installed, MDAC 2.8 is also installed.
Does anyone have an explanation for this strange behaviour???
Function WebLogin(strUserName As String, strPassword As String) As Boolean
On Error Resume Next
Dim arrLoginInfo As Variant
'// Try to log in the user, get userid(0) and group(1-*)
arrLoginInfo = mMain.GetRequest(mGlobal.m_strWebSiteAddress &
"client_login_withgroups.asp?user=" & strUserName & "&pwd=" & strPassword)
arrLoginInfo = Split(arrLoginInfo, ";")
....
End Function
Function GetRequest(URL)
On Error GoTo ErrorHandler
Dim objXMLHttp As New MSXML2.XMLHTTP30
With objXMLHttp
.Open "POST", URL, False
.send
End With
DoEvents
'Get a result from the ASP-page
GetRequest = objXMLHttp.responseText
Set objXMLHttp = Nothing
Exit Function
ErrorHandler:
Call mGlobal.WriteError(Err, "mMain.GetRequest", URL)
End Function
Function RelativeToPhysicalPath(strRelative As String, strPhysical As
String) As String
Dim arrRelative As Variant
If InStr(strRelative, "..") > 0 Then
arrPhysical = Split(strPhysical, "\")
arrRelative = Split(strRelative, "..")
strPhysical = ""
For p = 0 To UBound(arrPhysical) - UBound(arrRelative)
strPhysical = strPhysical & arrPhysical(p) & "\"
Next
Erase arrPhysical, arrRelative
strRelative = Replace(strRelative, "../", "")
strRelative = Replace(strRelative, "..\", "")
strRelative = Replace(strRelative, "/", "\")
strPhysical = mMain.buildPath(strPhysical, strRelative)
Else
strPhysical = strRelative
End If
RelativeToPhysicalPath = mEncoding.URLDecode(strPhysical)
End Function
---
Mikael Nilsson
System Developer
Pyramid Communication
WebLogin works perfectly, when stepping through the code line by line the
function mMain.GetRequest are executed. But in some cases this function is
never executed instead the next function in the module (function
RelativeToPhysicalPath) are executed although this function is never called
from the function WebLogin!
When execution is paused on the line
arrLoginInfo = mMain.GetRequest(mGlobal.m_strWebSiteAddress &
"client_login_withgroups.asp?user=" & strUserName & "&pwd=" & strPassword)
arrLoginInfo = Split(arrLoginInfo, ";")
I can see that all variables have their correct values. When the execution
reaches the line "strPhysical = strRelative" in function
"RelativeToPhysicalPath" PowerPoint crashes with the standard error
"Microsoft Office PowerPoint has encountered a problem and needs to close.
We are sorry for the inconvenience." The installed version is Office 2003
with all updates installed, MDAC 2.8 is also installed.
Does anyone have an explanation for this strange behaviour???
Function WebLogin(strUserName As String, strPassword As String) As Boolean
On Error Resume Next
Dim arrLoginInfo As Variant
'// Try to log in the user, get userid(0) and group(1-*)
arrLoginInfo = mMain.GetRequest(mGlobal.m_strWebSiteAddress &
"client_login_withgroups.asp?user=" & strUserName & "&pwd=" & strPassword)
arrLoginInfo = Split(arrLoginInfo, ";")
....
End Function
Function GetRequest(URL)
On Error GoTo ErrorHandler
Dim objXMLHttp As New MSXML2.XMLHTTP30
With objXMLHttp
.Open "POST", URL, False
.send
End With
DoEvents
'Get a result from the ASP-page
GetRequest = objXMLHttp.responseText
Set objXMLHttp = Nothing
Exit Function
ErrorHandler:
Call mGlobal.WriteError(Err, "mMain.GetRequest", URL)
End Function
Function RelativeToPhysicalPath(strRelative As String, strPhysical As
String) As String
Dim arrRelative As Variant
If InStr(strRelative, "..") > 0 Then
arrPhysical = Split(strPhysical, "\")
arrRelative = Split(strRelative, "..")
strPhysical = ""
For p = 0 To UBound(arrPhysical) - UBound(arrRelative)
strPhysical = strPhysical & arrPhysical(p) & "\"
Next
Erase arrPhysical, arrRelative
strRelative = Replace(strRelative, "../", "")
strRelative = Replace(strRelative, "..\", "")
strRelative = Replace(strRelative, "/", "\")
strPhysical = mMain.buildPath(strPhysical, strRelative)
Else
strPhysical = strRelative
End If
RelativeToPhysicalPath = mEncoding.URLDecode(strPhysical)
End Function
---
Mikael Nilsson
System Developer
Pyramid Communication