|
the reason it fails because the m_cTabMain control isn't created when the first OnSize message comes through?
Probably. SOmetimes this trick works: insert an UpdateData(FALSE) right at the beginning of CToolTabsDlg::OninitDialog , after the call to the parent's OninitDialog .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Okay,
Just wondering if anyone has seen an STL implementaion used to iterate though an XML document.
While I don't know how this could be implemented I would have though something along the lines of a std::map in that it would be implemented as a tree (as most maps are - bit do not have to be according the specification), have a pair for the node name and the rest of it, but not have the sorting.
|
|
|
|
|
In the C# XML wrapper I wrote recently for WDJ, I did a dictionary ( i.e. a map ) of an XMLDOMNode to it's path, and one to it's value, which I guess is what you're thinking of here, yes ? It's pretty easy to do recursively.
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
|
|
|
|
|
Christian Graus wrote:
In the C# XML wrapper I wrote recently for WDJ, I did a dictionary ( i.e. a map ) of an XMLDOMNode to it's path, and one to it's value, which I guess is what you're thinking of here, yes ? It's pretty easy to do recursively.
Sounds like the kind of thing. What made me think about it was that iterating though an XML tree looks so ugly, getchild and then get its child, and then its best friends dog etc. Its stuff that has to be done over and over and aI though STL may be able to come to the rescue, as iterators can save so much time in the right places.
Only just started looking at C#, haiving bought Tom's book the other day. Not had chance to get stuck in though having been busy with things.
|
|
|
|
|
Tom's book is excellent, but there is nothing on XML in there, apart from XML comments. I think a C++ container that fits into the STL and iterates XML is a great idea. Good enough that I'm considering doing it, unless you intend to ?
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
|
|
|
|
|
Please go ahead, and drop me a line if you need any help with testing etc. While I use STL quite a bit, I've never written any new containters and iterators before, and currently don't have the time to get stuck in, as I'm busy wrting some Excel wrappers which I use for report writing that I was thinking of posting as an article on CP in the near future
After all, you are the STL king around here.
|
|
|
|
|
Giles wrote:
After all, you are the STL king around here.
No, I don't think so Check out the top rated article this week for the STL king. I am but the clown prince.
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
|
|
|
|
|
Christian Graus wrote:
No, I don't think so Check out the top rated article this week for the STL king. I am but the clown prince
Ahh the modesty.
Seriously, let me know how you get on, would be really interested to see how it turns out if you go ahead with it.
Right I'm off to bed, and to find my Harry Potter book. Its somewhere around here.
|
|
|
|
|
Hi I have never use vector in my life
This is what I tried to create integer array
here is my code
#include < vector >
using namespace std;
vector LCArray;
LCArray listCountArray;
but I got these errors
TextTreeDlg.cpp
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : error C2146: syntax error : missing ';' before identifier 'listCountArray'
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : error C2501: 'LCArray' : missing storage-class or type specifiers
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : error C2371: 'LCArray' : redefinition; different basic types
D:\WinGames\TextTree\TextTreeDlg.cpp(23) : see declaration of 'LCArray'
D:\WinGames\TextTree\TextTreeDlg.cpp(24) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
where do i get wrong?
Oh I'm using VC++ and my application is dialog based application
Thanks
|
|
|
|
|
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
|
|
|
|
|