Seamus,
Your buffer returned from GetUserName is 255 bytes long. IIRC the unused
bytes following the data that you want is filled with DEC = 0 (aka NULL's).
The nSize parameter has two uses. 1) tell the function how big the buffer is
and 2) tells you how many bytes have been used. You have to strip out the
bytes that you want as shown in the following function.
Function UserName() As String
Dim myUserName As String * 255
Dim numCharsInUserName As Long
myUserName = Space$(255)
numCharsInUserName = Len(myUserName$)
Call GetUserName(myUserName, numCharsInUserName)
If numCharsInUserName > 0 Then
UserName = Left$(myUserName, numCharsInUserName)
Else
UserName = "Unknown"
End If
End Function
regards,
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Robert W.Mills (Systems Development Manager) |
|Windsong Services, St. Mary Cray, ENGLAND |
|Tel : +44 (0)1689 870622 x3005 |
|Fax : +44 (0)1689 899026 |
|Email: [log in to unmask] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-----Original Message-----
From: Seamus Browne [mailto:[log in to unmask]]
Sent: 18 September 2001 12:49
To: [log in to unmask]
Subject: Reflection script logon problem
Attempting to reuse a script and running into Problems.
Reflection is 6.00
Script works fine on my HP3000 927.
The GetUserName gets the Windows UserName from Windows and uses it in the HP
Hello
as a SessionName so the string passed in the Hello command is
MyUserName,MANAGER.SYS
On the new A400 I get the following feedback in the Reflection screen :
MPE/iX:hello Seamus,MANAGER.SYS
Name greater than 8 characters long. (CIERR 1435)
MPE/iX:
What's causing the error 1435 ?
TIA
Seamus
-------------------------------------------------------------------
Here is the script:
' Generated by the Reflection Script Recorder on 01-08-1998 11:10:15.89.
' Generated by Reflection 1 for Windows 5.10
'
'
Option Explicit
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal
lpBuffer As String, nSize As Long) As Long
Sub Main
Dim myUserName As String * 255
dim numCharsInUserName as Long
numCharsInUserName = 255
GetUserName myUserName, numCharsInUserName
' MsgBox myUserName
'End Sub
'Sub Main
Const NEVER_TIME_OUT = 0
Dim LF As String ' Chr$(rcLF) = Chr$(10) = Control-J
Dim CR As String ' Chr$(rcCR) = Chr$(13) = Control-M
LF = Chr$(rcLF)
CR = Chr$(rcCR)
With Application
If .Connected = FALSE Then
.ConnectionType = "BEST-NETWORK"
.ConnectionSettings = "DefaultNetwork TELNET"
.ConnectionSettings = "Host xxx.xxx.xxx.xxx"
.ConnectionSettings = "TelnetPort 23"
.ConnectionSettings = "TelnetInitOptionNegotiation True"
'.ConnectionSettings = "TelnetTermType HP"
End If
If .Connected = FALSE Then
.Connect
End If
.StatusBar = "Waiting for Prompt: MPE/iX:"
.WaitForString "MPE/iX:", NEVER_TIME_OUT, rcAllowKeystrokes
.WaitForHostTrigger
.StatusBar = ""
.Transmit "hello " & myUserName & ",MANAGER.SYS" & CR
.DisplayRows = 40
End With
End Sub
' Recording stopped at 11:10:39.95.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|