On some games and programs they have a key code. Well how can i make my program ask for a keycode? please help
thanks!
Printable View
On some games and programs they have a key code. Well how can i make my program ask for a keycode? please help
thanks!
Code:Private Sub Form_Load()
Form1.Hide
KCODE = InputBox("Keycode: ", "Type Keycode here!", "Keycode here.")
If KCODE = "'place keycode # here." Then Form1.Show
If Form1.Visible = False Then MsgBox ("Sorry, Wrong Key!")
Unload Me
End Sub
It doesnt always need to be hidden. You could have a different variable change instead, but i used the visibility change as an easier variable change.
thanks is there also a way i can stop it from being copy?
yea, one sec.
I dont know how you could put this with your code for the Registration key, but i can show you how to detect if ctrl z is pressed.:Code:Private Sub Form_KeyDown(KeyCode As Integer, ctrl As Integer)
'which is keycode?
Debug.Print KeyCode
'now, when you press a key, you will see in immediate window the number....
If ctrl Then
If KeyCode = 90 Then
MsgBox "<ctrl><z> was pressed"
End If
End If
End Sub
thank i will figure it out
how do i make it so u only have to type it in once??
before asking for the code, check a registry location...if it is false then ask for the code. If it is true then skip the process.Code:dim GotCode as boolean
GotCode = GetSetting(App.Title, "Settings", "GotCode", False)
after the code has been entered correctly, write to the registry locationdoing this will cause the code process to be skipped if the code has been entered correctlyCode:SaveSetting(App.Title, "Settings", "GotCode", True)
kevin
Private Sub Command1_Click()
Dim GotCode As Boolean
GotCode = GetSetting(App.Title, "Settings", "GotCode", False)
If Text1.Text = "546" Then GoTo la1 Else GoTo no:
la1:
If Text2.Text = "879" Then GoTo la2 Else GoTo no:
la2:
If Text3.Text = "417" Then GoTo la3 Else GoTo no:
la3:
If Text4.Text = "639" Then GoTo la4 Else GoTo no:
la4:
Form1.Show
Form3.Hide
GetSetting(App.Title, "Settings", "GotCode", True)
GoTo end1:
no:
MsgBox "Access Deny.", vbOKOnly, "Dumbas*"
end1:
End Sub
Private Sub Form_Load()
If GotCode = True Then
Form1.Show
Form3.Hide
End If
End Sub
wat wrong??
What's wrong is that you are trying to stuff a string into a boolean variable...and it won't work.
Create another variable (string) to hold the value returned from GetSetting(), then check whether that variable = ""
IE
oh - and I think you'd be better off using a Select Case statement rather than a sh*tload of GoTo'sCode:Dim RetValue as string
RetValue = ""
RetValue = GetSetting(App.Title, "Settings", "GotCode", "")
If RetValue <> "" then
' put your code if the correct value is returned here
Else
' Put your code dealing with the no value returned here
End If
lol im only 11 and now starting vb6 (i know baTch html & javaS)
CodeErr,
Once you have read the value of GotCode (which is a Boolean and will be set or not set depending on the registry value of True or False) you have to test it in an if stataementin your code you read GotCode, but never check itCode:if not GotCode then
'put your key code stuff here
endif
kevin
tHaNks
i wish i had a forum like this when i was learning batch and stuff they took days to answer and most of the time they couldn't
I started coding when I was about 12, and back then they hadn't even discovered dirt yet.:D