Originariamente inviato da unreg
salve,
ho questo compito:
Le istruzioni per creare il programma in VB sono queste:
-Aprite un progetto EXE Standard
-Creare un command1, un text1 e una label1
-Inserire un modulo
-Nel modulo inserire questo:
Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerial_Numberber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Public Const GETDI_SERIAL = 1
Function GetDriveInfo(strDrive As String, iType As Integer)
Dim Serial_Number As Long
Dim Drive_Label As String
Dim Fat_Type As String
Dim Return_Value As Long
Drive_Label = Space(256)
Fat_Type = Space(256)
Return_Value = GetVolumeInformation(strDrive, Drive_Label, Len(Drive_Label), Serial_Number, 0, 0, Fat_Type, Len(Fat_Type))
GetDriveInfo = CStr(Serial_Number)
End Function
-Nel codice inserire questo:
Private Sub Form_Load()
Label1.Caption = GetDriveInfo("C:\", GETDI_SERIAL) 'mostra nella label1 il serial del nostro HDD
End Sub
Private Sub Command1_Click()
directory = ("" & App.Path & "") + "zanna.x86" 'directory in cui si trova + zanna.x86
passw = Label1.Caption - 86 'prende il serial sottrae 86
passw = Left(passw, 9) 'poi prende in considerazione solo le prime 9 cifre partendo da sinistra
passw = passw * 8686 'moltiplica poi x 8686
passw = Right(passw, 6) 'considera solo le prime 6 cifre partendo da destra
If Text1.Text = passw Then 'se il text1 è = alla password corretta...
x = Shell(directory, 1) 'esegui il file zanna.x86...
Else 'altrimenti...
MsgBox "Errore" 'messaggio d'errore
Unload Me 'esce
End If
End Sub
çççççççççççççççççççççççççççççççççççççççççççççççççç ççççò
il problema è che mi da questo errore quando inserisco il codice esatto:
Run-time error '53':
file not found
come mai, cosa devo fare ?
:master: