|
I see you worked it out
1. what is
Win wrote:
vectorLCArray;
????
Is this a typedef that is still missing it's < > ? I think it's better just to have vector<int> listCountArray. Oh, don't call it list, it's not a list at all.
2. You should use the bits of std you need, as in using std::vector. Otherwise, why have namespaces at all ?
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
my actual code is
<br />
#include < vector ><br />
using namespace std;<br />
vector < int > LCArray;<br />
LCArray listCountArray;<br />
all the < > were gone when I didn't put the space between them..
thanks
|
|
|
|
|
OK then, I could not tell what you were doing with the missing bits.
I think you must have seen some code that uses typedefs. The third line creates a vector of ints called LCArray, and the fourth line attempts to use this object as a type. Remove it, or add 'typedef' to the start of the line above. And as I said, only use the bits of std you need, and don't call it a list, it isn't one. list is a totally different container to vector.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hi I have never use vector in my life
This is what I tried to create integer array
here is my code
<br />
#include <vector><br />
using namespace std;<br />
vector<int>LCArray;<br />
LCArray listCountArray;<br />
<br />
<br />
but I got these errors<br />
TextTreeDlg.cpp<br />
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : error C2146: syntax error : missing ';' before identifier 'listCountArray'<br />
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : error C2501: 'LCArray' : missing storage-class or type specifiers<br />
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : error C2371: 'LCArray' : redefinition; different basic types<br />
D:\WinGames\TextTree\TextTreeDlg.cpp(23) : see declaration of 'LCArray'<br />
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : fatal error C1004: unexpected end of file found<br />
Error executing cl.exe.<br />
<br />
where do i get wrong?
Oh I'm using VC++ and my application is dialog based application
Thanks
|
|
|
|
|
The < and > have been stripped from your post - you needed to check 'display message as is' below the message.
#include <vector>
using std::vector;
vector<int> myVec;
I do not use typedefs with STL, they are a good way to uglify and obsfucate your code.
Christian
<i>Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that...</i> - <b>Shog9 04-09-2002</b>
<i>During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. </i> - <B>Alex E. - 12-Sept-2002</B>
|
|
|
|
|
Hi, my program needs to do some lengthy process without any interruption on users computer, however if the user has screen saver enabled things will be completely screwed up. I remember I saw a post here about disabling screen saver a few eeks ago but now I can't find it anymore.
Thanks.
|
|
|
|
|
Look up SystemParametersInfo in MSDN. There is a section on screen savesr.
|
|
|
|
|
|
<br />
<br />
BOOL screenSaverActive;<br />
<br />
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &screenSaverActive, 0);<br />
<br />
if (screenSaverActive)<br />
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);<br />
...<br />
<br />
if (screenSaverActive)
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);
|
|
|
|
|
I've recently run across the problem of adding a CRC32 code to an executable that would allow it to validate itself when run. The CRC32 code is contained in a data segment appended to the end of the EXE. The problem: if you calculate the CRC of the EXE, THEN update it to contain the CRC, you will then have a slightly different EXE than before, which can only be validated with a different CRC...You can repeat this process ad infinitum and not able to have the EXE contain a CRC code that will validate its entire length. I took the easy way out and excluded the data segment containing the CRC from validation. But just out of curiosity, it is possible, theoretically, to have the EXE contain a CRC code that will validate its ENTIRE length???
Henry P.
|
|
|
|
|
Like a dog sniffing its ass.
If I'm right in remembering how a CRC works, you could fudge the value, by calculating your CRC, appending it, and adding some extra characters to bring it back around the the CRC you have already canceled. Also you could do it for the first x bytes, and append the CRC at the end.
As I was saying as the Cecksum overflows, it just goes back to zero. So it should be fudgable.
So be more secure calc the MD5 digest of the program, remembering to check the first x bytes, and then compare if to the final 8 bytes - the 128bit MDF hash.
This should make it much more difficult for someone to fake, as adding a few characters will not bring the MD5 hash back around like a CRC.
Does that make sense?
Henry P. wrote:
it is possible, theoretically, to have the EXE contain a CRC code that will validate its ENTIRE length???
It should be, but those numbers would be few and far between - kind of magic numbers.
|
|
|
|
|
you could write a little app to open the EXE file, calculate its CRC, then tack that value onto the end of the file, or overwrite at a specific offset (ie. the value of a variable somewhere). then, the EXE can just open itself, scan itself (skipping the pre-determined offset pos) and compare.
-c
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
I have been working on this program for a while, just a simple Doc/View based database. I am new at programming and have learned A LOT while doing this but have come to the end of ideas on how to make my menu item ID_MENU_VIEW_CATALOG which is a dialog box, pop up when it is clicked. In fact, the item is disabled when I compile my program, even though I have the "Disabled FALSE" selected in the properties. Could someone please grant me some guidence and tell me what I need to do? I would really appreciate it.
Thanks,
Garry
|
|
|
|
|
I am not clear as to whether you want to instantiate a dialog box or to enable a menu item.
In terms of a menu item, make sure the follow options are set correctly in resource editor.
Enable - TRUE
Grayed - FALSE
Kuphryn
|
|
|
|
|
I'm sorry, I tend to go a little over board when explaining. I would like to instantiate a dialog box or to enable a menu item.
Thank you,
Garry
|
|
|
|
|
ummmmm to make a dialog appear from the menu click (and to make the menu not disabled automatically) make sure u have a message handler for the menu item in the app somewhere (usually the mainframe)
if u dont the menu is disabled and nada de nada happens when u click it
unless of course i got completely the wrong idea from the post
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" biz stuff about me
|
|
|
|
|
Hey all, I am hoping someone out there can help me.
I am sure this is a very beginner question, but then when it comes to databases, I am a very beginner. I am using MySQL with MyODBC. I have set up my CRecordView derived view (CFarmView ) and my CRecordSet derived recordset (CFarmSet ). When I view the records everything seems to work fine as I can step back and forth between records (using the first, previous, next, and last wizard supplied toolbar buttons).
Now I want to update a record, so I added a save button to my CFarmView with the following ON_BN_CLICKED handler :
void CFarmView::OnBnClickedSave()
{
m_pSet->Edit();
UpdateData(TRUE);
if (m_pSet->Update())
MessageBox ("Yes! :o)");
else
MessageBox ("No :o(");
}
When I execute the m_pSet->Update() line, I get a messagebox with the message "No cursor name available" and the output window shows the following TRACE output
No cursor name available
State:S1015,Native:0,Origin:[TCX][MyODBC]
Can anyone explain to me what this means, and how can I fix it?
ps. m_pSet->CanUpdate() returns TRUE so it is updateable.
pps. If it makes a difference, I am using VC7 on W2K.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
I have this small program I want to sell as shareware and I was looking at ways to let the program expire after running x times.
I've read Nish's article[^], which I consider to be quite usefull.
That leaves another question:
How do you guys implement the license code part of shareware. Any good tips, articles on this.
I've looked at some shareware tools that automatically adds these things to your program, but I prefer to write my own code or use an opensource/freeware thing.
What do you use for encryption, generating the codes, etc...
I also saw a few e-commerce sites who offers automatic generation of license codes via a procedure which you supply.
This implies having a procedure that mangels a eg. company name/person's name to a valid key code.
I also see sites which can send out a predefined set of codes, probably based on a private key kind of thing, so without entering company information.
Is MD5 the way to go or do you use some other encryption techniques?
Thanks in advance,
Wim
|
|
|
|
|
Forget about licenses and stuff like that ... it doesn't really work, someone will always find a way, not to crack the license, but to go directly into the binary and find where the check function returns true or false and will add a JMP or something like that ...
If you want to distribute your application as a shareware, make the shareware a subset of the real full application or make the application save/render weird data. So the user will have fun with the shareware, and at some point will either buy it, or trash it. If she likes it, she will buy it ...
Max.
|
|
|
|
|
I urge you to reconsider the expiry concept. Instead, restrict the functionality of an unregistered version and/or use nag screens. I use this scheme in my products[^].
I often need more time to evaluate a program than 15 or 30 days, since I might not get time to try it for 10-20 days after installation. Imho, restricting the number of runs is equally bad.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello,
I had a look at your memwatcher product - which by the way looked great! - and I saw that you used a (company)name to register your product.
Do you mind to share how you implement this. Do you use a private key (internally in the program) together with a public key (companyname) to generate the registration code? Via what encryption protocol?
Or don't you use the name at all, as it is not really required at the registration site (else it should be required that the name entered at the site should match the one entered in the program).
That means you work with a set of predefined numbers which the site sends out?
I totally understand of course that you don't want to share this top secret information
I'm just interested.
thanks in advance,
Wim
|
|
|
|
|
Hi Wim, I'll respond offline.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Rule number one:
There's always a crack, that's how the light gets in
Rule number two:
Ur always a bpx away from finding that light
Forget about hiding code, just dont put it there
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
[ Crossposted in the XML forum]
My brief exposure to XML has been restricted to writing a compiler using SAX (in Java). I'm now back in C++/MFC land and need to populate a data structure with data read from an XML file, validated against a DTD. I also need to create an XML file, given a DTD.
Can you recommend a good "teach yourself DOM in 21 minutes" book or link? I'd especially like to know how to use DTDs to validate incoming data and write XML files.
Thanks!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hmm, MSDN's XML tutorial[^] seems like what I was looking for. Book and link recommendations are still welcome. Thanks!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|