Good spotting, can't beleive my self sometimes..
I must be working to hard..
Chris
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of McKenzie, Paul
Sent: Monday, July 26, 1999 1:35 PM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: UserName from Delphi/VB/ and COM Controls
You don't appear to be setting the Size (eg. Size := 64) - you do in the VB
(lSize = Len(sBuffer)).
HTH
Regards
Paul
[EMAIL PROTECTED]
(Wellington - New Zealand)
¤> -----Original Message-----
¤> From: Chris Crowe [mailto:[EMAIL PROTECTED]]
¤> Sent: Monday, 26 July 1999 01:30 PM
¤> To: Multiple recipients of list delphi
¤> Subject: [DUG]: UserName from Delphi/VB/ and COM Controls
¤>
¤>
¤> var
¤> Buffer : Array[0..255] of char;
¤> Size : DWORD;
¤> begin
¤> GetUserName(Buffer, Size);
¤> ShowMessage('The username is "'+StrPas(Buffer)+'"');
¤> end;
¤>
¤> If I run the bit of code above in Delphi I get the current
¤> user account that
¤> I am logged in as. Say "Administrator"
¤>
¤> If I move that code to a COM Control; below is my code
¤>
¤> var
¤> Buffer : Array[0..255] of char;
¤> Size : DWORD;
¤> begin
¤> GetUserName(Buffer, Size);
¤> m_scriptContext.Response.Write('<P><P>This script is
¤> running under the
¤> "'+StrPas(Buffer)+'" account</P><P>');
¤> end;
¤>
¤> I then run it from a ASP Page I get an output of
¤>
¤> This script is running under the "hj4e" account
¤>
¤> Any ideas? I do not have an account called "hj4e", I would
¤> expect it to use
¤> "INET_ADROCK" since adrock is the server's name.
¤>
¤> If I set the DELPHI Com control to run under MTS and to
¤> force it to use a
¤> specific user account say ADMINISTRATOR, it still returns
¤> the same output.
¤>
¤> This script is running under the "hj4e" account
¤>
¤> I did the same running test uses a VB COM Control.
¤>
¤> Public Property Get UserName() As Variant
¤> Dim sBuffer As String
¤> Dim lSize As Long
¤> sBuffer = Space$(255)
¤> lSize = Len(sBuffer)
¤> Call GetUserName(sBuffer, lSize)
¤> UserName = "The username that this component is
¤> running in is " +
¤> Left$(sBuffer, lSize)
¤> End Property
¤>
¤> The username that this component is running in is "INET_ADROCK"
¤>
¤> And when I put it into MTS and force it to use the
¤> ADMINISTRATOR account I
¤> get
¤>
¤> The username that this component is running in is "Administrator"
¤>
¤> How come I do not get the same from the Delphi COM Control?
¤>
¤> Chris
¤>
¤> -------------------------------------------------------------
¤> --------------
¤> New Zealand Delphi Users group - Delphi List -
¤> [EMAIL PROTECTED]
¤> Website: http://www.delphi.org.nz
¤>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz