|
Hi there,
I have a prolem which is quite annoying which one of you right people might be able to tell me how to do very simply
I have a program which i have nearly completed, but to stop piracy i am having a txt file which reads the data from the program to see if the serial number is correct. HOWEVER i got so far however when the serial number is inputted "form2" is loaded and that works fine, but when i reload the program i don't want the CD key login form to re-appear. The form2 appears but in a flash (I have a slow computer so nottice that it is a form2). I have tried editing all aspects of the code but if any body could help me that would be cool
Here is the code if you want to look at it.
I used 1 button
1 text box
1 check box - supposed to be that if this is checked that it doesn't show this form
1 label
1 txt document in the debug\bin\labeled serial.txt
Public Class Form1
Dim FILE_NAME As String = ("serial.txt")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do Until objReader.EndOfStream
If txtserial.Text = objReader.ReadLine Then
Startnot.Checked = False
Form2.Show()
Me.Hide()
Else
Try
If txtserial.Text = objReader.ReadLine.Trim Then
End If
Catch Ex As Exception
End Try
Label1.Text = "Invalid CDKey"
End If
Loop
objReader.Close()
End Sub
Private Sub Form1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
If Me.Visible = False Then
Form2.Show()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetAttr(FILE_NAME, FileAttribute.Normal)
Dim Dontshow As Boolean
Dontshow = GetSetting(My.Application.Info.ProductName, "Options", "Dont Show Me", 1)
If Dontshow = 0 Then
Form2.Show()
Call cookies()
Exit Sub
End If
Startnot.Checked = True
End Sub
Private Sub Startnot_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Startnot.CheckedChanged
SaveSetting(My.Application.Info.ProductName, "Options", "Dont Show Me", Startnot.CheckState)
End Sub
Private Sub cookies()
Me.Close()
My.Forms.Form2.Show()
End Sub
End Class
|
|
|
|
|
Let me get this straight. Your putting the CDKey that the user has to input into a text file and shipping that with the application. When the user launches the app, they have to type the key in and that is compared to the key in the text file to see if the program will run. Do I have that correct??
|
|
|
|
|
Yes. There will already be serial keys in the .txt file e.g BC3 and if the user puts in BC4 that will b compared to the .txt file and bring back an error message saying. Nope were not letting you in.....
|
|
|
|
|
This is a complete waste of time. What's to stop the user from opening the text file in Notepad and entering what's in the text file?? Hint: Nothing!
Also, if the user want to copy the app to another machine without buying another copy, there is nothing stopping the user from copying the serial number file he already has!
Your copy protection scheme is never going to work.
|
|
|
|
|
Ummm yeah it will work cos i have another idea incorprating the code.
All i wanted was a bit of help with the code to try and get half of it working as I was struggaling!!!
|
|
|
|
|
Think about it. I asked for some help. I just wanted someone to help me to fix the code.
If this sounds any better i would like a program incorpating the code which is SIMULAR to a CD key login, my current code works however when the key is pressed in the first time the next form is displayed howver i want it so that when the program is run again the "next form" appears straight away rather than running through the cd key log in
I think its better to learn more complex things than being told NOPE it won't work there nothing to stop blah blah blah. Microsoft haven't stopped piracy and neither can i, but i can make it harder for people
|
|
|
|
|
I agree and I will audit your code for you and see where you made mistakes, but sometimes it is better to abandon your current design and implement something more complex which will not only improve your current situation but provide better security for your future projects.
Application designs can change and are often the most complex part of a project, if the people here tell you that maybe you should be looking at something else it is because of the experience this community has.
See my post below for a different suggestion, if you persist to go about this message let me know and I will start to go through the code. I highly suggest you consider different alternatives, at the very least encrypt your cd key..
|
|
|
|
|
I have to agree with Dave on this one, what's to stop the user from reading the CD key from a plain text file? I do not see any encryption or decryption, which still doesn't guarantee security..
|
|
|
|
|
ok its not the strongest of programs but i just wanted to get this let app working?
You could always hide the text file?!?
|
|
|
|
|
At that point you're better of just having a const string in your code with the cdkey instead of putting it in plain site...
Why not have an algorithm that generates keys based off an email or username, something a little more complex but a hell of a lot more secure then saving a cdkey in a text file.
|
|
|
|
|
if im being perfectly honest. Im not a great programer and it took a little while generating teh code for the cd login. Can you help just to get it right? It doesn't other me that its not the most secure, i can learn these things later on
|
|
|
|
|
So what? You can always unhide it. Just because the file is tagged Hidden, doesn't mean it's really hidden.
You'd have to put the test file somewhere else, and even then, there are simple tools out there that can watch your app and see every single file that your app touches.
Using a key in a file is useless because the file can always be copied to another machine. You're not preventing anything from running by putting a key in a file. Using your current method, all you're really doing is making your app more inconvenient to use for your users, nothing more. You're not providing any security at all.
The security has to be tied to the machine somehow, not to a file.
|
|
|
|
|
yeah i know the application i am designing this program for is for kids that don't really know a lot about computers and unhiding and hiding files, so you can see where i am coming from hopefully.
Is ther any way you could have a look at my code so you can see what the problem is and hopefully come up with a solution
Thanks for all the solutions you've given me but i'd like to stick with this due to the explanation above.
|
|
|
|
|
I'd start by scrapping what you have and replacing it with a seperate class. You main form should call this class, call it "Licensing", to ask if it is OK to run the app. The Licensing class has to do a few things to answer this question.
First, it has to check to see if the app has already been through the CDKey entry process and that a valid Key was entered. This could be a value written to the registry or to your AppSettings file.
If the value doesn't exist or it indicates that the license is not valid, this class would put up a new form, or even just an InputBox, asking for the CD key. Once the key is entered, it is compared against the first line of the serial.txt file. If they match, then you create/update the value tracking this in the Registry or your AppSettings file. If not, then Licensing doesn't change anything and returns False to say that it is not OK to run the app.
If the value is OK, then the method in your Licensing class would just return True to say that it is OK to run the app. There's no need to put up the CD Key entry form again.
You can get the first line of the file using:
Dim keyInFile As String
...
Using sr As New StreamReader(Path.Combine(Application.StartupPath), "serial.txt"))
keyInFile = fs.ReadLine()
End Using
|
|
|
|
|
You can't make this up. The good news is, this is a fair sign that no-one is going to steal his code....
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yeah, pretty much. He says he targeting the kids with the protection scheme, when it should be directed at the parents, if anyone at all.
|
|
|
|
|
Perhaps it would be easier to do things backwards. Make form2 the main form of your program, and then if the user hasn't entered the serial yet, show form1 using the .ShowDialog and don't let them close form1 until they enter the serial or exit the entire application.
Just a thought.
|
|
|
|
|
most of the application works apart from when the form reloads. I want the app to load form2 rather than having to go back on to form 1 (the serail key login)
|
|
|
|
|
Hello there,
How can i print two crystal report pages on a single paper without user intervention?
thanks,
|
|
|
|
|
Are you speaking of the capability of some printers to print 2 page images side by side on a single sheet ? If so, then you would need to configure the printer ahead of time, then send the report to that printer.
Maybe I don't understand your question.
|
|
|
|
|
You could display your own print dialog and manually code to print more than one report. But this doesn't put two reports on the same page. Are you asking for them to be on the same page or just to print two different reports at the same time?
|
|
|
|
|
No, i am not looking for how to manually display my printer to print two pages on a single page. Rather I want to Send two crystal report pages say 1-2 to my default printer as a single paper document,ie, the two pages will be put on a single page output from my application before starting the print operation. is that possible?
|
|
|
|
|
I am giving you here an ideas not test them my self, neither I know if they are aplicable or no.
#1 - In vfp reporting, there is an option to split the report into columns, where you design only the first column and when you run the report, the first column is replicated on the other columns with different data. Check if this feature exist in CR and it is suites you.
#2 - If you can convert the CR document to image, then you can put these 2 images on host (word, excel, ie) and send them to be printed on 1 paper.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Thanks Samir,
I am afraid there is such thing in CR. but I appreciate ur help. I m still waiting for someone to help on my idea
|
|
|
|
|
Commonly, this is left up to the printer driver, especially laser printers. I know HP drivers, at least, have the ability to rearrange the job so that you can print multiple pages of the document on one physical page. CrystalReports has no such option to do this itself.
|
|
|
|