-
September 28th, 2003, 03:49 PM
#1
Key code, How do i add my project a keycode
On some games and programs they have a key code. Well how can i make my program ask for a keycode? please help
thanks!
-
September 28th, 2003, 04:27 PM
#2
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
-squaK
-
September 28th, 2003, 04:28 PM
#3
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.
-squaK
-
September 28th, 2003, 04:43 PM
#4
thanks is there also a way i can stop it from being copy?
-
September 28th, 2003, 04:46 PM
#5
-
September 28th, 2003, 05:31 PM
#6
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
Last edited by squakMix; September 28th, 2003 at 05:33 PM.
-squaK
-
September 28th, 2003, 05:36 PM
#7
thank i will figure it out
-
September 29th, 2003, 05:25 PM
#8
how do i make it so u only have to type it in once??
-
September 29th, 2003, 05:33 PM
#9
before asking for the code, check a registry location...
Code:
dim GotCode as boolean
GotCode = GetSetting(App.Title, "Settings", "GotCode", False)
if it is false then ask for the code. If it is true then skip the process.
after the code has been entered correctly, write to the registry location
Code:
SaveSetting(App.Title, "Settings", "GotCode", True)
doing this will cause the code process to be skipped if the code has been entered correctly
kevin
Thank you for your support.
-Bartyles & James (circa 1980)
If it helps, rate it
if it doesn't, well....I tried
Check out Windows Embedded XP. It's XP compontnetized: add only the components you need to build an OS
And in knowing that you know nothing, that makes you the smartest of all.
- Socrates (469 BC - 399 BC)
-
September 29th, 2003, 05:52 PM
#10
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??
-
September 29th, 2003, 06:03 PM
#11
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
Code:
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
oh - and I think you'd be better off using a Select Case statement rather than a sh*tload of GoTo's
Be nice to Harley riders...
-
September 29th, 2003, 06:09 PM
#12
lol im only 11 and now starting vb6 (i know baTch html & javaS)
-
September 29th, 2003, 06:11 PM
#13
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 stataement
Code:
if not GotCode then
'put your key code stuff here
endif
in your code you read GotCode, but never check it
kevin
Thank you for your support.
-Bartyles & James (circa 1980)
If it helps, rate it
if it doesn't, well....I tried
Check out Windows Embedded XP. It's XP compontnetized: add only the components you need to build an OS
And in knowing that you know nothing, that makes you the smartest of all.
- Socrates (469 BC - 399 BC)
-
September 29th, 2003, 06:19 PM
#14
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
-
September 29th, 2003, 06:22 PM
#15
I started coding when I was about 12, and back then they hadn't even discovered dirt yet.
Thank you for your support.
-Bartyles & James (circa 1980)
If it helps, rate it
if it doesn't, well....I tried
Check out Windows Embedded XP. It's XP compontnetized: add only the components you need to build an OS
And in knowing that you know nothing, that makes you the smartest of all.
- Socrates (469 BC - 399 BC)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|