For a project I used C++ Visual Studio 6.0 and I want to have my source code as a program that will be installed by the user as a trial version.
Making an install file from source code (C++) that is a trial version?
You can use Inno Setup to make your installer. http://www.jrsoftware.org/isinfo.php
It does a fantastic job, and it is free.
As far as making your software a trial version, that is something you will have to do from inside your software. There are infinite ways to do this. The simplest is to make a text file that has the installation date or expiration date, which you read at startup. This is obviously very easy to crack.
If you want to get a little more advanced, add a registry entry during the install that is a hash of the install date combined with part of the computer's mac address. You can then check against that value at startup or on a timer.
Thursday, July 30, 2009
Visual Basic 2005/2008 (VB.NET) OR C#.NET?
I am looking to get into programming. I am proficient with HTML, PHP, and Flash. Which of these languages should I choose, VB.NET OR C#.NET? I need a language with a .NET framework, I will be using Visual Studio as my IDE. I am a beginner and do not know much, but I do have access to video tutorials.
Which of these languages is easier to learn? (VB.NET?)
Which is more flexible and used more often? (C#.NET?)
Which has more demand for and growing?
Thanks for any helpful advice! Happy Holidays!
Visual Basic 2005/2008 (VB.NET) OR C#.NET?
I would consider VB.NET easier to learn because it is more like English, but C# is more like most programming languages in terms of syntax and structure.
You can find plenty of work in either.
http://www.dougv.com/blog/2007/05/26/the...
Reply:C#. Even Microsoft has stated than many VB programmers are moving to C# (40% last year by one account.)
If you have some experience in Javascript and Flash Actionscript, you will be more comfortable with C#, which has similar syntax.
Reply:definitely C#, I used to be a PHP programmer too, and VB is just too different, I would recommend VB if you used Pascal / Delphi before
Btw... not that it really matter anyway, if u use C#, VS provide tools to convert a C# syntax to VB in no time, vice versa
Which of these languages is easier to learn? (VB.NET?)
Which is more flexible and used more often? (C#.NET?)
Which has more demand for and growing?
Thanks for any helpful advice! Happy Holidays!
Visual Basic 2005/2008 (VB.NET) OR C#.NET?
I would consider VB.NET easier to learn because it is more like English, but C# is more like most programming languages in terms of syntax and structure.
You can find plenty of work in either.
http://www.dougv.com/blog/2007/05/26/the...
Reply:C#. Even Microsoft has stated than many VB programmers are moving to C# (40% last year by one account.)
If you have some experience in Javascript and Flash Actionscript, you will be more comfortable with C#, which has similar syntax.
Reply:definitely C#, I used to be a PHP programmer too, and VB is just too different, I would recommend VB if you used Pascal / Delphi before
Btw... not that it really matter anyway, if u use C#, VS provide tools to convert a C# syntax to VB in no time, vice versa
C++ and regular expressions?
I want to search through a file and identify three kinds of tokens: words, new lines, and spaces, using regular expressions.
How do I do this in C++ (Visual Studio 2005)?
Specific examples of code would be appreciated!
Please be as specific as possible (e.g. Please don't just say "use regex"... I have no idea how to use regex or where to get regex and my google searches are proving fruitless...)
C++ and regular expressions?
Bad news is there is no standard regrex support in c++.
Good news is that using regex to split a string into words is like traveling around the corner by a a private jet.
Just go through your string, and look at the chars:
char *word = 0;
for (char *c = input; *c; c++)
{
if (!word) word = c;
if (*c %26gt;= 'A' %26amp;%26amp; *c %26lt;= 'z') continue; //middle of the word;
if (*c == ' ' || *c == '\n') process_blank (c, c - input);
*c = 0; // Terminate the current word
if (word) process_word (word, word - input);
word = 0;
}
This assumes that by "word" you meant any sequence of letters. If you want to allow more characters - like digits or underscores, just modify the condition of the second "if" (that has continue) next to it accordingly.
Reply:I do regex in Perl and Ksh, but not C++, my google search was for :"c++ regular expression for finding newline"
and what I found on one site is below.
A note on new line, sometimes you have to search for both a newline character as well as a carriage return character.
:
Trying It Out
Since searching and matching are so common, the Boost::Regex library has functions for both. The following code demonstrates both, using the preceding test strings as well as another, abc.
#include %26lt;iostream%26gt;
#include %26lt;boost/regex.hpp%26gt;
using namespace std;
void testMatch(const boost::regex %26amp;ex, const string st) {
cout %26lt;%26lt; "Matching " %26lt;%26lt; st %26lt;%26lt; endl;
if (boost::regex_match(st, ex)) {
cout %26lt;%26lt; " matches" %26lt;%26lt; endl;
}
else {
cout %26lt;%26lt; " doesn’t match" %26lt;%26lt; endl;
}
}
void testSearch(const boost::regex %26amp;ex, const string st) {
cout %26lt;%26lt; "Searching " %26lt;%26lt; st %26lt;%26lt; endl;
string::const_iterator start, end;
start = st.begin();
end = st.end();
boost::match_results%26lt;std::string::const_... what;
boost::match_flag_type flags = boost::match_default;
while(boost::regex_search(start, end, what, ex, flags))
{
cout %26lt;%26lt; " " %26lt;%26lt; what.str() %26lt;%26lt; endl;
start = what[0].second;
}
}
int main(int argc, char *argv[])
{
static const boost::regex ex("[Rr]eg...r");
testMatch(ex, "regular");
testMatch(ex, "abc");
testMatch(ex, "some regular expressions are Regxyzr");
testMatch(ex, "RegULarexpressionstring");
testSearch(ex, "regular");
testSearch(ex, "abc");
testSearch(ex, "some regular expressions are Regxyzr");
testSearch(ex, "RegULarexpressionstring");
return 0;
}
Reply:good luck, I've never heard of using regex in c.... but there is a c library called pcre (perl compatible regular expressions) that is used in apache!
How do I do this in C++ (Visual Studio 2005)?
Specific examples of code would be appreciated!
Please be as specific as possible (e.g. Please don't just say "use regex"... I have no idea how to use regex or where to get regex and my google searches are proving fruitless...)
C++ and regular expressions?
Bad news is there is no standard regrex support in c++.
Good news is that using regex to split a string into words is like traveling around the corner by a a private jet.
Just go through your string, and look at the chars:
char *word = 0;
for (char *c = input; *c; c++)
{
if (!word) word = c;
if (*c %26gt;= 'A' %26amp;%26amp; *c %26lt;= 'z') continue; //middle of the word;
if (*c == ' ' || *c == '\n') process_blank (c, c - input);
*c = 0; // Terminate the current word
if (word) process_word (word, word - input);
word = 0;
}
This assumes that by "word" you meant any sequence of letters. If you want to allow more characters - like digits or underscores, just modify the condition of the second "if" (that has continue) next to it accordingly.
Reply:I do regex in Perl and Ksh, but not C++, my google search was for :"c++ regular expression for finding newline"
and what I found on one site is below.
A note on new line, sometimes you have to search for both a newline character as well as a carriage return character.
:
Trying It Out
Since searching and matching are so common, the Boost::Regex library has functions for both. The following code demonstrates both, using the preceding test strings as well as another, abc.
#include %26lt;iostream%26gt;
#include %26lt;boost/regex.hpp%26gt;
using namespace std;
void testMatch(const boost::regex %26amp;ex, const string st) {
cout %26lt;%26lt; "Matching " %26lt;%26lt; st %26lt;%26lt; endl;
if (boost::regex_match(st, ex)) {
cout %26lt;%26lt; " matches" %26lt;%26lt; endl;
}
else {
cout %26lt;%26lt; " doesn’t match" %26lt;%26lt; endl;
}
}
void testSearch(const boost::regex %26amp;ex, const string st) {
cout %26lt;%26lt; "Searching " %26lt;%26lt; st %26lt;%26lt; endl;
string::const_iterator start, end;
start = st.begin();
end = st.end();
boost::match_results%26lt;std::string::const_... what;
boost::match_flag_type flags = boost::match_default;
while(boost::regex_search(start, end, what, ex, flags))
{
cout %26lt;%26lt; " " %26lt;%26lt; what.str() %26lt;%26lt; endl;
start = what[0].second;
}
}
int main(int argc, char *argv[])
{
static const boost::regex ex("[Rr]eg...r");
testMatch(ex, "regular");
testMatch(ex, "abc");
testMatch(ex, "some regular expressions are Regxyzr");
testMatch(ex, "RegULarexpressionstring");
testSearch(ex, "regular");
testSearch(ex, "abc");
testSearch(ex, "some regular expressions are Regxyzr");
testSearch(ex, "RegULarexpressionstring");
return 0;
}
Reply:good luck, I've never heard of using regex in c.... but there is a c library called pcre (perl compatible regular expressions) that is used in apache!
I'm a C++ student and need lots of help?
I'm going to scholl for game development and we program the ghames with C++ visual studio 8....I'v failed the class once and this is my last chance...so I need a online tutor fast....can anyone please help me
Bobby
I'm a C++ student and need lots of help?
what is a ghames?
spring flowers
Bobby
I'm a C++ student and need lots of help?
what is a ghames?
spring flowers
C++: How to create an MFC application that will rename files in a directory?
As a part of a larger MFC application written in C++ (Visual Studio 2005), I would like to include a function that will read in all the filenames in a given directory and rename them to append the date that the file was created to the end of the filename.
Thus, files that were previously named, "hello.txt" and were created on 1/1/2007 would now be named, "hello010107.txt".
Is there an easy way to do this? Keep in mind, this is an MFC application (with windows, buttons, forms, etc), not a console application.
C++: How to create an MFC application that will rename files in a directory?
Here ya go:
#include %26lt;afxtempl.h%26gt;
void TimeStampFiles(CString Path)
{
// enumerate all files in the directory and place them in an array
CStringArray files;
CFileFind finder;
BOOL bWorking = finder.FindFile(Path + "\\*.*");
while (bWorking)
{
// ignore directories
bWorking = finder.FindNextFile();
if (!finder.IsDirectory())
files.Add(finder.GetFilePath());
}
// now cycle through the array
for (int i=0; i%26lt;files.GetSize(); i++)
{
// get the file path, title and extension
CString path = GetPath(files[i]); // e.g. "c:\\dir\\"
CString title = GetTitle(files[i]); // e.g. "name"
CString extension = GetExtension(files[i]); // e.g. "ext"
// get the time for this file
CTime time;
finder.GetCreationTime(time);
// construct the string
CString timeString = time.Format("%m%d%Y");
// construct the new filename
CString newName = path + title + timeString + "." + extension;
// rename it
CFile::Rename(files[i], newName);
}
}
What this does is first enumerate all the files and place them in an array....you don't want to be modifying the contents of a directory while you're looping through it. It then goes through the array and names each file at a time. The only functions I haven't implemented are the 3 that seperate the full path and filename into the path, the file title and the extension, but they should be easy enough to look up.
Enjoy!
Reply:You can do it, but there is no 'easy way' shortcut.
You need to use FindFirstFile() and FindNextFile() to iterate through the files in the directory. Here's sample code: http://netez.com/2xExplorer/shellFAQ/bas...
Be sure to explicitly ignore '.' and '..' when iterating through the file names and also ignore subdirectories. See sample code for how to determine whether you're looking at a filename or a subdir name.
Collect all the valid file names into a container (vector would work). Once you are done getting all the file names, start iterating through your vector. Parse the existing file name at the dot, and build your new file name, then call ::MoveFileEx( ) to rename the file. Be sure you use the full path in the file names.
How are you planning to use this? You'll only be able to run it once on a directory. If you run it a second time, you'll keep expanding the already-renamed files with more date decoration. Maybe you need a more unique naming convention so you can decide that the file is already renamed and leave it alone.
Thus, files that were previously named, "hello.txt" and were created on 1/1/2007 would now be named, "hello010107.txt".
Is there an easy way to do this? Keep in mind, this is an MFC application (with windows, buttons, forms, etc), not a console application.
C++: How to create an MFC application that will rename files in a directory?
Here ya go:
#include %26lt;afxtempl.h%26gt;
void TimeStampFiles(CString Path)
{
// enumerate all files in the directory and place them in an array
CStringArray files;
CFileFind finder;
BOOL bWorking = finder.FindFile(Path + "\\*.*");
while (bWorking)
{
// ignore directories
bWorking = finder.FindNextFile();
if (!finder.IsDirectory())
files.Add(finder.GetFilePath());
}
// now cycle through the array
for (int i=0; i%26lt;files.GetSize(); i++)
{
// get the file path, title and extension
CString path = GetPath(files[i]); // e.g. "c:\\dir\\"
CString title = GetTitle(files[i]); // e.g. "name"
CString extension = GetExtension(files[i]); // e.g. "ext"
// get the time for this file
CTime time;
finder.GetCreationTime(time);
// construct the string
CString timeString = time.Format("%m%d%Y");
// construct the new filename
CString newName = path + title + timeString + "." + extension;
// rename it
CFile::Rename(files[i], newName);
}
}
What this does is first enumerate all the files and place them in an array....you don't want to be modifying the contents of a directory while you're looping through it. It then goes through the array and names each file at a time. The only functions I haven't implemented are the 3 that seperate the full path and filename into the path, the file title and the extension, but they should be easy enough to look up.
Enjoy!
Reply:You can do it, but there is no 'easy way' shortcut.
You need to use FindFirstFile() and FindNextFile() to iterate through the files in the directory. Here's sample code: http://netez.com/2xExplorer/shellFAQ/bas...
Be sure to explicitly ignore '.' and '..' when iterating through the file names and also ignore subdirectories. See sample code for how to determine whether you're looking at a filename or a subdir name.
Collect all the valid file names into a container (vector would work). Once you are done getting all the file names, start iterating through your vector. Parse the existing file name at the dot, and build your new file name, then call ::MoveFileEx( ) to rename the file. Be sure you use the full path in the file names.
How are you planning to use this? You'll only be able to run it once on a directory. If you run it a second time, you'll keep expanding the already-renamed files with more date decoration. Maybe you need a more unique naming convention so you can decide that the file is already renamed and leave it alone.
A little help with C++?
I am confident that i know the basics of C++, but what i want to know is how to add a (UI) user interface. Instead of the simple console applications.
Compilers i use are
Dev C++
Visual studio 2008 express edition.
Anyone tell me how to get started with that, i have no idea where to begin or how to start.
Thanks in advance.
A little help with C++?
in straigt visual c++ you could use the MFC libraries for graphical interfaces, or you can use gtk+ etc etc. But for .NET languages, you just need to add a form to the project and set it as the start UI.
Reply:In the express edition, you cannot use the built in GUI creator. You can, however, use it in the Visual Studio 2005 one. (Or any other non express ones). Otherwise you have to learn a graphics library such as GTK or wxWidgets. You can also try straight Win32 GUI code, but that takes some memorization...
Reply:Ok.....
Heres the website i use for my learnin of C++ programing...
http://www.cprogramming.com
I guess the website says it all...
Compilers i use are
Dev C++
Visual studio 2008 express edition.
Anyone tell me how to get started with that, i have no idea where to begin or how to start.
Thanks in advance.
A little help with C++?
in straigt visual c++ you could use the MFC libraries for graphical interfaces, or you can use gtk+ etc etc. But for .NET languages, you just need to add a form to the project and set it as the start UI.
Reply:In the express edition, you cannot use the built in GUI creator. You can, however, use it in the Visual Studio 2005 one. (Or any other non express ones). Otherwise you have to learn a graphics library such as GTK or wxWidgets. You can also try straight Win32 GUI code, but that takes some memorization...
Reply:Ok.....
Heres the website i use for my learnin of C++ programing...
http://www.cprogramming.com
I guess the website says it all...
C# help please?
In C# Visual Studio 2005 how do I make it so that when the mouse is no longer in the group box area something happens? Here is my code so far:
private void groupBox1_MouseHover(object sender, EventArgs e)
{
btnTopIncrease.Visible = true;
}
How do I modify this code so that this happens when the mouse is out of the area?
Thanks,
Sophie
C# help please?
I don't know C# very well (only the bare basics) but you should look for one of the following:
1. Put the group boxes in a "block", I don't know the exact term but it's the line that goes around a grouping of controls. You can set a hover on that, so when the hover is on that, do what you want to happen when it's out of the grouping of radio buttons.
2. Not sure if this'll work or not, but the same as #1, but instead of using another control under the radio buttons, try with the form itself and set a private variable for the status. So...something like statusShow = true, within the MouseHover function, and then on hover for the main form something like:
if(statusShow == true) {
// Do your stuff here.
}
There may other options too, I'm not sure off hand though.
Reply:The MouseHover event is triggered when the mouse is stationary over the control. There are other events like MouseEnter and MouseLeave that would be more appropriate for what you want to do. Add an event handler for MouseLeave to trigger an event when the mouse leaves the control.
private void groupBox1_MouseHover(object sender, EventArgs e)
{
btnTopIncrease.Visible = true;
}
How do I modify this code so that this happens when the mouse is out of the area?
Thanks,
Sophie
C# help please?
I don't know C# very well (only the bare basics) but you should look for one of the following:
1. Put the group boxes in a "block", I don't know the exact term but it's the line that goes around a grouping of controls. You can set a hover on that, so when the hover is on that, do what you want to happen when it's out of the grouping of radio buttons.
2. Not sure if this'll work or not, but the same as #1, but instead of using another control under the radio buttons, try with the form itself and set a private variable for the status. So...something like statusShow = true, within the MouseHover function, and then on hover for the main form something like:
if(statusShow == true) {
// Do your stuff here.
}
There may other options too, I'm not sure off hand though.
Reply:The MouseHover event is triggered when the mouse is stationary over the control. There are other events like MouseEnter and MouseLeave that would be more appropriate for what you want to do. Add an event handler for MouseLeave to trigger an event when the mouse leaves the control.
Subscribe to:
Posts (Atom)