This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Get just the domain from SdLogonUserInformation?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2011
11:54 AM
Get just the domain from SdLogonUserInformation?
I need to get just the domain name, not the domain\username back from this dialog? Is there an easy solution to this?
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2011
02:13 PM
So, I figured out a string way to get this, now I need the opposite but not sure how to:
Basically I get this:
DOMAIN\USERNAME
To get the domain I am doing this:
so:
sUserName = DOMAIN\USERNAME
sDomainOnly = DOMAIN
but I also need to pull out the Username as well, not sure how to get everything from the right of the "\" properly.
Basically I get this:
DOMAIN\USERNAME
To get the domain I am doing this:
// Get Domain Name
sCharacterRemove = "\\";
nResult = StrFindEx ( sUserName, sCharacterRemove, 0 );
if (nResult < 0) then
MessageBox("Domain Name not found, setup will abort.", SEVERE);
else
StrSub ( sDomainOnly, sUserName, 0, nResult );
endif;
so:
sUserName = DOMAIN\USERNAME
sDomainOnly = DOMAIN
but I also need to pull out the Username as well, not sure how to get everything from the right of the "\" properly.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2011
02:30 PM
Probably a crappy convoluted way, but here is what I got working:
// Get Domain Name
sCharacterRemove = "\\";
nResult = StrFindEx ( sUserName, sCharacterRemove, 0 );
if (nResult < 0) then
MessageBox("Domain Name not found, setup will abort.", SEVERE);
else
StrSub ( sDomainOnly, sUserName, 0, nResult );
endif;
// Get the Domain name length to use to get the User Name Below
nDomainLength = StrLengthChars (sDomainOnly);
// Add 1 to avoid the \
nDomainLength++;
// Get User Name
sCharacterRemove = "\\";
nResult = StrFindEx ( sUserName, sCharacterRemove, 0 );
if (nResult < 0) then
MessageBox("User Name not found, setup will abort.", SEVERE);
else
StrSub ( sUserNameOnly, sUserName, nDomainLength, nResult );
endif;