ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


2 posters

    โปรจำลองสุ่มเลขบัตรประชาชน

    avatar
    Fast
    PSsix Member Super Class III
    PSsix Member Super Class III


    โปรจำลองสุ่มเลขบัตรประชาชน Empty PSsix Program Coder
    จำนวนข้อความ : 217
    ความนิยม : 54
    เข้าร่วมเมื่อ : 19/06/2011

    โปรจำลองสุ่มเลขบัตรประชาชน Empty โปรจำลองสุ่มเลขบัตรประชาชน

    ตั้งหัวข้อ by Fast 09/03/12, 03:25 pm

    em218 ไม่ใช่เลขบัตรจริงนะครับ สุ่มตามหลักการตรวจเลขบัตร ดัดแปลงเอามาจาก [You must be registered and logged in to see this link.] ห้ามเอาไปทำผิดกฏหมายนะ



    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    $Form1 = GUICreate("โปรจำลองสุ่มเลขบัตร", 253, 109, 192, 124)
    $Button1 = GUICtrlCreateButton("สุ่มเลขใหม่", 40, 72, 75, 25)
    $Button2 = GUICtrlCreateButton("ก๊อป", 152, 72, 75, 25)
    $Input1 = GUICtrlCreateInput("", 16, 24, 217, 21)
    GUISetState(@SW_SHOW)
    GUICtrlSetData($Input1,RandomNum())

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUICtrlSetData($Input1,RandomNum())
    Case $Button2
    ClipPut(GUICtrlRead($Input1))
    MsgBox(64,"ก็อปเสร็จ","ก็อปเลข "&GUICtrlRead($Input1)&" ลงคลิปบอร์ด")
    EndSwitch
    WEnd


    Func RandomNum()
    $n1 = Random(0,9,1)
    $n2 = Random(0,9,1)
    $n3 = Random(0,9,1)
    $n4 = Random(0,9,1)
    $n5 = Random(0,9,1)
    $n6 = Random(0,9,1)
    $n7 = Random(0,9,1)
    $n8 = Random(0,9,1)
    $n9 = Random(0,9,1)
    $n10 = Random(0,9,1)
    $n11 = Random(0,9,1)
    $n12 = Random(0,9,1)

    $sumdigit = ($n1 * 13)+($n2 * 12)+($n3 * 11)+($n4 * 10)+($n5 * 9)+($n6 * 8)+($n7 * 7)+($n8 * 6)+($n9 * 5)+($n10 * 4)+($n11 * 3)+($n12 * 2)
    $snum = 11 - mod($sumdigit,11)

    if $snum =10 Then
    $digit1 = $n1&$n2&$n3&$n4&$n5&$n6&$n7&$n8&$n9&$n10&$n11&$n12&"0"
    ElseIf $snum =11 Then
    $digit1 = $n1&$n2&$n3&$n4&$n5&$n6&$n7&$n8&$n9&$n10&$n11&$n12&"1"
    Else
    $digit1 = $n1&$n2&$n3&$n4&$n5&$n6&$n7&$n8&$n9&$n10&$n11&$n12&$snum
    EndIf
    Return $digit1
    EndFunc
    rolovely
    rolovely
    PSsix Member Super Class II
    PSsix Member Super Class II


    PSsix Game Coder
    จำนวนข้อความ : 193
    ความนิยม : 26
    เข้าร่วมเมื่อ : 15/10/2010
    อายุ : 35
    ที่อยู่ : THAILAND

    โปรจำลองสุ่มเลขบัตรประชาชน Empty Re: โปรจำลองสุ่มเลขบัตรประชาชน

    ตั้งหัวข้อ by rolovely 25/12/13, 11:54 am

    ผมขอแก้ไขแทน เนื่องจากเลขบัตรตัวแรกมันห้ามใช้ 0 และ 9 เลยดัดแปรงให้นิดๆ

    Code:
    #include <GUIConstants.au3>
    $Form1 = GUICreate("โปรแกรมสุ่มเลขบัตรประจำตัวประชาชน", 387, 122, -1, -1)
    $Label1 = GUICtrlCreateLabel("สุ่มเลขบัตรประจำตัวประชาชน", 16, 8, 357, 41)
    GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("", 8, 56, 369, 21)
    $Button1 = GUICtrlCreateButton("สุ่มเลขบัตรประจำตัวประชาชน", 8, 88, 369, 25, 0)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUICtrlSetData($Input1,RandomNum())
    EndSwitch
    WEnd
    Func RandomNum()
      $n1 = Random(1,8,1)
      $n2 = Random(0,9,1)
      $n3 = Random(0,9,1)
      $n4 = Random(0,9,1)
      $n5 = Random(0,9,1)
      $n6 = Random(0,9,1)
      $n7 = Random(0,9,1)
      $n8 = Random(0,9,1)
      $n9 = Random(0,9,1)
      $n10 = Random(0,9,1)
      $n11 = Random(0,9,1)
      $n12 = Random(0,9,1)
      $sumdigit = ($n1 * 13)+($n2 * 12)+($n3 * 11)+($n4 * 10)+($n5 * 9)+($n6 * 8)+($n7 * 7)+($n8 * 6)+($n9 * 5)+($n10 * 4)+($n11 * 3)+($n12 * 2)
      $snum = 11 - mod($sumdigit,11)
      if $snum =10 Then
          $digit1 = $n1&$n2&$n3&$n4&$n5&$n6&$n7&$n8&$n9&$n10&$n11&$n12&"0"
      ElseIf $snum =11 Then
          $digit1 = $n1&$n2&$n3&$n4&$n5&$n6&$n7&$n8&$n9&$n10&$n11&$n12&"1"
      Else
          $digit1 = $n1&$n2&$n3&$n4&$n5&$n6&$n7&$n8&$n9&$n10&$n11&$n12&$snum
      EndIf
      Return $digit1
    EndFunc

      เวลาขณะนี้ 28/03/24, 02:57 pm