اذهب الي المحتوي
أوفيسنا

إزالة اشارة الصح من خانة الاختيار بكلمة مرور


mr steev

الردود الموصى بها

السلام عليكم 

 

ضع هذا الكود في محرر أكواد الفورم 


Private Sub Finish_AfterUpdate()

If Me.Finish.Value = 0 Then
If InputBox("ضع كلمة المرور", "تنبيه") = "123" Then
Me.Finish.Value = 0
Else
Me.Finish.Value = -1
Exit Sub
End If
End If
End Sub
رابط هذا التعليق
شارك

  • 2 weeks later...

حيا الله الشباب  :smile:

 

ايش رايك في كلمة سر متغيرة smile.png

يعني مافي داعي تخاف احد يشوفها ، لأنها تتغير دائماً كل دقيقة smile.png

 

استعمل هذا الكود مثلاً:

    p1 = InputBox("insert Password", Format(Now(), "dddd dd-mm-yyyy hh:mm:ss am/pm"))
    p2 = Format(Hour(Now()) + Minute(Now()), "0000")' & "," & Format(Day(Now()) + Month(Now()), "0000")
    'MsgBox Format(Now(), "dddd dd-mm-yyyy hh:mm:ss am/pm") & vbCrLf & _
           Format(Hour(Now()) + Minute(Now()), "0000") & "," & Format(Day(Now()) + Month(Now()), "0000")
           
    If p1 = p2 Then
        MsgBox "OK"
    Else
        MsgBox "NG"
    End If

كلمة السر هي:

تجمع الساعة في الوقت الحالي (الساعة نظام 24 ساعة) + الدقيقة ،

والجواب يكون بصيغة 4 ارقام ،

مثلا الساعة الآن 5 العصر و26 دقيقة ،

اولا نحول الساعة الى نظام 24 ساعة: 5+12 = 17

17 + 26 = 43

اذاً كلمة السر هي 0043

 

وطبعا تقدر انك تغير الكود وتدخل اول حروف اليوم مثلا و .....

 

جعفر

  • Like 3
رابط هذا التعليق
شارك

عندك طريقتين لعمله:

 

1. تعمل نموذج صغير بحقل واحد لإدخال كلمة السر ، والحقل يكون له "قناع ادخال" "input mask" وهو password ،

والمرفق فيه هذا النموذج جاهزا  :smile:

 

 

2. والطريقة الثانية انك تضع هذا الكود في وحدة النمطية:

Option Explicit

'////////////////////////////////////////////////////////////////////
'Password masked inputbox
'Allows you to hide characters entered in a VBA Inputbox.
'
'Code written by Daniel Klann
'http://www.danielklann.com/
'March 2003

'// Kindly permitted to be amended
'// Amended by Ivan F Moala
'// http://www.xcelfiles.com
'// April 2003
'// Works for Xl2000+ due the AddressOf Operator
'////////////////////////////////////////////////////////////////////

'********************   CALL FROM FORM *********************************
'    Dim pwd As String
'
'    pwd = InputBoxDK("Please Enter Password Below!", "Database Administration Security Form.")
'
'    'If no password was entered.
'    If pwd = "" Then
'        MsgBox "You didn't enter a password!  You must enter password to 'enter the Administration Screen!" _
'        , vbInformation, "Security Warning"
'    End If
'**************************************



'API functions to be used
Private Declare Function CallNextHookEx _
    Lib "user32" ( _
    ByVal hHook As Long, _
    ByVal ncode As Long, _
    ByVal wParam As Long, _
    lParam As Any) _
As Long

Private Declare Function GetModuleHandle _
    Lib "kernel32" _
    Alias "GetModuleHandleA" ( _
    ByVal lpModuleName As String) _
As Long

Private Declare Function SetWindowsHookEx _
    Lib "user32" _
    Alias "SetWindowsHookExA" ( _
    ByVal idHook As Long, _
    ByVal lpfn As Long, _
    ByVal hmod As Long, _
    ByVal dwThreadId As Long) _
As Long

Private Declare Function UnhookWindowsHookEx _
    Lib "user32" ( _
    ByVal hHook As Long) _
As Long

Private Declare Function SendDlgItemMessage _
    Lib "user32" Alias "SendDlgItemMessageA" ( _
    ByVal hDlg As Long, _
    ByVal nIDDlgItem As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    ByVal lParam As Long) _
As Long

Private Declare Function GetClassName _
    Lib "user32" _
    Alias "GetClassNameA" ( _
    ByVal hWnd As Long, _
    ByVal lpClassName As String, _
    ByVal nMaxCount As Long) _
As Long

Private Declare Function GetCurrentThreadId _
    Lib "kernel32" () _
As Long

'Constants to be used in our API functions
Private Const EM_SETPASSWORDCHAR = &HCC
Private Const WH_CBT = 5
Private Const HCBT_ACTIVATE = 5
Private Const HC_ACTION = 0

Private hHook As Long

Public Function NewProc(ByVal lngCode As Long, _
                        ByVal wParam As Long, _
                        ByVal lParam As Long) As Long

Dim RetVal
Dim strClassName As String, lngBuffer As Long

If lngCode < HC_ACTION Then
    NewProc = CallNextHookEx(hHook, lngCode, wParam, lParam)
    Exit Function
End If

strClassName = String$(256, " ")
lngBuffer = 255

If lngCode = HCBT_ACTIVATE Then    'A window has been activated
    RetVal = GetClassName(wParam, strClassName, lngBuffer)
    If Left$(strClassName, RetVal) = "#32770" Then  'Class name of the Inputbox
        'This changes the edit control so that it display the password character *.
        'You can change the Asc("*") as you please.
        SendDlgItemMessage wParam, &H1324, EM_SETPASSWORDCHAR, Asc("*"), &H0
    End If
End If
    
'This line will ensure that any other hooks that may be in place are
'called correctly.
CallNextHookEx hHook, lngCode, wParam, lParam

End Function

'// Make it public = avail to ALL Modules
'// Lets simulate the VBA Input Function
Public Function InputBoxDK(Prompt As String, Optional Title As String, _
            Optional Default As String, _
            Optional Xpos As Long, _
            Optional Ypos As Long, _
            Optional Helpfile As String, _
            Optional Context As Long) As String
    
Dim lngModHwnd As Long, lngThreadID As Long
    
'// Lets handle any Errors JIC! due to HookProc> App hang!
On Error GoTo ExitProperly
lngThreadID = GetCurrentThreadId
lngModHwnd = GetModuleHandle(vbNullString)
    
hHook = SetWindowsHookEx(WH_CBT, AddressOf NewProc, lngModHwnd, lngThreadID)
If Xpos Then
    InputBoxDK = InputBox(Prompt, Title, Default, Xpos, Ypos, Helpfile, Context)
Else
    InputBoxDK = InputBox(Prompt, Title, Default, , , Helpfile, Context)
End If

ExitProperly:
UnhookWindowsHookEx hHook

End Function

Sub TestDKInputBox()
Dim x

x = InputBoxDK("Type your password here.", "Password Required")
If x = "" Then End
If x <> "yourpassword" Then
    MsgBox "You didn't enter a correct password."
    End
End If

MsgBox "Welcome Creator!", vbExclamation
    
End Sub

وتنادي الكود هكذا

    Dim pwd As String

    pwd = InputBoxDK("Please Enter Password Below!", "Database Administration Security Form.")

    'If no password was entered.
    If pwd = "" Then
        MsgBox "You didn't enter a password!  You must enter password to 'enter the Administration Screen!" _
        , vbInformation, "Security Warning"
    End If

جعفر

23.PassWordBox.mdb.zip

  • Like 1
رابط هذا التعليق
شارك

حيا الله الشباب  :smile:

 

ايش رايك في كلمة سر متغيرة smile.png

يعني مافي داعي تخاف احد يشوفها ، لأنها تتغير دائماً كل دقيقة smile.png

 

استعمل هذا الكود مثلاً:

    p1 = InputBox("insert Password", Format(Now(), "dddd dd-mm-yyyy hh:mm:ss am/pm"))
    p2 = Format(Hour(Now()) + Minute(Now()), "0000")' & "," & Format(Day(Now()) + Month(Now()), "0000")
    'MsgBox Format(Now(), "dddd dd-mm-yyyy hh:mm:ss am/pm") & vbCrLf & _
           Format(Hour(Now()) + Minute(Now()), "0000") & "," & Format(Day(Now()) + Month(Now()), "0000")
           
    If p1 = p2 Then
        MsgBox "OK"
    Else
        MsgBox "NG"
    End If

كلمة السر هي:

تجمع الساعة في الوقت الحالي (الساعة نظام 24 ساعة) + الدقيقة ،

والجواب يكون بصيغة 4 ارقام ،

مثلا الساعة الآن 5 العصر و26 دقيقة ،

اولا نحول الساعة الى نظام 24 ساعة: 5+12 = 17

17 + 26 = 43

اذاً كلمة السر هي 0043

 

وطبعا تقدر انك تغير الكود وتدخل اول حروف اليوم مثلا و .....

 

جعفر

 

 تحفة ،،،  :signthankspin: 

  • Like 2
رابط هذا التعليق
شارك

 

حيا الله الشباب  :smile:

 

ايش رايك في كلمة سر متغيرة smile.png

يعني مافي داعي تخاف احد يشوفها ، لأنها تتغير دائماً كل دقيقة smile.png

 

استعمل هذا الكود مثلاً:

    p1 = InputBox("insert Password", Format(Now(), "dddd dd-mm-yyyy hh:mm:ss am/pm"))
    p2 = Format(Hour(Now()) + Minute(Now()), "0000")' & "," & Format(Day(Now()) + Month(Now()), "0000")
    'MsgBox Format(Now(), "dddd dd-mm-yyyy hh:mm:ss am/pm") & vbCrLf & _
           Format(Hour(Now()) + Minute(Now()), "0000") & "," & Format(Day(Now()) + Month(Now()), "0000")
           
    If p1 = p2 Then
        MsgBox "OK"
    Else
        MsgBox "NG"
    End If

كلمة السر هي:

تجمع الساعة في الوقت الحالي (الساعة نظام 24 ساعة) + الدقيقة ،

والجواب يكون بصيغة 4 ارقام ،

مثلا الساعة الآن 5 العصر و26 دقيقة ،

اولا نحول الساعة الى نظام 24 ساعة: 5+12 = 17

17 + 26 = 43

اذاً كلمة السر هي 0043

 

وطبعا تقدر انك تغير الكود وتدخل اول حروف اليوم مثلا و .....

 

جعفر

 

 تحفة ،،،  :signthankspin: 

 

السلام عليكم ورحمة الله تعالى وبركاته

انا عملت نموذج بس ممكن حضرتك تقول ازاى اقدر اضيف اليوم

 

يعنى ايه التعديلات اللى ممكن تتعمل على الكود وازى ؟

test.rar

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information