Home All Groups Group Topic Archive Search About

Determine disabled status

Author
16 Feb 2006 9:08 AM
James
vb.net 2003

i read the msdn documentation on Const ADS_UF_ACCOUNTDISABLE = &H2

how do i use the above to determine whether my account is disabled ? The
following does not work.

select case userAccountControl
    case ADS_UF_ACCOUNTDISABLE
        console.write ("account is disable")
    etc etc et
end

Author
16 Feb 2006 10:17 AM
Larry Lard
James wrote:
> vb.net 2003
>
> i read the msdn documentation on Const ADS_UF_ACCOUNTDISABLE = &H2
>
> how do i use the above to determine whether my account is disabled ? The
> following does not work.
>
> select case userAccountControl
>     case ADS_UF_ACCOUNTDISABLE
>         console.write ("account is disable")
>     etc etc et
> end

The docs indicate that this value is one member of a *flags* type enum,
so each value is a bitflag. Try

If (userAccountControl And ADS_UF_ACCOUNTDISABLE) =
ADS_UF_ACCOUNTDISABLE Then
    'account is disabled
End If

(for example, 2, 42, 166, 1048578 are all possible values of
userAccountControl that have this flag set, so testing for equality
won't always work)

--
Larry Lard
Replies to group please
Author
16 Feb 2006 10:33 AM
Armin Zingler
"James" <jkk***@hotmail.com> schrieb
> vb.net 2003
>
> i read the msdn documentation on Const ADS_UF_ACCOUNTDISABLE = &H2
>
> how do i use the above to determine whether my account is disabled ?
> The following does not work.
>
> select case userAccountControl
>    case ADS_UF_ACCOUNTDISABLE
>        console.write ("account is disable")
>    etc etc et
> end

You found it in the MSDN documentation. If you use it's search function (for
ADS_UF_ACCOUNTDISABLE), I get 7 search results. There's also an example in
VB(6). That's what I would read first.

Armin