|
-
Mar 21st, 2004, 11:09 PM
#1
Thread Starter
Member
How to get the active directory out
I currently have a program in the PC. I want to be able to take in the username and password when he login to the PC and check if he is able to access my program. Only administrator is able to access it so I want to prevent people with user domain from running my program.
How can I do it.
Please provide some sample codes if possible.
Thanks
-
Mar 22nd, 2004, 05:29 AM
#2
PowerPoster
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
retVal = GetuserName(uName, 255)
if nName= "Admin" then do your thing
-
Mar 22nd, 2004, 07:51 PM
#3
Thread Starter
Member
actually, I want to get the domain too but do not know the code. Please help.
-
Mar 22nd, 2004, 08:43 PM
#4
You say that you want to "prevent people with user domain from
running my program." if you mean users that are in the Domain
Users group then I'm not sure, but if you mean that you just
want to get the available domains then try my code in this thread.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 22nd, 2004, 08:45 PM
#5
Thread Starter
Member
And in addition, I have put a login page at my program.This is because in case my administrator is careless and forget to logout of the window, and a user try to use the program. I want to stop the user from accessing the program. This program is suppose to be usable my administrator only.The domain in the window which I want to use to compare if the person using the program is from the admin domain.
Thanks
Last edited by snowei1; Mar 22nd, 2004 at 08:49 PM.
-
Mar 22nd, 2004, 08:58 PM
#6
Then you are talking about detecting the user anme and what
group it is a member of.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 22nd, 2004, 09:03 PM
#7
If you search the forums you usually can find an answer.
Try this thread.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|