الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

how to login by default user and password for windows

بدأه مجـدى في 8 أكتوبر 2014 · 3 رد · 1,464 مشاهدة · في قسم قواعد البيانات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

hello,


 


i work at company in egypt, and i made program for maintenance department, my manager request that :-


 


 the program to run automatically by default user and password for windows ( it's  mean any user open his operating system "windows" can run this program without insert the user name and his password. same as Microsoft Office Outlook )


 


note that : the program is running at the server and database at the same of server and the user recall this program on his accounts by program shortcut in his desktop.


so, can any person help me


 


thanks


تم تعديل هذه المشاركة بواسطة مجـدى في 9 أكتوبر 2014 في 09:05

#2

please, any idea


تم تعديل هذه المشاركة بواسطة مجـدى في 3 نوفمبر 2014 في 17:01

#3

السلام عليكم

 

في حالتك المطلوب هو اسم المستخدم ولاداعي لكلمة المرور اي المفروض ان تعرف المستخدم الحالي وبعد ذلك تقارنه في الصلاحيات الموجودة عندك

للحصول على اسم المستخدم استخدم الكود التالي :

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long 

Declare Function LookupAccountName Lib "advapi32.dll" Alias "LookupAccountNameA" (lpSystemName As String, ByVal lpAccountName As String, sid As Any, cbSid As Long, ByVal ReferencedDomainName As String, cbReferencedDomainName As Long, peUse As Long) As Long

Private Sub Form_Load() 
Dim sDomainName As String * 255 
Dim lDomainNameLength As Long 
Dim sUserName as String
Dim bUserSid(255) As Byte 
Dim lSIDType As Long 

Rem Create a buffer
sUserName = String(100, Chr$(0)) 

Rem Get the username
GetUserName sUserName, 100 

Rem strip the rest of the buffer
sUserName = Left$(sUserName, InStr(sUserName, Chr$(0)) - 1)

rem Show the temppath and the username
MsgBox "Hello " + strUserName

lResult = LookupAccountName(vbNullString, sUserName, bUserSid(0), 255, sDomainName, lDomainNameLength, _
lSIDType)
if lResult <>0 then
msgbox sDomainName
end if
end sub

المصدر من هنا

 

اما اذا اردت ان تسجل الدخول للمستخدم فهو امر آخر وتجده هنا

 

 

وارجو الكتابة في المرات القادمة بالعربي لان المنتدى عربي ونحن عرب.

#4

بارك الله فيك اخى .

 

على هذا الحل . و السبب فى كتابتى له باللغه الانجليزيه هو اننى نشرت هذا الموضوع على موقع آخر و هو باللغه الانجليزيه فقمت بكتابته و نسخه فى موقعكم الموقر .

 

فعذراً آخى وسيراعى فى المشاركات القادمه ان شاء الله تعالى .

 

بارك الله فى الجميع

مواضيع مشابهة