|
Thanks alot for your posting and actually it was quite helpful, I think i might use several hardware ids to protect my software, such as i could validate processor serial number, motherboard Id, MAC address, hard disk serial number etc. if any of these Ids can be validated, then we would say the software is geniune user. If a uses completely upgrade his/her system, then the user has to let us know.
|
|
|
|
|
|
You should probably use WMI to gather a system-specific info string, and encrypt it, and transfer the encrypted info to a database that's not on the user's machine. When the program runs, it should perform this same process, and if the encrypted string it comes up with doesn't match what's in the database, don't let the program run.
A few considerations:
0) if there is no internet connection, the program should run as it normally would if it was validated.
1) If it can't find the validation server, the program should run as it normally would if it was validated.
2) In the event that the app goes EOL or you no longer want to require remote validation, provide a method for the program to run WITHOUT checking the validation server. My suggestoion is an entry in the app.config file that tells the app not to bother checking..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
this is indeed a good answer thanks
|
|
|
|
|
Then please vote it as a good answer. .45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
hi,
if i have already open form1, how do i check and not open form1 again??
|
|
|
|
|
i think there is property called isActiveForm, check using this. or else
while opening the form assign a golbal variable (say true), and set this to false on closing that form.
using this global variable u can validate whether the form is opened or not
|
|
|
|
|
assume if you are checking the form "form1", code is below.
public static Form IsFormAlreadyOpen(Type FormType)
{
foreach (Form OpenForm in Application.OpenForms)
{
if (OpenForm.GetType() == FormType)
return OpenForm;
}
return null;
}
private void button1_Click(object sender, EventArgs e)
{
Form frmTest;
if ((frmTest = IsFormAlreadyOpen(typeof(Form1))) == null)
{
frmTest = new Form1();
frmTest.Show();
}
else
{
frmTest.WindowState = FormWindowState.Normal;
frmTest.BringToFront();
}
} this code opens the form if it's not already open otherwise it'll make active form.
thatraja
|
|
|
|
|
hi thatraja, tks. erm i forgot to mention that i was doing it for windows mobile =). so Application.OpenForms is not available
|
|
|
|
|
If this is the same App we talked about yesterday, the list you created to show which forms need to be closed would also double up as a list of open forms wouldn't it? If it needs to be closed at log off, it's open... If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Hello I have a simple Panel class object that has a Button and Label on it.
I use the button to display an image and the label to display info on it.
It is used as a "Media Selection Tool"
The problem that I am having is when I resize the object there are cases when I will modify the object's size again.
When this is done, the code will recall the resize event again and again till its happy then exit.
Can I not prevent the resizing event till all the width and height stuff is done?
if (mode == 0)
{
this.Width = ImageButton.Width;
InfoTextBox.Visible = false;
}
For example when the above occurs, there is no infomation to be displayed therefore my object only needs to be the size of the Button to display the image.
But when "this.Width = " is executed the whole resize event gets called again.
Thank you in advance.
PS is this just sloppy code?
private void Initialize_Components()
{
this.SuspendLayout();
this.Width = 200;
this.Height = 200;
ImageButton = new Button();
InfoTextBox = new Label();
ImageButton.BackgroundImageLayout = ImageLayout.Stretch;
this.Click += new System.EventHandler(MediaIconButtonClick);
ImageButton.Click += new System.EventHandler(MediaIconButtonClick);
InfoTextBox.Click += new System.EventHandler(MediaIconButtonClick);
this.BorderStyle = BorderStyle.Fixed3D;
this.Controls.Add(ImageButton);
this.Controls.Add(InfoTextBox);
this.Resize += new System.EventHandler(this.MediaIconClass_Resize);
this.ResumeLayout(false);
this.PerformLayout();
}
public MediaIcon()
{
Initialize_Components();
}
private void MediaIconClass_Resize(object sender, EventArgs e)
{
this.SuspendLayout();
InfoTextBox.Height = this.Height;
ImageButton.Height = this.Height;
if (ImageHeight != 0)
{
ImageButton.Width = ImageButton.Height * ImageWidth / ImageHeight;
InfoTextBox.Left = ImageButton.Right;
}
else
{
ImageButton.Width = this.Width / 2;
InfoTextBox.Left = ImageButton.Right;
}
if (mode == 0)
{
this.Width = ImageButton.Width;
InfoTextBox.Visible = false;
}
else
{
InfoTextBox.Visible = true;
}
this.ResumeLayout(false);
this.PerformLayout();
}
|
|
|
|
|
You could do one or more of the following:
1) Check to see if it is already that width, and if so don't change it.
2) Remove the resize event handler at the top of a series of changes, and reinstate it just before the last one.
3) Add a bool to say "Resizing" and check it at the start of your event handler.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Sorry for my poor English.
My Question is: How to get which group was matched after a regex.match with grouped pattern string?
for instance:
string strPattern = "\Wo*e\W|\Wt*o\W|three|four";
string strTextToSearch = "there are two apples on the table";
Regex r = new Regex(strPattern);
Match m = r.Match(strTextToSearch);
if (m.Success)
{
//how can i know it is keyword "\Wt*o\W" was matched but not the others?
}
|
|
|
|
|
newproger wrote:
Nightmare with Regular Expression
YES you're right(not left) RegExp==NIGHTMARE
I'm sorry I just feel like joking. I can't help it.
|
|
|
|
|
Groups are automatically named according to their occurance order, but you can also name them yourself (this is called "named groups"). For example, the following regular expression has three named groups:
The (?<ANIMAL>cat|dog|penguin|langolier) (?<TRANSPORT>walked|waddled|flew) down the (?<PATH>street|yellow brick road|slope)\.
|
|
|
|
|
Thanks for reply.
But in my program, the pattern string is generated at runtime(keywords inputed by user), I can't know how many keywords in design time, so I can't set fixed group name in codes.
|
|
|
|
|
newproger wrote: Regex r = new Regex(strPattern);
Match m = r.Match(strTextToSearch);
if (m.Success)
{
//how can i know it is keyword "\Wt*o\W" was matched but not the others?
}
maube something like this:
m.Groups[1].Value
m.Groups[1].Index
|
|
|
|
|
i notice that in c# or c++, we normally indicate the size of an array.
string[] strArray = new string[5];
strArray[0] = "Ronnie";
strArray[1] = "Jack";
strArray[2] = "Lori";
strArray[3] = "Max";
strArray[4] = "Tricky";
Another way is like this:
string[] strArray = new string[] {"Ronnie", "Jack", "Lori", "Max", "Tricky"};
Both have fixed size. is there a way to create an array which can store unlimited amount of data?
I know of ArrayList but it is not available in compact framework.
|
|
|
|
|
What about List?
It has all the functionality of array/arrayList.
|
|
|
|
|
okay my bad. arraylist is available in compact framework.
however, im gonna try your suggestion instead. List looks like a better choice =)
|
|
|
|
|
Arrays in the .NET CLR are not resizable. Once they are created, that's it. In order to change their size, you'd have to create a new array of the required size, copy the data over, then destroy the original array.
|
|
|
|
|
|
There is something called Redim which used to resize the array at later stage, or the best you can do is go for arraylist
|
|
|
|
|
C# doesn't have a ReDim method like VB.NET does.
And, in VB.NET ReDim does NOT resize an array. Behind the scenes it has to do the exact same thing you'd do manually. It creates a new array of the required size, copies the data to it, then destroys the original array.
|
|
|
|
|
Actually, all .NET languages have access to the static "System.Array.Resize" method (since .NET Framework 2, I believe) - but as you said, there's no magic - it just does the same copying that VB's ReDim does. David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|