|
To make an edit control that resizes itself investigating the EN_UPDATE[^] message may be a good starting point.
Steve
|
|
|
|
|
Hi!
I am implementing registration scheme in my application and it is my first time. My problem is where to put serial number after user purchase application and enters serial number. I want to write serial number in .txt file and check it every time user start program to see if it is registered or not. Administrator will need to install application but when restricted user want to purchase my application, my program will not have write access in that folder and not even in registry. Where do I need to put this file then? Or is there better way for doing that?
Please help me!
|
|
|
|
|
I think this sould work
create a setup for your application by say InstallShield ,
access the msi data to check the Serial . I dont remember is we can configure InstallShield to check serial#. Not use the Visual Studio to create a installer but surely it has some good options .
Vikas Amin
My First Article on CP" Virtual Serail Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
This will not work or I did not understand you. I will send my serial number after user purchase my program. When he receive it, I will write it in txt file and every time when user start my program, I will open that file and see if it is valid serial number.
|
|
|
|
|
Hi friends,
I have an array of strings
say,
"test","test1","test2","test1" and so on....
How can i find out the string "test1" has a duplicate.
I have to list out all the strings that have duplicates.
If the array is "test","test1","test2","test1","test2","test2","test3" and so on....
Then my output should be "test1","test2".
Since the array size is not fixed , i cannot use arrays for storing the values.
I have tried several logics with vector<> ,but i could not find a solution yet.
Here i am posting the code that removes the duplicates.But I am not sure how to identify the element that has duplicates.
/*Here list already consists the the elements */
vector<string>::iterator iter = list.begin ();
vector<string>::iterator iter1 = list.end ();
//remove duplicates from the list
if (list.size () > 1)
{
for (; iter + 1 != iter1; ++iter)
{
iter1 = remove (iter + 1, iter1, *iter);
}
list.erase (iter1, list.end ());
}
Any kind of help is really appreciated.
Thanks in advance.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
Keep an array of words and occurances, something like:
struct
{
string strWord;
int nCount;
}; For each word that you encounter, look it up in the array. If it's found, increment the associated count. If it's not found, add it.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No. This is not helping me either. Can you give some more explanation on this.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
Which part is troubling you?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
suppose
vector string strVector;
strVector.push_back("test");
strVector.push_back("test1");
strVector.push_back("test2");
strVector.push_back("test");
strVector.push_back("test3");
is my code .
I am not sure about how to use the struct which you have already mentioned ?
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
NiceNaidu wrote: am not sure about how to use the struct which you have already mentioned ?
struct s
{
string strWord;
int nCount;
};
vector<s> vec; Before each call to push_back() , check first to see if the word already exists.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Before each call to push_back(), check first to see if the word already exists.
I am unable to find ,how to find a particular word already exists in the vector? This is my problem.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
Use the find() algorithm. Something like:
struct s
{
public:
s(){}
string strWord;
int nCount;
bool operator==(const s& b)
{
return strWord == b.strWord;
}
};
s s4;
s4.strWord = "word to search for";
vector<s>::iterator it = find(vec.begin(), vec.end(), s4);
if (it != vec.end())
{
}
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
are you offering fries with that ?
This signature was proudly tested on animals.
|
|
|
|
|
Thanks David.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
Try something like this:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
void main()
{
typedef vector<string> words_t;
words_t words;
words.push_back("1");
words.push_back("1");
words.push_back("2");
words.push_back("3");
words.push_back("4");
words.push_back("4");
words_t::iterator i = words.begin();
words_t::iterator e = words.end();
sort(i, e);
for (i=adjacent_find(i, e); i!=e; i=adjacent_find(i, e))
{
cout << *i << endl;
i = find_if(i+1, e, bind2nd(not_equal_to<string>(), *i));
}
}
Steve
|
|
|
|
|
Great ... Thanks Steve..It worked for me.
The problem is i have never worked on STL collections before.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
NiceNaiduhe problem is i have never worked on STL collections before.
You should give the STL a good look. You can't master C++ without being familiar with it.
Steve
|
|
|
|
|
That's true. I will go through a good book of STL.
Is there any specific book available ?
Thanks in Advance.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
This[^] book is a good one.
Steve
|
|
|
|
|
Thanks Steve.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
hii
i have created one windows forms application in vc++.net 2005 .
where i want to use the vector
i included
#include <vector>
also using namespace std;
declare the vector as
std::vector<int>vFile;
int m_Number= 5 ;
vFile.pushback(m_Number);
i am getting the linker error like
Error 1 error LNK2028: unresolved token (0A000380) "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ) referenced in function "public: class std::_Vector_const_iterator<struct FileNames,class std::allocator<struct FileNames> > & __thiscall std::_Vector_const_iterator<struct FileNames,class std::allocator<struct FileNames> >::operator+=(int)" (??Y?$_Vector_const_iterator@UFileNames@@V?$allocator@UFileNames@@@std@@@std@@$$FQAEAAV01@H@Z) 9julyMATDOT.obj
Please help me for resolving this....
Thanks in advance ....
Anamika
|
|
|
|
|
That's a little bit odd. The function it can't find CrtDbgReportW is part of the C Runtime Library (various MSVCRT.dll and related bits depending on version).
Check that your project is set to use it, Properties, Configuration Properties, C/C++, Code Generation, Runtime Library. Try the Multi threaded Debug /MTd option or one of the others if that gives you more/different errors.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
thanks for your reply....
i tried changing the runtime libary to Multi threaded Debug /MTd but of no use .....
|
|
|
|
|
In that case it looks like it might me an include path issue. I still think it odd that this STL code which is distributed as source seems to be requiring the definition of a C Runtime function that isn't part of the standard interface in order to compile. Something subtle/nasty is going on here. Are you trying to mix code from VC6 with VS2002 or later? Do you have the C Runtime source installed with your compiler (it's optional)? I'd start by checking where your build is pulling its STL and CRT header files from. Perhaps one is coming from a much later SDK and the other from a compiler installation
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
I'm working on a linked list class for my latest project and i would like to be able to access any of it's data members just like an array. Is it possible to override the [] operator so that I can do this? If it's not possible, what would be the next easiest way to access my linked list's data members?
|
|
|
|