Link to home
Start Free TrialLog in
Avatar of IUFITS
IUFITS

asked on

Network Username/Password Windows Host Model Scripting Object

I'd like to create a C++ .DLL that I can call from other environments (Powerbuilder namingly).  I need to get the user's domain and network username (not the windows username if it happens to be different than the network authentications in the case of VPN's for instance.  I've figured out a way to get what I want in VB with a reference to the Windows Host Model Scripting Object but I'm having a damned hard time using the ActiveX DLL in the traditional way windows DLL's are used (I know there's a way around it by writing a wrapper for the compiler but I haven't had time to do that).

Now, does anybody have a better way to accomplish this or can they show me an example of how to reference the windows scripting object from a C++ DLL.  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of nabehs
nabehs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IUFITS
IUFITS

ASKER

   On Local Error Resume Next
   
    Dim net As WshNetwork
    Dim username As String
    Set net = New WshNetwork

    username = net.UserDomain & "\" & net.username
    username = LCase(username)
   
    If Err.Number <> 0 Then
        username = ""
    Else
        MsgBox (username)
    End If