Генератор паролей
Данный генератор паролей был написан мною на другом языке программирования.
Адаптировал под Freebasic. Пример хорош для новичков и показывает ценность
оператора DATA. Нужна библиотека window9.
Платформы:
Windows
Автор: Станислав Будинов, создано в 2011 году.
#INCLUDE "window9.bi" Dim Shared As String simvol,sohr Dim Shared As HFONT FontID1,FontID2 Dim As Integer sp=10 ,y,b,event,rez1,rez2,rez3 Enum Editor_0 Button_0 Button_1 Button_2 CheckBox_0 CheckBox_1 CheckBox_2 Text_0 Text_1 Text_2 spin End Enum FontID1 = LoadFont("Arial", 10) FontID2 = LoadFont("Arial", 8) OpenWindow("Генератор паролей", 400, 214, 288, 151) EditorGadget(Editor_0, 10, 15, 150, 35) ButtonGadget(Button_0, 175, 15, 95, 20, "Сгенерить") ButtonGadget(Button_1, 175, 45, 95, 32, "Скопировать пароль",BS_MULTILINE) ButtonGadget(Button_2, 250, 85, 15, 15, "?") CheckBoxGadget(CheckBox_0, 15, 55, 20, 20, "") CheckBoxGadget(CheckBox_1, 50, 50, 15, 30, "") CheckBoxGadget(CheckBox_2, 85, 55, 20, 20, "") TextGadget(Text_0, 15, 80, 15, 20, "ab") TextGadget(Text_1, 50, 80, 15, 15, "AB") TextGadget(Text_2, 85, 80, 15, 15, "12") SpinGadget(spin, 120, 57, 40, 20, 0, 100,10) Randomize Timer Do Event = WaitEvent() If Event = EventGadget Then Select Case EventNumber Case Button_0 rez1 = GetGadgetState(CheckBox_0) rez2 = GetGadgetState(CheckBox_1) rez3 = GetGadgetState(CheckBox_2) If rez1+rez2+rez3=0 Then Messbox("Сообщение","Выберите пожалуйста символы для вашего пароля") sohr="" Else sp = GetGadgetState(spin) If rez1+rez2+rez3=3 Then y=0 b=62 Elseif rez1+rez2=2 Then y=1 b=52 Elseif rez1+rez3=2 Then y=3 b=36 Elseif rez2+rez3=2 Then y=4 b=36 Elseif rez1=1 Then y=2 b=26 Elseif rez2=1 Then y=5 b=26 Elseif rez3=1 Then y=6 b=10 Endif sohr="" For gl As Integer=1 To sp Select Case y Case 0 Restore StringData Case 1 Restore StringData1 Case 2 Restore StringData2 Case 3 Restore StringData3 Case 4 Restore StringData4 Case 5 Restore StringData5 Case 6 Restore StringData6 End Select Dim d As Integer=int(b*Rnd) For x As Integer=0 To d Read simvol Next sohr+=simvol Next SetGadgetText(Editor_0,sohr) Endif Case Button_1 SetClipboardText(sohr) Case Button_2 Messbox("О программе", "Автор Станислав Будинов") End Select Endif Loop Until Event=EventClose StringData: Data "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9" StringData1: Data "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" StringData2: Data "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z" StringData3: Data "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9" StringData4: Data "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9" StringData5: Data "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" StringData6: Data "0","1","2","3","4","5","6","7","8","9"