Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option explicit module level

Status
Not open for further replies.

Quickie67

Technical User
Dec 19, 2001
6
US
I'm pretty new at this so if you will just hang in there I will try to explain this as best as i can. I downloaded a password exe off the net someone else somehow decompiled it. I thought that I would see if I could make one for fun and use the code from the other one as a guide. well I have the form all made out but when i look at the code for the other it has option explicit in it and i looked at the MSDN library and all it said was what it was and that it was inside the module level. Whats the module level? How do I add that in or where? heres the code from the other one so that you can get an idea of what im doing

Code:
' LEVEL5.FRM
Option Explicit
Const mc001A = &quot;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.,:;-*+=~|&!_$#@()[]{}<\/>&quot;
Const mc001E = &quot;[URL unfurl="true"]http://www.try2hack.f2s.com/login-level6.html&quot;[/URL]

Sub chkHidePwd_Click()
If chkHidePwd.Value = 0 Then
    txtPassword.PasswordChar = &quot;&quot;
Else
    txtPassword.PasswordChar = &quot;*&quot;
End If
End Sub

Sub cmdLogin_Click()
Dim l003C As String
Dim l003E As Variant
If txtUsername <> Mid(mc001A, 56, 1) & Mid(mc001A, 28, 1) & Mid(mc001A, 35, 1) & Mid(mc001A, 3, 1) & Mid(mc001A, 44, 1) & Mid(mc001A, 11, 1) & Mid(mc001A, 13, 1) & Mid(mc001A, 21, 1) Then
    MsgBox &quot;Username not accepted.&quot;
    Exit Sub
End If
If txtPassword <> Mid(mc001A, 51, 1) & Mid(mc001A, 31, 1) & Mid(mc001A, 30, 1) & Mid(mc001A, 51, 1) & Mid(mc001A, 16, 1) & Mid(mc001A, 45, 1) & Mid(mc001A, 24, 1) & Mid(mc001A, 29, 1) & Mid(mc001A, 26, 1) & Mid(mc001A, 19, 1) & Mid(mc001A, 28, 1) & Mid(mc001A, 11, 1) & Mid(mc001A, 30, 1) & Mid(mc001A, 19, 1) & Mid(mc001A, 25, 1) & Mid(mc001A, 24, 1) Then
    MsgBox &quot;Username/Password don't match.&quot;
Else
    MsgBox &quot;User logged in !&quot;
    l003C$ = Left$(mc001E, 28) & Mid(mc001A, 22, 1) & Mid(mc001A, 67, 1) & Mid(mc001A, 15, 1) & Mid(mc001A, 67, 1) & Mid(mc001A, 32, 1) & Mid(mc001A, 67, 1) & Mid(mc001A, 15, 1) & Mid(mc001A, 67, 1) & Mid(mc001A, 22, 1) & Mid(mc001A, 67, 1) & Mid(mc001A, 7, 1) & Mid(mc001A, 63, 1) & Mid(mc001A, 18, 1) & Mid(mc001A, 30, 1) & Mid(mc001A, 23, 1) & Mid(mc001A, 22, 1)
    MsgBox &quot;For Windows NT / Windows 2000 users :&quot; & Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) & l003C$
    l003E = Shell(&quot;start &quot; & l003C$)
End If
End Sub

Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub

Thanks
Quickie67
 
A module in VB 6 is a file containing Form, Bas or Class definitions and code. Option Explicit prevents you from using a variable without defining it (exception is Redim without Preserve).
Go to Tools / Options / Editor and check Require Variable Declaration. While you are there, uncheck Auto Syntax Check to get rid of MsgBox when moving from a line that has a syntax error. The entire statement is RED anyway. Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top