Thanks Ken,
That is too easy!
What about a File Open/ File Save Box Dialogue Box?
I used always call that as an API, is there a Namespace solution for that?
Also can you recommend best way to really get up to speed with all these
changes?
Doug
"Ken Tucker [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> No need for an api call anymore. Take a look at the environment
and
> systeminformation classes.
>
> Trace.WriteLine(Environment.UserName)
>
> Trace.WriteLine(Environment.MachineName)
>
> Trace.WriteLine(SystemInformation.UserName)
>
> Trace.WriteLine(SystemInformation.ComputerName)
>
>
>
> Ken
>
> -------------------
>
> "Doug Bell" <dug@bigpond> wrote in message
> news:(E-Mail Removed)...
> Hi
> In VB I used to call a Windows API from VB to get the User's Name and
> Workstation Name
>
> I have just started to try and pick up some Dot Net by rewriting one of my
> small Applications and I can't see how to invoke these calls in Dot Net.
>
> Declare Function GetComputerName Lib "kernel32" Alias _
> "GetComputerNameA" (ByVal lpBuffer As String, nSize As
Long)
> As Long
>
> Declare Function GetUserName Lib "advapi32.dll" Alias _
> "GetUserNameA" (ByVal pBuffer As String, nSize As
> Long) As Long
>
>
> Function dacUser() As String
> If Len(gstrUserName) = 0 Then
> Dim stUser As String
> Dim lngCnt As Long, lngDL As Long
> Dim sngPos As Single
> lngCnt = 199
> stUser = String(200, 0)
> lngDL = GetUserName(stUser, lngCnt)
> stUser = Left(stUser, lngCnt) & lngCnt
> sngPos = InStr(1, stUser, Chr(0))
> If sngPos > 0 Then
> gstrUserName = Left(stUser, sngPos - 1)
> End If
> End If
> dacUser = gstrUserName
> End Function
>
> I tried replacing String with StrDup but can't get it to work
>
> Can someone help?
>
>
>
|